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
88fb52f3
Commit
88fb52f3
authored
12 years ago
by
Rob Adams
Browse files
Options
Downloads
Patches
Plain Diff
Don't set role again if it's the same. Partial fix for BSC-1835
parent
82b4a63d
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/core/internal/Controller.java
+10
-3
10 additions, 3 deletions
...va/net/floodlightcontroller/core/internal/Controller.java
with
10 additions
and
3 deletions
src/main/java/net/floodlightcontroller/core/internal/Controller.java
+
10
−
3
View file @
88fb52f3
...
@@ -345,12 +345,14 @@ public class Controller implements IFloodlightProviderService,
...
@@ -345,12 +345,14 @@ public class Controller implements IFloodlightProviderService,
}
}
@Override
@Override
public
synchronized
Role
getRole
()
{
public
Role
getRole
()
{
return
role
;
synchronized
(
roleChanger
)
{
return
role
;
}
}
}
@Override
@Override
public
synchronized
void
setRole
(
Role
role
)
{
public
void
setRole
(
Role
role
)
{
if
(
role
==
null
)
throw
new
NullPointerException
(
"Role can not be null."
);
if
(
role
==
null
)
throw
new
NullPointerException
(
"Role can not be null."
);
// Need to synchronize to ensure a reliable ordering on role request
// Need to synchronize to ensure a reliable ordering on role request
...
@@ -359,6 +361,11 @@ public class Controller implements IFloodlightProviderService,
...
@@ -359,6 +361,11 @@ public class Controller implements IFloodlightProviderService,
// timeout handling
// timeout handling
// @see RoleChanger
// @see RoleChanger
synchronized
(
roleChanger
)
{
synchronized
(
roleChanger
)
{
if
(
role
.
equals
(
this
.
role
))
{
log
.
debug
(
"Ignoring role change: role is already {}"
,
role
);
return
;
}
Role
oldRole
=
this
.
role
;
Role
oldRole
=
this
.
role
;
this
.
role
=
role
;
this
.
role
=
role
;
...
...
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