Fixed MastershipManager to autostart and to have proper dependency on the Cluste…
…rService not ClusterManager.
Showing
1 changed file
with
7 additions
and
2 deletions
... | @@ -5,9 +5,12 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -5,9 +5,12 @@ import static org.slf4j.LoggerFactory.getLogger; |
5 | import java.util.Set; | 5 | import java.util.Set; |
6 | 6 | ||
7 | import org.apache.felix.scr.annotations.Activate; | 7 | import org.apache.felix.scr.annotations.Activate; |
8 | +import org.apache.felix.scr.annotations.Component; | ||
8 | import org.apache.felix.scr.annotations.Deactivate; | 9 | import org.apache.felix.scr.annotations.Deactivate; |
9 | import org.apache.felix.scr.annotations.Reference; | 10 | import org.apache.felix.scr.annotations.Reference; |
10 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 11 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
12 | +import org.apache.felix.scr.annotations.Service; | ||
13 | +import org.onlab.onos.cluster.ClusterService; | ||
11 | import org.onlab.onos.cluster.MastershipAdminService; | 14 | import org.onlab.onos.cluster.MastershipAdminService; |
12 | import org.onlab.onos.cluster.MastershipEvent; | 15 | import org.onlab.onos.cluster.MastershipEvent; |
13 | import org.onlab.onos.cluster.MastershipListener; | 16 | import org.onlab.onos.cluster.MastershipListener; |
... | @@ -26,6 +29,8 @@ import org.slf4j.Logger; | ... | @@ -26,6 +29,8 @@ import org.slf4j.Logger; |
26 | 29 | ||
27 | import static com.google.common.base.Preconditions.checkNotNull; | 30 | import static com.google.common.base.Preconditions.checkNotNull; |
28 | 31 | ||
32 | +@Component(immediate = true) | ||
33 | +@Service | ||
29 | public class MastershipManager | 34 | public class MastershipManager |
30 | extends AbstractProviderRegistry<MastershipProvider, MastershipProviderService> | 35 | extends AbstractProviderRegistry<MastershipProvider, MastershipProviderService> |
31 | implements MastershipService, MastershipAdminService { | 36 | implements MastershipService, MastershipAdminService { |
... | @@ -46,7 +51,7 @@ public class MastershipManager | ... | @@ -46,7 +51,7 @@ public class MastershipManager |
46 | protected EventDeliveryService eventDispatcher; | 51 | protected EventDeliveryService eventDispatcher; |
47 | 52 | ||
48 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 53 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
49 | - protected ClusterManager clusterManager; | 54 | + protected ClusterService clusterService; |
50 | 55 | ||
51 | @Activate | 56 | @Activate |
52 | public void activate() { | 57 | public void activate() { |
... | @@ -86,7 +91,7 @@ public class MastershipManager | ... | @@ -86,7 +91,7 @@ public class MastershipManager |
86 | @Override | 91 | @Override |
87 | public MastershipRole requestRoleFor(DeviceId deviceId) { | 92 | public MastershipRole requestRoleFor(DeviceId deviceId) { |
88 | checkNotNull(deviceId, DEVICE_ID_NULL); | 93 | checkNotNull(deviceId, DEVICE_ID_NULL); |
89 | - NodeId id = clusterManager.getLocalNode().id(); | 94 | + NodeId id = clusterService.getLocalNode().id(); |
90 | return store.getRole(id, deviceId); | 95 | return store.getRole(id, deviceId); |
91 | } | 96 | } |
92 | 97 | ... | ... |
-
Please register or login to post a comment