NO-JIRA Avoid NPE during backup shutdown

When a backup starts without a live, it's nodeID is null.
Added a null check in ClusterConnection's stop() to avoid
NPE if it's shut down.
This commit is contained in:
Howard Gao 2019-03-29 16:02:53 +08:00 committed by Clebert Suconic
parent 54cfeed918
commit 375f383e90
1 changed files with 3 additions and 1 deletions

View File

@ -439,7 +439,9 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn
if (managementService != null) {
TypedProperties props = new TypedProperties();
props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeManager.getNodeId().toString(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED, props);
//nodeID can be null if there's only a backup
SimpleString nodeId = nodeManager.getNodeId();
Notification notification = new Notification(nodeId == null ? null : nodeId.toString(), CoreNotificationType.CLUSTER_CONNECTION_STOPPED, props);
managementService.sendNotification(notification);
}
executor.execute(new Runnable() {