Search in sources :

Example 1 with NoRemoteHandler

use of io.atomix.messaging.MessagingException.NoRemoteHandler in project atomix by atomix.

the class TestMessagingService method getHandler.

/**
 * Returns the given handler for the given endpoint.
 */
private BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> getHandler(Endpoint endpoint, String type) {
    TestMessagingService service = getService(endpoint);
    if (service == null) {
        return (e, p) -> Futures.exceptionalFuture(new NoRemoteHandler());
    }
    BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> handler = service.handlers.get(checkNotNull(type));
    if (handler == null) {
        return (e, p) -> Futures.exceptionalFuture(new NoRemoteHandler());
    }
    return handler;
}
Also used : ManagedMessagingService(io.atomix.messaging.ManagedMessagingService) ComposableFuture(io.atomix.utils.concurrent.ComposableFuture) Executor(java.util.concurrent.Executor) BiFunction(java.util.function.BiFunction) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Endpoint(io.atomix.messaging.Endpoint) CompletableFuture(java.util.concurrent.CompletableFuture) NoRemoteHandler(io.atomix.messaging.MessagingException.NoRemoteHandler) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) MessagingService(io.atomix.messaging.MessagingService) Map(java.util.Map) BiConsumer(java.util.function.BiConsumer) Futures(io.atomix.utils.concurrent.Futures) CompletableFuture(java.util.concurrent.CompletableFuture) Endpoint(io.atomix.messaging.Endpoint) NoRemoteHandler(io.atomix.messaging.MessagingException.NoRemoteHandler)

Example 2 with NoRemoteHandler

use of io.atomix.messaging.MessagingException.NoRemoteHandler in project atomix by atomix.

the class TestMessagingService method getHandler.

/**
 * Returns the given handler for the given endpoint.
 */
private BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> getHandler(Endpoint endpoint, String type) {
    TestMessagingService service = getService(endpoint);
    if (service == null) {
        return (e, p) -> Futures.exceptionalFuture(new NoRemoteHandler());
    }
    BiFunction<Endpoint, byte[], CompletableFuture<byte[]>> handler = service.handlers.get(checkNotNull(type));
    if (handler == null) {
        return (e, p) -> Futures.exceptionalFuture(new NoRemoteHandler());
    }
    return handler;
}
Also used : ManagedMessagingService(io.atomix.messaging.ManagedMessagingService) ComposableFuture(io.atomix.utils.concurrent.ComposableFuture) Executor(java.util.concurrent.Executor) BiFunction(java.util.function.BiFunction) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Endpoint(io.atomix.messaging.Endpoint) CompletableFuture(java.util.concurrent.CompletableFuture) NoRemoteHandler(io.atomix.messaging.MessagingException.NoRemoteHandler) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) MessagingService(io.atomix.messaging.MessagingService) Map(java.util.Map) BiConsumer(java.util.function.BiConsumer) Futures(io.atomix.utils.concurrent.Futures) CompletableFuture(java.util.concurrent.CompletableFuture) Endpoint(io.atomix.messaging.Endpoint) NoRemoteHandler(io.atomix.messaging.MessagingException.NoRemoteHandler)

Aggregations

Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)2 Endpoint (io.atomix.messaging.Endpoint)2 ManagedMessagingService (io.atomix.messaging.ManagedMessagingService)2 NoRemoteHandler (io.atomix.messaging.MessagingException.NoRemoteHandler)2 MessagingService (io.atomix.messaging.MessagingService)2 ComposableFuture (io.atomix.utils.concurrent.ComposableFuture)2 Futures (io.atomix.utils.concurrent.Futures)2 Map (java.util.Map)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Executor (java.util.concurrent.Executor)2 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 BiConsumer (java.util.function.BiConsumer)2 BiFunction (java.util.function.BiFunction)2