Revert "Refactored code in an attempt to break dependency cycles"
This reverts commit 195af6e6b27c23c7beb98f4cd425e7d7ffff1ecd.
diff --git a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
index f9f0381..cdcf84b 100644
--- a/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
+++ b/core/store/hz/cluster/src/main/java/org/onlab/onos/store/cluster/impl/DistributedDeviceMastershipStore.java
@@ -14,8 +14,8 @@
import org.onlab.onos.cluster.ClusterService;
import org.onlab.onos.cluster.NodeId;
import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.MastershipRole;
import org.onlab.onos.net.device.DeviceMastershipEvent;
-import org.onlab.onos.net.device.DeviceMastershipRole;
import org.onlab.onos.net.device.DeviceMastershipStore;
import org.onlab.onos.net.device.DeviceMastershipStoreDelegate;
import org.onlab.onos.net.device.DeviceMastershipTerm;
@@ -76,7 +76,7 @@
}
@Override
- public DeviceMastershipRole getRole(NodeId nodeId, DeviceId deviceId) {
+ public MastershipRole getRole(NodeId nodeId, DeviceId deviceId) {
byte[] did = serialize(deviceId);
byte[] nid = serialize(nodeId);
@@ -84,17 +84,17 @@
if (current == null) {
if (standbys.containsEntry(did, nid)) {
//was previously standby, or set to standby from master
- return DeviceMastershipRole.STANDBY;
+ return MastershipRole.STANDBY;
} else {
- return DeviceMastershipRole.NONE;
+ return MastershipRole.NONE;
}
} else {
if (current.equals(nodeId)) {
//*should* be in unusable, not always
- return DeviceMastershipRole.MASTER;
+ return MastershipRole.MASTER;
} else {
//may be in backups or unusable from earlier retirement
- return DeviceMastershipRole.STANDBY;
+ return MastershipRole.STANDBY;
}
}
}
@@ -107,7 +107,7 @@
ILock lock = theInstance.getLock(LOCK);
lock.lock();
try {
- DeviceMastershipRole role = getRole(nodeId, deviceId);
+ MastershipRole role = getRole(nodeId, deviceId);
switch (role) {
case MASTER:
//reinforce mastership
@@ -157,7 +157,7 @@
}
@Override
- public DeviceMastershipRole requestRole(DeviceId deviceId) {
+ public MastershipRole requestRole(DeviceId deviceId) {
NodeId local = clusterService.getLocalNode().id();
byte [] did = serialize(deviceId);
byte [] lnid = serialize(local);
@@ -165,7 +165,7 @@
ILock lock = theInstance.getLock(LOCK);
lock.lock();
try {
- DeviceMastershipRole role = getRole(local, deviceId);
+ MastershipRole role = getRole(local, deviceId);
switch (role) {
case MASTER:
evict(lnid, did);
@@ -179,7 +179,7 @@
masters.put(did, lnid);
evict(lnid, did);
updateTerm(did);
- role = DeviceMastershipRole.MASTER;
+ role = MastershipRole.MASTER;
break;
default:
log.warn("unknown Mastership Role {}", role);
@@ -210,7 +210,7 @@
ILock lock = theInstance.getLock(LOCK);
lock.lock();
try {
- DeviceMastershipRole role = getRole(nodeId, deviceId);
+ MastershipRole role = getRole(nodeId, deviceId);
switch (role) {
case MASTER:
event = reelect(nodeId, deviceId);
@@ -239,7 +239,7 @@
ILock lock = theInstance.getLock(LOCK);
lock.lock();
try {
- DeviceMastershipRole role = getRole(nodeId, deviceId);
+ MastershipRole role = getRole(nodeId, deviceId);
switch (role) {
case MASTER:
event = reelect(nodeId, deviceId);