Yuta HIGUCHI

log message fixes in DeviceManager

Change-Id: Ia07cfa936d171a31c619e1ee13d6df5f80d7e629
...@@ -259,9 +259,13 @@ public class DeviceManager ...@@ -259,9 +259,13 @@ public class DeviceManager
259 final NodeId myNodeId = clusterService.getLocalNode().id(); 259 final NodeId myNodeId = clusterService.getLocalNode().id();
260 if (!myNodeId.equals(term.master())) { 260 if (!myNodeId.equals(term.master())) {
261 // lost mastership after requestRole told this instance was MASTER. 261 // lost mastership after requestRole told this instance was MASTER.
262 - log.info("lost mastership before getting term info."); 262 + log.info("Role of this node is STANDBY for {}", deviceId);
263 + // TODO: Do we need to explicitly tell the Provider that
264 + // this instance is no longer the MASTER?
265 + //applyRole(deviceId, MastershipRole.STANDBY);
263 return; 266 return;
264 } 267 }
268 + log.info("Role of this node is MASTER for {}", deviceId);
265 269
266 // tell clock provider if this instance is the master 270 // tell clock provider if this instance is the master
267 deviceClockProviderService.setMastershipTerm(deviceId, term); 271 deviceClockProviderService.setMastershipTerm(deviceId, term);
...@@ -295,6 +299,7 @@ public class DeviceManager ...@@ -295,6 +299,7 @@ public class DeviceManager
295 checkNotNull(deviceId, DEVICE_ID_NULL); 299 checkNotNull(deviceId, DEVICE_ID_NULL);
296 checkValidity(); 300 checkValidity();
297 301
302 + log.info("Device {} disconnected from this node", deviceId);
298 303
299 DeviceEvent event = null; 304 DeviceEvent event = null;
300 try { 305 try {
...@@ -318,18 +323,18 @@ public class DeviceManager ...@@ -318,18 +323,18 @@ public class DeviceManager
318 final NodeId myNodeId = clusterService.getLocalNode().id(); 323 final NodeId myNodeId = clusterService.getLocalNode().id();
319 // TODO: Move this type of check inside device clock manager, etc. 324 // TODO: Move this type of check inside device clock manager, etc.
320 if (myNodeId.equals(term.master())) { 325 if (myNodeId.equals(term.master())) {
321 - log.info("Marking {} offline", deviceId); 326 + log.info("Retry marking {} offline", deviceId);
322 deviceClockProviderService.setMastershipTerm(deviceId, term); 327 deviceClockProviderService.setMastershipTerm(deviceId, term);
323 event = store.markOffline(deviceId); 328 event = store.markOffline(deviceId);
324 } else { 329 } else {
325 - log.error("Failed again marking {} offline. {}", deviceId, role); 330 + log.info("Failed again marking {} offline. {}", deviceId, role);
326 } 331 }
327 } finally { 332 } finally {
328 //relinquish master role and ability to be backup. 333 //relinquish master role and ability to be backup.
329 mastershipService.relinquishMastership(deviceId); 334 mastershipService.relinquishMastership(deviceId);
330 335
331 if (event != null) { 336 if (event != null) {
332 - log.info("Device {} disconnected", deviceId); 337 + log.info("Device {} disconnected from cluster", deviceId);
333 post(event); 338 post(event);
334 } 339 }
335 } 340 }
......