Skip to content

Commit

Permalink
Properly handle a null jgroups channel address.
Browse files Browse the repository at this point in the history
This can happen when jgroups is in the process of shutting down.
  • Loading branch information
tobias committed Mar 17, 2015
1 parent 3dff330 commit 999bb14
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -88,7 +88,10 @@ public Address id() {
}

public boolean isMasterWithoutInterrogatingCluster() {
return id().equals(this.currentMaster);
final Address id = id();

return id != null &&
id.equals(this.currentMaster);
}

@Override
Expand Down Expand Up @@ -124,7 +127,7 @@ public boolean isMaster() {
if (this.currentMaster != null) {
//I don't think we can become master while someone else holds the lock, but...
isMaster = isMasterWithoutInterrogatingCluster();
} else {
} else if (id() != null) { // id() will be null if jgroups is shut/shutting down
Map<String, Object> msg = new HashMap();
msg.put("dispatch", this.name);
msg.put("payload", id());
Expand Down

0 comments on commit 999bb14

Please sign in to comment.