* method in order to provide special Vert.x instance.
* @return
*/
protected Vertx createVertx(VertxEndpointConfiguration endpointConfiguration) {
final Vertx[] vertx = new Vertx[1];
final Future loading = new DefaultFutureResult();
Handler<AsyncResult<Vertx>> asyncLoadingHandler = new Handler<AsyncResult<Vertx>>() {
@Override
public void handle(AsyncResult<Vertx> event) {
vertx[0] = event.result();
loading.setResult(Boolean.TRUE);
log.info("Vert.x instance successfully started");
}
};
if (endpointConfiguration.getPort() > 0) {
log.info(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), endpointConfiguration.getPort()));
VertxFactory.newVertx(endpointConfiguration.getPort(), endpointConfiguration.getHost(), asyncLoadingHandler);
} else {
log.info(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), 0L));
VertxFactory.newVertx(0, endpointConfiguration.getHost(), asyncLoadingHandler);
}
// Wait for full loading
while (!loading.complete()) {
try {
log.debug("Waiting for Vert.x instance to startup");
Thread.sleep(250L);
} catch (InterruptedException e) {
log.warn("Interrupted while waiting for Vert.x instance startup", e);