int serverPort = publicPort == -1 ? server.actualPort() : publicPort;
String serverHost = publicHost == null ? options.getClusterHost() : publicHost;
ServerID serverID = new ServerID(serverPort, serverHost);
// Provide a memory barrier as we are setting from a different thread
synchronized (VertxImpl.this) {
eventBus = new EventBusImpl(this, options.getClusterPingInterval(), options.getClusterPingReplyInterval(),
clusterManager, subs, serverID, ebServer);
}
if (resultHandler != null) {
resultHandler.handle(Future.completedFuture(this));
}
} else {
if (resultHandler != null) {
resultHandler.handle(Future.completedFuture(ar.cause()));
} else {
log.error(ar.cause());
}
}
});
} else {
if (resultHandler != null) {
resultHandler.handle(Future.completedFuture(ar.cause()));
} else {
log.error(ar.cause());
}
}
});
});
this.sharedData = new SharedDataImpl(this, clusterManager);
} else {
this.clusterManager = null;
this.sharedData = new SharedDataImpl(this, null);
this.eventBus = new EventBusImpl(this);
if (resultHandler != null) {
resultHandler.handle(Future.completedFuture(this));
}
}
}