NO-JIRA Fix Possible NPE in connectToNodeInReplicatedCluster
Variable possibleLive may be null, as signified by trace log above, also dedupe code.
This commit is contained in:
parent
3aebe74d07
commit
55732d401f
|
@ -213,23 +213,14 @@ public final class SharedNothingBackupActivation extends Activation {
|
||||||
activeMQServer.getNodeManager().setNodeID(nodeID);
|
activeMQServer.getNodeManager().setNodeID(nodeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (possibleLive != null) {
|
||||||
if (logger.isTraceEnabled()) {
|
clusterControl = tryConnectToNodeInReplicatedCluster(clusterController, possibleLive.getA());
|
||||||
logger.trace("Calling clusterController.connectToNodeInReplicatedCluster(" + possibleLive != null ? possibleLive.getA() : null + ")");
|
if (clusterControl == null) {
|
||||||
}
|
clusterControl = tryConnectToNodeInReplicatedCluster(clusterController, possibleLive.getB());
|
||||||
clusterControl = clusterController.connectToNodeInReplicatedCluster(possibleLive.getA());
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.debug(e.getMessage(), e);
|
|
||||||
if (possibleLive != null && possibleLive.getB() != null) {
|
|
||||||
try {
|
|
||||||
clusterControl = clusterController.connectToNodeInReplicatedCluster(possibleLive.getB());
|
|
||||||
} catch (Exception e1) {
|
|
||||||
clusterControl = null;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clusterControl = null;
|
clusterControl = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (clusterControl == null) {
|
if (clusterControl == null) {
|
||||||
|
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
|
@ -367,6 +358,20 @@ public final class SharedNothingBackupActivation extends Activation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ClusterControl tryConnectToNodeInReplicatedCluster(ClusterController clusterController, TransportConfiguration tc) {
|
||||||
|
try {
|
||||||
|
if (logger.isTraceEnabled()) {
|
||||||
|
logger.trace("Calling clusterController.connectToNodeInReplicatedCluster(" + tc + ")");
|
||||||
|
}
|
||||||
|
if (tc != null) {
|
||||||
|
return clusterController.connectToNodeInReplicatedCluster(tc);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.debug(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close(final boolean permanently, boolean restarting) throws Exception {
|
public void close(final boolean permanently, boolean restarting) throws Exception {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
Loading…
Reference in New Issue