Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
floodlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
croft1
floodlight
Commits
76007c4c
Commit
76007c4c
authored
11 years ago
by
Kuang-Ching Wang
Browse files
Options
Downloads
Plain Diff
Merge pull request #403 from vy/patch-4
Use an AtomicLong for deviceKeyCounter.
parents
9f061011
1218c2e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+3
-9
3 additions, 9 deletions
...tcontroller/devicemanager/internal/DeviceManagerImpl.java
with
3 additions
and
9 deletions
src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java
+
3
−
9
View file @
76007c4c
...
...
@@ -33,6 +33,7 @@ import java.util.ListIterator;
import
java.util.Map
;
import
java.util.Queue
;
import
java.util.Set
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -128,12 +129,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
/**
* Counter used to generate device keys
*/
protected
long
deviceKeyCounter
=
0
;
/**
* Lock for incrementing the device key counter
*/
protected
Object
deviceKeyLock
=
new
Object
();
protected
AtomicLong
deviceKeyCounter
=
new
AtomicLong
(
0
);
/**
* This is the primary entity index that contains all entities
...
...
@@ -1222,9 +1218,7 @@ IFlowReconcileListener, IInfoProvider, IHAListener {
device
=
null
;
break
;
}
synchronized
(
deviceKeyLock
)
{
deviceKey
=
Long
.
valueOf
(
deviceKeyCounter
++);
}
deviceKey
=
deviceKeyCounter
.
getAndIncrement
();
device
=
allocateDevice
(
deviceKey
,
entity
,
entityClass
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"New device created: {} deviceKey={}, entity={}"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment