Showing
7 changed files
with
22 additions
and
26 deletions
| ... | @@ -20,7 +20,7 @@ import org.onlab.onos.cluster.DefaultControllerNode; | ... | @@ -20,7 +20,7 @@ import org.onlab.onos.cluster.DefaultControllerNode; |
| 20 | import org.onlab.onos.cluster.NodeId; | 20 | import org.onlab.onos.cluster.NodeId; |
| 21 | import org.onlab.onos.store.AbstractStore; | 21 | import org.onlab.onos.store.AbstractStore; |
| 22 | import org.onlab.onos.store.cluster.messaging.ClusterCommunicationAdminService; | 22 | import org.onlab.onos.store.cluster.messaging.ClusterCommunicationAdminService; |
| 23 | -import org.onlab.onos.store.cluster.messaging.impl.OnosClusterCommunicationManager; | 23 | +import org.onlab.onos.store.cluster.messaging.impl.ClusterCommunicationManager; |
| 24 | import org.onlab.packet.IpPrefix; | 24 | import org.onlab.packet.IpPrefix; |
| 25 | import org.slf4j.Logger; | 25 | import org.slf4j.Logger; |
| 26 | import org.slf4j.LoggerFactory; | 26 | import org.slf4j.LoggerFactory; |
| ... | @@ -50,7 +50,7 @@ public class DistributedClusterStore | ... | @@ -50,7 +50,7 @@ public class DistributedClusterStore |
| 50 | private final Map<NodeId, State> states = new ConcurrentHashMap<>(); | 50 | private final Map<NodeId, State> states = new ConcurrentHashMap<>(); |
| 51 | private final Cache<NodeId, ControllerNode> livenessCache = CacheBuilder.newBuilder() | 51 | private final Cache<NodeId, ControllerNode> livenessCache = CacheBuilder.newBuilder() |
| 52 | .maximumSize(1000) | 52 | .maximumSize(1000) |
| 53 | - .expireAfterWrite(OnosClusterCommunicationManager.HEART_BEAT_INTERVAL_MILLIS * 3, TimeUnit.MILLISECONDS) | 53 | + .expireAfterWrite(ClusterCommunicationManager.HEART_BEAT_INTERVAL_MILLIS * 3, TimeUnit.MILLISECONDS) |
| 54 | .removalListener(new LivenessCacheRemovalListener()).build(); | 54 | .removalListener(new LivenessCacheRemovalListener()).build(); |
| 55 | 55 | ||
| 56 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 56 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ... | ... |
| 1 | package org.onlab.onos.store.cluster.messaging; | 1 | package org.onlab.onos.store.cluster.messaging; |
| 2 | 2 | ||
| 3 | +/** | ||
| 4 | + * Interface for handling cluster messages. | ||
| 5 | + */ | ||
| 3 | public interface ClusterMessageHandler { | 6 | public interface ClusterMessageHandler { |
| 7 | + | ||
| 8 | + /** | ||
| 9 | + * Handles/Processes the cluster message. | ||
| 10 | + * @param message cluster message. | ||
| 11 | + */ | ||
| 4 | public void handle(ClusterMessage message); | 12 | public void handle(ClusterMessage message); |
| 5 | } | 13 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -2,6 +2,8 @@ package org.onlab.onos.store.cluster.messaging; | ... | @@ -2,6 +2,8 @@ package org.onlab.onos.store.cluster.messaging; |
| 2 | 2 | ||
| 3 | /** | 3 | /** |
| 4 | * Representation of a message subject. | 4 | * Representation of a message subject. |
| 5 | + * Cluster messages have associated subjects that dictate how they get handled | ||
| 6 | + * on the receiving side. | ||
| 5 | */ | 7 | */ |
| 6 | public class MessageSubject { | 8 | public class MessageSubject { |
| 7 | 9 | ... | ... |
core/store/dist/src/main/java/org/onlab/onos/store/cluster/messaging/MessageSubscriber.java
deleted
100644 → 0
| 1 | -package org.onlab.onos.store.cluster.messaging; | ||
| 2 | - | ||
| 3 | -import org.onlab.onos.cluster.NodeId; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * Represents a message consumer. | ||
| 7 | - */ | ||
| 8 | -public interface MessageSubscriber { | ||
| 9 | - | ||
| 10 | - /** | ||
| 11 | - * Receives the specified cluster message. | ||
| 12 | - * | ||
| 13 | - * @param message message to be received | ||
| 14 | - * @param fromNodeId node from which the message was received | ||
| 15 | - */ | ||
| 16 | - void receive(Object messagePayload, NodeId fromNodeId); | ||
| 17 | - | ||
| 18 | -} |
| ... | @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; | ... | @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; |
| 32 | 32 | ||
| 33 | @Component(immediate = true) | 33 | @Component(immediate = true) |
| 34 | @Service | 34 | @Service |
| 35 | -public class OnosClusterCommunicationManager | 35 | +public class ClusterCommunicationManager |
| 36 | implements ClusterCommunicationService, ClusterCommunicationAdminService { | 36 | implements ClusterCommunicationService, ClusterCommunicationAdminService { |
| 37 | 37 | ||
| 38 | private final Logger log = LoggerFactory.getLogger(getClass()); | 38 | private final Logger log = LoggerFactory.getLogger(getClass()); | ... | ... |
core/store/dist/src/test/java/org/onlab/onos/store/cluster/impl/ClusterCommunicationManagerTest.java
| ... | @@ -6,7 +6,7 @@ import org.junit.Ignore; | ... | @@ -6,7 +6,7 @@ import org.junit.Ignore; |
| 6 | import org.junit.Test; | 6 | import org.junit.Test; |
| 7 | import org.onlab.onos.cluster.DefaultControllerNode; | 7 | import org.onlab.onos.cluster.DefaultControllerNode; |
| 8 | import org.onlab.onos.cluster.NodeId; | 8 | import org.onlab.onos.cluster.NodeId; |
| 9 | -import org.onlab.onos.store.cluster.messaging.impl.OnosClusterCommunicationManager; | 9 | +import org.onlab.onos.store.cluster.messaging.impl.ClusterCommunicationManager; |
| 10 | import org.onlab.netty.NettyMessagingService; | 10 | import org.onlab.netty.NettyMessagingService; |
| 11 | import org.onlab.packet.IpPrefix; | 11 | import org.onlab.packet.IpPrefix; |
| 12 | 12 | ||
| ... | @@ -29,8 +29,8 @@ public class ClusterCommunicationManagerTest { | ... | @@ -29,8 +29,8 @@ public class ClusterCommunicationManagerTest { |
| 29 | 29 | ||
| 30 | private static final IpPrefix IP = IpPrefix.valueOf("127.0.0.1"); | 30 | private static final IpPrefix IP = IpPrefix.valueOf("127.0.0.1"); |
| 31 | 31 | ||
| 32 | - private OnosClusterCommunicationManager ccm1; | 32 | + private ClusterCommunicationManager ccm1; |
| 33 | - private OnosClusterCommunicationManager ccm2; | 33 | + private ClusterCommunicationManager ccm2; |
| 34 | 34 | ||
| 35 | private TestDelegate cnd1 = new TestDelegate(); | 35 | private TestDelegate cnd1 = new TestDelegate(); |
| 36 | private TestDelegate cnd2 = new TestDelegate(); | 36 | private TestDelegate cnd2 = new TestDelegate(); |
| ... | @@ -46,11 +46,11 @@ public class ClusterCommunicationManagerTest { | ... | @@ -46,11 +46,11 @@ public class ClusterCommunicationManagerTest { |
| 46 | NettyMessagingService messagingService = new NettyMessagingService(); | 46 | NettyMessagingService messagingService = new NettyMessagingService(); |
| 47 | messagingService.activate(); | 47 | messagingService.activate(); |
| 48 | 48 | ||
| 49 | - ccm1 = new OnosClusterCommunicationManager(); | 49 | + ccm1 = new ClusterCommunicationManager(); |
| 50 | // ccm1.serializationService = messageSerializer; | 50 | // ccm1.serializationService = messageSerializer; |
| 51 | ccm1.activate(); | 51 | ccm1.activate(); |
| 52 | 52 | ||
| 53 | - ccm2 = new OnosClusterCommunicationManager(); | 53 | + ccm2 = new ClusterCommunicationManager(); |
| 54 | // ccm2.serializationService = messageSerializer; | 54 | // ccm2.serializationService = messageSerializer; |
| 55 | ccm2.activate(); | 55 | ccm2.activate(); |
| 56 | 56 | ... | ... |
-
Please register or login to post a comment