Skip to content
Snippets Groups Projects
Commit a842b011 authored by abat's avatar abat
Browse files

Merge into master from pull request #190:

Don't set role again if it's the same. Partial fix for BSC-1835 (https://github.com/floodlight/floodlight/pull/190)
parents 3229f5c0 88fb52f3
No related branches found
No related tags found
No related merge requests found
......@@ -345,12 +345,14 @@ public class Controller implements IFloodlightProviderService,
}
@Override
public synchronized Role getRole() {
return role;
public Role getRole() {
synchronized(roleChanger) {
return role;
}
}
@Override
public synchronized void setRole(Role role) {
public void setRole(Role role) {
if (role == null) throw new NullPointerException("Role can not be null.");
// Need to synchronize to ensure a reliable ordering on role request
......@@ -359,6 +361,11 @@ public class Controller implements IFloodlightProviderService,
// timeout handling
// @see RoleChanger
synchronized(roleChanger) {
if (role.equals(this.role)) {
log.debug("Ignoring role change: role is already {}", role);
return;
}
Role oldRole = this.role;
this.role = role;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment