Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaowei
dlink
Commits
87c494cb
Unverified
Commit
87c494cb
authored
Oct 24, 2022
by
Licho
Committed by
GitHub
Oct 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: ResultPool concurrence hidden danger (#1147)
parent
4c7bb539
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
ResultPool.java
dlink-core/src/main/java/com/dlink/result/ResultPool.java
+7
-8
No files found.
dlink-core/src/main/java/com/dlink/result/ResultPool.java
View file @
87c494cb
...
...
@@ -19,8 +19,8 @@
package
com
.
dlink
.
result
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* ResultPool
...
...
@@ -28,9 +28,12 @@ import java.util.Map;
* @author wenmo
* @since 2021/7/1 22:20
*/
public
class
ResultPool
{
public
final
class
ResultPool
{
private
static
volatile
Map
<
String
,
SelectResult
>
results
=
new
HashMap
<
String
,
SelectResult
>();
private
ResultPool
()
{
}
private
static
final
Map
<
String
,
SelectResult
>
results
=
new
ConcurrentHashMap
<>();
public
static
boolean
containsKey
(
String
key
)
{
return
results
.
containsKey
(
key
);
...
...
@@ -41,11 +44,7 @@ public class ResultPool {
}
public
static
SelectResult
get
(
String
key
)
{
if
(
results
.
containsKey
(
key
))
{
return
results
.
get
(
key
);
}
else
{
return
SelectResult
.
buildDestruction
(
key
);
}
return
results
.
getOrDefault
(
key
,
SelectResult
.
buildDestruction
(
key
));
}
public
static
boolean
remove
(
String
key
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment