in src/main/java/com/ericsson/gerrit/plugins/highavailability/peers/jgroups/JGroupsPeerInfoProvider.java [117:143]
public void connect() {
try {
channel = getChannel();
Optional<InetAddress> address = finder.findAddress();
if (address.isPresent()) {
log.atFine().log("Protocol stack: %s", channel.getProtocolStack());
channel.getProtocolStack().getTransport().setBindAddress(address.get());
log.atFine().log("Channel bound to %s", address.get());
} else {
log.atWarning().log("Channel not bound: address not present");
}
channel.setReceiver(this);
channel.setDiscardOwnMessages(true);
channel.connect(jgroupsConfig.clusterName());
log.atInfo().log(
"Channel %s successfully joined jgroups cluster %s",
channel.getName(), jgroupsConfig.clusterName());
} catch (Exception e) {
if (channel != null) {
log.atSevere().withCause(e).log(
"joining cluster %s (channel %s) failed",
jgroupsConfig.clusterName(), channel.getName());
} else {
log.atSevere().withCause(e).log("joining cluster %s failed", jgroupsConfig.clusterName());
}
}
}