Trivial logging change
Change-Id: I8166b5cb886c16b30ad28886a000525ab2059943 Enabling Raft based device mastership store Change-Id: Ide4dc559aa241ec2f3fa587701f6f32ba6856218
Showing
4 changed files
with
14 additions
and
15 deletions
... | @@ -40,8 +40,8 @@ import com.fasterxml.jackson.databind.node.ArrayNode; | ... | @@ -40,8 +40,8 @@ import com.fasterxml.jackson.databind.node.ArrayNode; |
40 | description = "Finds the leader for particular topic.") | 40 | description = "Finds the leader for particular topic.") |
41 | public class LeaderCommand extends AbstractShellCommand { | 41 | public class LeaderCommand extends AbstractShellCommand { |
42 | 42 | ||
43 | - private static final String FMT = "%-20s | %-15s | %-6s | %-10s |"; | 43 | + private static final String FMT = "%-30s | %-15s | %-6s | %-10s |"; |
44 | - private static final String FMT_C = "%-20s | %-15s | %-19s |"; | 44 | + private static final String FMT_C = "%-30s | %-15s | %-19s |"; |
45 | private boolean allTopics; | 45 | private boolean allTopics; |
46 | private Pattern pattern; | 46 | private Pattern pattern; |
47 | 47 | ||
... | @@ -77,9 +77,9 @@ public class LeaderCommand extends AbstractShellCommand { | ... | @@ -77,9 +77,9 @@ public class LeaderCommand extends AbstractShellCommand { |
77 | * @param leaderBoard map of leaders | 77 | * @param leaderBoard map of leaders |
78 | */ | 78 | */ |
79 | private void displayLeaders(Map<String, Leadership> leaderBoard) { | 79 | private void displayLeaders(Map<String, Leadership> leaderBoard) { |
80 | - print("--------------------------------------------------------------"); | 80 | + print("------------------------------------------------------------------------"); |
81 | print(FMT, "Topic", "Leader", "Epoch", "Elected"); | 81 | print(FMT, "Topic", "Leader", "Epoch", "Elected"); |
82 | - print("--------------------------------------------------------------"); | 82 | + print("------------------------------------------------------------------------"); |
83 | 83 | ||
84 | leaderBoard.values() | 84 | leaderBoard.values() |
85 | .stream() | 85 | .stream() |
... | @@ -90,14 +90,14 @@ public class LeaderCommand extends AbstractShellCommand { | ... | @@ -90,14 +90,14 @@ public class LeaderCommand extends AbstractShellCommand { |
90 | l.leader(), | 90 | l.leader(), |
91 | l.epoch(), | 91 | l.epoch(), |
92 | Tools.timeAgo(l.electedTime()))); | 92 | Tools.timeAgo(l.electedTime()))); |
93 | - print("--------------------------------------------------------------"); | 93 | + print("------------------------------------------------------------------------"); |
94 | } | 94 | } |
95 | 95 | ||
96 | private void displayCandidates(Map<String, Leadership> leaderBoard, | 96 | private void displayCandidates(Map<String, Leadership> leaderBoard, |
97 | Map<String, List<NodeId>> candidates) { | 97 | Map<String, List<NodeId>> candidates) { |
98 | - print("--------------------------------------------------------------"); | 98 | + print("------------------------------------------------------------------------"); |
99 | print(FMT_C, "Topic", "Leader", "Candidates"); | 99 | print(FMT_C, "Topic", "Leader", "Candidates"); |
100 | - print("--------------------------------------------------------------"); | 100 | + print("------------------------------------------------------------------------"); |
101 | candidates | 101 | candidates |
102 | .entrySet() | 102 | .entrySet() |
103 | .stream() | 103 | .stream() |
... | @@ -116,7 +116,7 @@ public class LeaderCommand extends AbstractShellCommand { | ... | @@ -116,7 +116,7 @@ public class LeaderCommand extends AbstractShellCommand { |
116 | list.subList(1, list.size()).forEach(n -> print(FMT_C, " ", " ", n)); | 116 | list.subList(1, list.size()).forEach(n -> print(FMT_C, " ", " ", n)); |
117 | print(FMT_C, " ", " ", " "); | 117 | print(FMT_C, " ", " ", " "); |
118 | }); | 118 | }); |
119 | - print("--------------------------------------------------------------"); | 119 | + print("------------------------------------------------------------------------"); |
120 | } | 120 | } |
121 | 121 | ||
122 | /** | 122 | /** | ... | ... |
... | @@ -36,12 +36,12 @@ public class LogicalClockManager implements LogicalClockService { | ... | @@ -36,12 +36,12 @@ public class LogicalClockManager implements LogicalClockService { |
36 | .withName(SYSTEM_LOGICAL_CLOCK_COUNTER_NAME) | 36 | .withName(SYSTEM_LOGICAL_CLOCK_COUNTER_NAME) |
37 | .withPartitionsDisabled() | 37 | .withPartitionsDisabled() |
38 | .build(); | 38 | .build(); |
39 | - log.info("Started."); | 39 | + log.info("Started"); |
40 | } | 40 | } |
41 | 41 | ||
42 | @Deactivate | 42 | @Deactivate |
43 | public void deactivate() { | 43 | public void deactivate() { |
44 | - log.info("Stopped."); | 44 | + log.info("Stopped"); |
45 | } | 45 | } |
46 | 46 | ||
47 | @Override | 47 | @Override | ... | ... |
... | @@ -69,7 +69,7 @@ import com.google.common.collect.Sets; | ... | @@ -69,7 +69,7 @@ import com.google.common.collect.Sets; |
69 | /** | 69 | /** |
70 | * Implementation of the MastershipStore on top of Leadership Service. | 70 | * Implementation of the MastershipStore on top of Leadership Service. |
71 | */ | 71 | */ |
72 | -@Component(immediate = true, enabled = false) | 72 | +@Component(immediate = true, enabled = true) |
73 | @Service | 73 | @Service |
74 | public class ConsistentDeviceMastershipStore | 74 | public class ConsistentDeviceMastershipStore |
75 | extends AbstractStore<MastershipEvent, MastershipStoreDelegate> | 75 | extends AbstractStore<MastershipEvent, MastershipStoreDelegate> |
... | @@ -95,9 +95,8 @@ public class ConsistentDeviceMastershipStore | ... | @@ -95,9 +95,8 @@ public class ConsistentDeviceMastershipStore |
95 | new MessageSubject("mastership-store-device-role-relinquish"); | 95 | new MessageSubject("mastership-store-device-role-relinquish"); |
96 | 96 | ||
97 | private static final Pattern DEVICE_MASTERSHIP_TOPIC_PATTERN = | 97 | private static final Pattern DEVICE_MASTERSHIP_TOPIC_PATTERN = |
98 | - Pattern.compile("/devices/(.*)/mastership"); | 98 | + Pattern.compile("device:(.*)"); |
99 | 99 | ||
100 | - private static final long PEER_REQUEST_TIMEOUT_MS = 5000; | ||
101 | private ExecutorService messageHandlingExecutor; | 100 | private ExecutorService messageHandlingExecutor; |
102 | private final LeadershipEventListener leadershipEventListener = | 101 | private final LeadershipEventListener leadershipEventListener = |
103 | new InternalDeviceMastershipEventListener(); | 102 | new InternalDeviceMastershipEventListener(); |
... | @@ -345,7 +344,7 @@ public class ConsistentDeviceMastershipStore | ... | @@ -345,7 +344,7 @@ public class ConsistentDeviceMastershipStore |
345 | } | 344 | } |
346 | 345 | ||
347 | private String createDeviceMastershipTopic(DeviceId deviceId) { | 346 | private String createDeviceMastershipTopic(DeviceId deviceId) { |
348 | - return "/devices/" + deviceId.toString() + "/mastership"; | 347 | + return String.format("device:%s", deviceId.toString()); |
349 | } | 348 | } |
350 | 349 | ||
351 | private DeviceId extractDeviceIdFromTopic(String topic) { | 350 | private DeviceId extractDeviceIdFromTopic(String topic) { | ... | ... |
... | @@ -60,7 +60,7 @@ import static org.onosproject.net.MastershipRole.*; | ... | @@ -60,7 +60,7 @@ import static org.onosproject.net.MastershipRole.*; |
60 | * Distributed implementation of the mastership store. The store is | 60 | * Distributed implementation of the mastership store. The store is |
61 | * responsible for the master selection process. | 61 | * responsible for the master selection process. |
62 | */ | 62 | */ |
63 | -@Component(immediate = true) | 63 | +@Component(immediate = true, enabled = false) |
64 | @Service | 64 | @Service |
65 | public class DistributedMastershipStore | 65 | public class DistributedMastershipStore |
66 | extends AbstractHazelcastStore<MastershipEvent, MastershipStoreDelegate> | 66 | extends AbstractHazelcastStore<MastershipEvent, MastershipStoreDelegate> | ... | ... |
-
Please register or login to post a comment