Search in sources :

Example 1 with RegistrationInfo

use of io.vertx.core.spi.cluster.RegistrationInfo in project vert.x by eclipse.

the class Selectors method computeAccessible.

private List<String> computeAccessible(List<RegistrationInfo> registrations) {
    if (registrations == null || registrations.isEmpty()) {
        return Collections.emptyList();
    }
    ArrayList<String> list = new ArrayList<>(registrations.size());
    for (RegistrationInfo registration : registrations) {
        if (isAccessible(registration)) {
            String nodeId = registration.nodeId();
            list.add(nodeId);
        }
    }
    list.trimToSize();
    return list;
}
Also used : RegistrationInfo(io.vertx.core.spi.cluster.RegistrationInfo) ArrayList(java.util.ArrayList)

Example 2 with RegistrationInfo

use of io.vertx.core.spi.cluster.RegistrationInfo in project vert.x by eclipse.

the class ClusteredEventBus method onLocalUnregistration.

@Override
protected <T> void onLocalUnregistration(HandlerHolder<T> handlerHolder, Promise<Void> completionHandler) {
    if (!handlerHolder.isReplyHandler()) {
        RegistrationInfo registrationInfo = new RegistrationInfo(nodeId, handlerHolder.getSeq(), handlerHolder.isLocalOnly());
        Promise<Void> promise = Promise.promise();
        clusterManager.removeRegistration(handlerHolder.getHandler().address, registrationInfo, promise);
        promise.future().onComplete(completionHandler);
    } else {
        completionHandler.complete();
    }
}
Also used : RegistrationInfo(io.vertx.core.spi.cluster.RegistrationInfo)

Example 3 with RegistrationInfo

use of io.vertx.core.spi.cluster.RegistrationInfo in project vert.x by eclipse.

the class ClusteredEventBus method onLocalRegistration.

@Override
protected <T> void onLocalRegistration(HandlerHolder<T> handlerHolder, Promise<Void> promise) {
    if (!handlerHolder.isReplyHandler()) {
        RegistrationInfo registrationInfo = new RegistrationInfo(nodeId, handlerHolder.getSeq(), handlerHolder.isLocalOnly());
        clusterManager.addRegistration(handlerHolder.getHandler().address, registrationInfo, Objects.requireNonNull(promise));
    } else if (promise != null) {
        promise.complete();
    }
}
Also used : RegistrationInfo(io.vertx.core.spi.cluster.RegistrationInfo)

Aggregations

RegistrationInfo (io.vertx.core.spi.cluster.RegistrationInfo)3 ArrayList (java.util.ArrayList)1