Search in sources :

Example 6 with Executor

use of io.servicetalk.concurrent.api.Executor in project servicetalk by apple.

the class AbstractSingleOffloadingTest method testOffloading.

protected int testOffloading(BiFunction<Single<String>, Executor, Single<String>> offloadingFunction, TerminalOperation terminal) throws InterruptedException {
    Runnable appCode = () -> {
        try {
            // Insert a custom value into AsyncContext map
            AsyncContext.put(ASYNC_CONTEXT_CUSTOM_KEY, ASYNC_CONTEXT_VALUE);
            capture(CaptureSlot.APP);
            // Add thread recording test points
            final Single<String> original = testSingle.liftSync((SingleOperator<String, String>) subscriber -> {
                capture(CaptureSlot.OFFLOADED_SUBSCRIBE);
                return subscriber;
            }).beforeOnSubscribe(cancellable -> capture(CaptureSlot.ORIGINAL_ON_SUBSCRIBE)).beforeFinally(new TerminalSignalConsumer() {

                @Override
                public void onComplete() {
                    capture(CaptureSlot.ORIGINAL_ON_COMPLETE);
                }

                @Override
                public void onError(final Throwable throwable) {
                    capture(CaptureSlot.ORIGINAL_ON_ERROR);
                }

                @Override
                public void cancel() {
                    capture(CaptureSlot.OFFLOADED_CANCEL);
                }
            });
            // Perform offloading and add more thread recording test points
            Single<String> offloaded = offloadingFunction.apply(original, testExecutor.executor()).liftSync((SingleOperator<String, String>) subscriber -> {
                capture(CaptureSlot.ORIGINAL_SUBSCRIBE);
                return subscriber;
            }).beforeOnSubscribe(cancellable -> capture(CaptureSlot.OFFLOADED_ON_SUBSCRIBE)).beforeFinally(new TerminalSignalConsumer() {

                @Override
                public void onComplete() {
                    capture(CaptureSlot.OFFLOADED_ON_COMPLETE);
                }

                @Override
                public void onError(final Throwable throwable) {
                    capture(CaptureSlot.OFFLOADED_ON_ERROR);
                }

                @Override
                public void cancel() {
                    capture(CaptureSlot.ORIGINAL_CANCEL);
                }
            });
            // subscribe and generate terminal
            toSource(offloaded).subscribe(testSubscriber);
            assertThat("Unexpected tasks " + testExecutor.executor().queuedTasksPending(), testExecutor.executor().queuedTasksPending(), lessThan(2));
            if (1 == testExecutor.executor().queuedTasksPending()) {
                // execute offloaded subscribe
                testExecutor.executor().executeNextTask();
            }
            Cancellable cancellable = testSubscriber.awaitSubscription();
            assertThat("No Cancellable", cancellable, notNullValue());
            testSingle.awaitSubscribed();
            assertThat("Source is not subscribed", testSingle.isSubscribed());
            assertThat("Thread was interrupted", !Thread.currentThread().isInterrupted());
            switch(terminal) {
                case CANCEL:
                    cancellable.cancel();
                    break;
                case COMPLETE:
                    testSingle.onSuccess(ITEM_VALUE);
                    break;
                case ERROR:
                    testSingle.onError(DELIBERATE_EXCEPTION);
                    break;
                default:
                    throw new AssertionError("unexpected terminal mode");
            }
            assertThat("Unexpected tasks " + testExecutor.executor().queuedTasksPending(), testExecutor.executor().queuedTasksPending(), lessThan(2));
            if (1 == testExecutor.executor().queuedTasksPending()) {
                // execute offloaded terminal
                testExecutor.executor().executeNextTask();
            }
        } catch (Throwable all) {
            AbstractOffloadingTest.LOGGER.warn("Unexpected throwable", all);
            testSubscriber.onError(all);
        }
    };
    APP_EXECUTOR_EXT.executor().execute(appCode);
    // Ensure we reached the correct terminal condition
    switch(terminal) {
        case CANCEL:
            testCancellable.awaitCancelled();
            break;
        case ERROR:
            Throwable thrown = testSubscriber.awaitOnError();
            assertThat("unexpected exception " + thrown, thrown, sameInstance(DELIBERATE_EXCEPTION));
            break;
        case COMPLETE:
            String result = testSubscriber.awaitOnSuccess();
            assertThat("Unexpected result", result, sameInstance(ITEM_VALUE));
            break;
        default:
            throw new AssertionError("unexpected terminal mode");
    }
    // Ensure that Async Context Map was correctly set during signals
    ContextMap appMap = capturedContexts.captured(CaptureSlot.APP);
    assertThat(appMap, notNullValue());
    ContextMap subscribeMap = capturedContexts.captured(CaptureSlot.ORIGINAL_SUBSCRIBE);
    assertThat(subscribeMap, notNullValue());
    assertThat("Map was shared not copied", subscribeMap, not(sameInstance(appMap)));
    assertThat("Missing custom async context entry ", subscribeMap.get(ASYNC_CONTEXT_CUSTOM_KEY), sameInstance(ASYNC_CONTEXT_VALUE));
    EnumSet<CaptureSlot> checkSlots = EnumSet.complementOf(EnumSet.of(CaptureSlot.APP, CaptureSlot.ORIGINAL_SUBSCRIBE));
    checkSlots.stream().filter(slot -> null != capturedContexts.captured(slot)).forEach(slot -> {
        ContextMap map = capturedContexts.captured(slot);
        assertThat("Context map was not captured", map, is(notNullValue()));
        assertThat("Custom key missing from context map", map.containsKey(ASYNC_CONTEXT_CUSTOM_KEY));
        assertThat("Unexpected context map @ slot " + slot + " : " + map, map, sameInstance(subscribeMap));
    });
    // Ensure that all offloading completed.
    assertThat("Offloading pending", testExecutor.executor().queuedTasksPending(), is(0));
    return testExecutor.executor().queuedTasksExecuted();
}
Also used : TerminalSignalConsumer(io.servicetalk.concurrent.api.TerminalSignalConsumer) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestSingle(io.servicetalk.concurrent.api.TestSingle) Single(io.servicetalk.concurrent.api.Single) BiFunction(java.util.function.BiFunction) CoreMatchers.not(org.hamcrest.CoreMatchers.not) TerminalSignalConsumer(io.servicetalk.concurrent.api.TerminalSignalConsumer) Cancellable(io.servicetalk.concurrent.Cancellable) TestCancellable(io.servicetalk.concurrent.api.TestCancellable) SourceAdapters.toSource(io.servicetalk.concurrent.api.SourceAdapters.toSource) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) AbstractOffloadingTest(io.servicetalk.concurrent.api.internal.AbstractOffloadingTest) SingleOperator(io.servicetalk.concurrent.api.SingleOperator) ContextMap(io.servicetalk.context.api.ContextMap) AsyncContext(io.servicetalk.concurrent.api.AsyncContext) Matchers.lessThan(org.hamcrest.Matchers.lessThan) Executor(io.servicetalk.concurrent.api.Executor) TestSingleSubscriber(io.servicetalk.concurrent.test.internal.TestSingleSubscriber) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) EnumSet(java.util.EnumSet) CoreMatchers.sameInstance(org.hamcrest.CoreMatchers.sameInstance) SingleOperator(io.servicetalk.concurrent.api.SingleOperator) TestSingle(io.servicetalk.concurrent.api.TestSingle) Single(io.servicetalk.concurrent.api.Single) Cancellable(io.servicetalk.concurrent.Cancellable) TestCancellable(io.servicetalk.concurrent.api.TestCancellable) ContextMap(io.servicetalk.context.api.ContextMap)

Example 7 with Executor

use of io.servicetalk.concurrent.api.Executor in project servicetalk by apple.

the class StreamingHttpServiceToOffloadedStreamingHttpService method handle.

@Override
public Single<StreamingHttpResponse> handle(final HttpServiceContext ctx, StreamingHttpRequest request, final StreamingHttpResponseFactory responseFactory) {
    // We compute the difference between the ExecutionStrategy from the current ExecutionContext and
    // this ExecutionStrategy to understand if we need to offload more than we already offloaded:
    final HttpExecutionStrategy additionalOffloads = ctx.executionContext().executionStrategy().missing(strategy);
    Executor useExecutor = null != executor ? executor : ctx.executionContext().executor();
    // The service should see this ExecutionStrategy and Executor inside the ExecutionContext:
    final HttpServiceContext wrappedCtx = new ExecutionContextOverridingServiceContext(ctx, strategy, useExecutor);
    if (!additionalOffloads.isRequestResponseOffloaded()) {
        // No additional offloading needed.
        return delegate.handle(wrappedCtx, request, responseFactory);
    } else {
        if (additionalOffloads.isDataReceiveOffloaded()) {
            request = request.transformMessageBody(p -> p.publishOn(useExecutor, shouldOffload));
        }
        final Single<StreamingHttpResponse> resp;
        if (additionalOffloads.isMetadataReceiveOffloaded() && shouldOffload.getAsBoolean()) {
            final StreamingHttpRequest r = request;
            resp = useExecutor.submit(() -> delegate.handle(wrappedCtx, r, responseFactory).shareContextOnSubscribe()).flatMap(identity());
        } else {
            resp = delegate.handle(wrappedCtx, request, responseFactory);
        }
        return additionalOffloads.isSendOffloaded() ? // contract and hence have to offload both meta and data separately.
        resp.map(r -> r.transformMessageBody(p -> p.subscribeOn(useExecutor, shouldOffload))).subscribeOn(useExecutor, shouldOffload) : resp;
    }
}
Also used : Single(io.servicetalk.concurrent.api.Single) Completable(io.servicetalk.concurrent.api.Completable) Function.identity(java.util.function.Function.identity) Executor(io.servicetalk.concurrent.api.Executor) Nullable(javax.annotation.Nullable) BooleanSupplier(java.util.function.BooleanSupplier) Executor(io.servicetalk.concurrent.api.Executor)

Example 8 with Executor

use of io.servicetalk.concurrent.api.Executor in project servicetalk by apple.

the class AbstractNettyHttpServerTest method startServer.

private void startServer() throws Exception {
    final InetSocketAddress bindAddress = localAddress(0);
    service(new TestServiceStreaming(publisherSupplier));
    // A small SNDBUF is needed to test that the server defers closing the connection until writes are complete.
    // However, if it is too small, tests that expect certain chunks of data will see those chunks broken up
    // differently.
    final HttpServerBuilder serverBuilder = HttpServers.forAddress(bindAddress).executor(serverExecutor).socketOption(StandardSocketOptions.SO_SNDBUF, 100).protocols(protocol).transportObserver(serverTransportObserver).enableWireLogging("servicetalk-tests-wire-logger", TRACE, () -> true);
    configureServerBuilder(serverBuilder);
    if (sslEnabled) {
        serverBuilder.sslConfig(new ServerSslConfigBuilder(DefaultTestCerts::loadServerPem, DefaultTestCerts::loadServerKey).build());
    }
    if (nonOffloadingServiceFilterFactory != null) {
        serverBuilder.appendNonOffloadingServiceFilter(nonOffloadingServiceFilterFactory);
    }
    if (serviceFilterFactory != null) {
        serverBuilder.appendServiceFilter(serviceFilterFactory);
    }
    if (serverLifecycleObserver != NoopHttpLifecycleObserver.INSTANCE) {
        serverBuilder.lifecycleObserver(serverLifecycleObserver);
    }
    serverContext = awaitIndefinitelyNonNull(listen(serverBuilder.ioExecutor(serverIoExecutor).appendConnectionAcceptorFilter(original -> new DelegatingConnectionAcceptor(connectionAcceptor))).beforeOnSuccess(ctx -> LOGGER.debug("Server started on {}.", ctx.listenAddress())).beforeOnError(throwable -> LOGGER.debug("Failed starting server on {}.", bindAddress)));
    final SingleAddressHttpClientBuilder<HostAndPort, InetSocketAddress> clientBuilder = newClientBuilder();
    if (sslEnabled) {
        clientBuilder.sslConfig(new ClientSslConfigBuilder(DefaultTestCerts::loadServerCAPem).peerHost(serverPemHostname()).build());
    }
    if (connectionFactoryFilter != null) {
        clientBuilder.appendConnectionFactoryFilter(connectionFactoryFilter);
    }
    if (connectionFilterFactory != null) {
        clientBuilder.appendConnectionFilter(connectionFilterFactory);
    }
    if (clientTransportObserver != NoopTransportObserver.INSTANCE) {
        clientBuilder.appendConnectionFactoryFilter(new TransportObserverConnectionFactoryFilter<>(clientTransportObserver));
    }
    if (clientLifecycleObserver != NoopHttpLifecycleObserver.INSTANCE) {
        clientBuilder.appendClientFilter(new HttpLifecycleObserverRequesterFilter(clientLifecycleObserver));
    }
    if (clientFilterFactory != null) {
        clientBuilder.appendClientFilter(clientFilterFactory);
    }
    httpClient = clientBuilder.ioExecutor(clientIoExecutor).executor(clientExecutor).executionStrategy(defaultStrategy()).protocols(protocol).enableWireLogging("servicetalk-tests-wire-logger", TRACE, Boolean.TRUE::booleanValue).buildStreaming();
    httpConnection = httpClient.reserveConnection(httpClient.get("/")).toFuture().get();
}
Also used : HttpLifecycleObserver(io.servicetalk.http.api.HttpLifecycleObserver) PlatformDependent.throwException(io.servicetalk.utils.internal.PlatformDependent.throwException) ServerSslConfigBuilder(io.servicetalk.transport.api.ServerSslConfigBuilder) LoggerFactory(org.slf4j.LoggerFactory) StreamingHttpConnectionFilterFactory(io.servicetalk.http.api.StreamingHttpConnectionFilterFactory) HttpResponseMetaData(io.servicetalk.http.api.HttpResponseMetaData) StreamingHttpServiceFilterFactory(io.servicetalk.http.api.StreamingHttpServiceFilterFactory) ConnectionAcceptor(io.servicetalk.transport.api.ConnectionAcceptor) AfterAll(org.junit.jupiter.api.AfterAll) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) HttpExecutionStrategies.defaultStrategy(io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) BeforeAll(org.junit.jupiter.api.BeforeAll) Assumptions.assumeFalse(org.junit.jupiter.api.Assumptions.assumeFalse) Executor(io.servicetalk.concurrent.api.Executor) HttpProtocolConfig(io.servicetalk.http.api.HttpProtocolConfig) BlockingTestUtils.awaitIndefinitelyNonNull(io.servicetalk.concurrent.api.BlockingTestUtils.awaitIndefinitelyNonNull) DefaultTestCerts(io.servicetalk.test.resources.DefaultTestCerts) StandardSocketOptions(java.net.StandardSocketOptions) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) ConnectionFactoryFilter(io.servicetalk.client.api.ConnectionFactoryFilter) AsyncCloseables.newCompositeCloseable(io.servicetalk.concurrent.api.AsyncCloseables.newCompositeCloseable) InetSocketAddress(java.net.InetSocketAddress) DefaultTestCerts.serverPemHostname(io.servicetalk.test.resources.DefaultTestCerts.serverPemHostname) Buffer(io.servicetalk.buffer.api.Buffer) DelegatingConnectionAcceptor(io.servicetalk.transport.api.DelegatingConnectionAcceptor) StreamingHttpService(io.servicetalk.http.api.StreamingHttpService) TransportObserver(io.servicetalk.transport.api.TransportObserver) ClientSslConfigBuilder(io.servicetalk.transport.api.ClientSslConfigBuilder) Matchers.is(org.hamcrest.Matchers.is) Strictness(org.mockito.quality.Strictness) Assertions.fail(org.junit.jupiter.api.Assertions.fail) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) MockitoSettings(org.mockito.junit.jupiter.MockitoSettings) DEFAULT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR) Publisher(io.servicetalk.concurrent.api.Publisher) Mock(org.mockito.Mock) TRACE(io.servicetalk.logging.api.LogLevel.TRACE) FilterableStreamingHttpConnection(io.servicetalk.http.api.FilterableStreamingHttpConnection) Function(java.util.function.Function) Supplier(java.util.function.Supplier) HttpProtocolConfigs.h1Default(io.servicetalk.http.netty.HttpProtocolConfigs.h1Default) HttpSerializers.appSerializerUtf8FixLen(io.servicetalk.http.api.HttpSerializers.appSerializerUtf8FixLen) HttpServerContext(io.servicetalk.http.api.HttpServerContext) Objects.requireNonNull(java.util.Objects.requireNonNull) HttpProtocolVersion(io.servicetalk.http.api.HttpProtocolVersion) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DefaultThreadFactory(io.servicetalk.concurrent.api.DefaultThreadFactory) HttpServerBuilder(io.servicetalk.http.api.HttpServerBuilder) Nullable(javax.annotation.Nullable) ACCEPT_ALL(io.servicetalk.transport.api.ConnectionAcceptor.ACCEPT_ALL) NettyIoExecutors(io.servicetalk.transport.netty.NettyIoExecutors) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) Logger(org.slf4j.Logger) ServerContext(io.servicetalk.transport.api.ServerContext) StreamingHttpConnection(io.servicetalk.http.api.StreamingHttpConnection) Single(io.servicetalk.concurrent.api.Single) SingleAddressHttpClientBuilder(io.servicetalk.http.api.SingleAddressHttpClientBuilder) ExecutionException(java.util.concurrent.ExecutionException) US_ASCII(java.nio.charset.StandardCharsets.US_ASCII) IoExecutor(io.servicetalk.transport.api.IoExecutor) AfterEach(org.junit.jupiter.api.AfterEach) Boolean.parseBoolean(java.lang.Boolean.parseBoolean) TransportObserverConnectionFactoryFilter(io.servicetalk.client.api.TransportObserverConnectionFactoryFilter) Executors.newCachedThreadExecutor(io.servicetalk.concurrent.api.Executors.newCachedThreadExecutor) NORM_PRIORITY(java.lang.Thread.NORM_PRIORITY) Executors(io.servicetalk.concurrent.api.Executors) StreamingHttpClientFilterFactory(io.servicetalk.http.api.StreamingHttpClientFilterFactory) HttpResponseStatus(io.servicetalk.http.api.HttpResponseStatus) NoopTransportObserver(io.servicetalk.transport.netty.internal.NoopTransportObserver) HostAndPort(io.servicetalk.transport.api.HostAndPort) InetSocketAddress(java.net.InetSocketAddress) HttpServerBuilder(io.servicetalk.http.api.HttpServerBuilder) DelegatingConnectionAcceptor(io.servicetalk.transport.api.DelegatingConnectionAcceptor) DefaultTestCerts(io.servicetalk.test.resources.DefaultTestCerts) ClientSslConfigBuilder(io.servicetalk.transport.api.ClientSslConfigBuilder) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) HostAndPort(io.servicetalk.transport.api.HostAndPort) ServerSslConfigBuilder(io.servicetalk.transport.api.ServerSslConfigBuilder)

Example 9 with Executor

use of io.servicetalk.concurrent.api.Executor in project servicetalk by apple.

the class LingeringRoundRobinLoadBalancerTest method closureOfLastConnectionDoesntRaceWithNewAvailableEvent.

// Concurrency test, worth running ~10K times to spot concurrency issues.
@Test
void closureOfLastConnectionDoesntRaceWithNewAvailableEvent() throws Exception {
    Executor executor = Executors.newFixedSizeExecutor(1);
    try {
        sendServiceDiscoveryEvents(upEvent("address-1"));
        TestLoadBalancedConnection conn = lb.selectConnection(alwaysNewConnectionFilter(), null).toFuture().get();
        sendServiceDiscoveryEvents(downEvent("address-1"));
        assertConnectionCount(lb.usedAddresses(), connectionsCount("address-1", 1));
        Future<Object> f = executor.submit(() -> {
            sendServiceDiscoveryEvents(upEvent("address-1"));
            return null;
        }).toFuture();
        conn.closeAsync().toFuture().get();
        f.get();
        assertConnectionCount(lb.usedAddresses(), connectionsCount("address-1", 0));
    } finally {
        executor.closeAsync().toFuture().get();
    }
}
Also used : Executor(io.servicetalk.concurrent.api.Executor) Test(org.junit.jupiter.api.Test)

Example 10 with Executor

use of io.servicetalk.concurrent.api.Executor in project servicetalk by apple.

the class RoundRobinLoadBalancerTest method hostUnhealthyDoesntRaceToRunHealthCheck.

// Concurrency test, run multiple times (at least 1000).
@Test
void hostUnhealthyDoesntRaceToRunHealthCheck() throws Exception {
    serviceDiscoveryPublisher.onComplete();
    final Single<TestLoadBalancedConnection> properConnection = newRealizedConnectionSingle("address-1");
    final int timeAdvancementsTillHealthy = 3;
    final UnhealthyHostConnectionFactory unhealthyHostConnectionFactory = new UnhealthyHostConnectionFactory("address-1", timeAdvancementsTillHealthy, properConnection);
    final DelegatingConnectionFactory connectionFactory = unhealthyHostConnectionFactory.createFactory();
    lb = defaultLb(connectionFactory);
    sendServiceDiscoveryEvents(upEvent("address-1"));
    // Imitate concurrency by running multiple threads attempting to establish connections.
    ExecutorService executor = Executors.newFixedThreadPool(3);
    try {
        final Runnable runnable = () -> assertThrows(ExecutionException.class, () -> lb.selectConnection(any(), null).toFuture().get());
        for (int i = 0; i < 1000; i++) {
            executor.submit(runnable);
        }
        // From test main thread, wait until the host becomes UNHEALTHY, which is apparent from
        // NoHostAvailableException being thrown from selection AFTER a health check was scheduled by any thread.
        final Executor executorForRetries = io.servicetalk.concurrent.api.Executors.newFixedSizeExecutor(1);
        try {
            awaitIndefinitely(lb.selectConnection(any(), null).retryWhen(retryWithConstantBackoffFullJitter((t) -> t instanceof DeliberateException || testExecutor.scheduledTasksPending() == 0, // try to prevent stack overflow
            Duration.ofMillis(30), executorForRetries)));
        } catch (Exception e) {
            assertThat(e.getCause(), instanceOf(NoAvailableHostException.class));
        } finally {
            executorForRetries.closeAsync().toFuture().get();
        }
        // is not selected. If our assumption doesn't hold, it means more than one health check was scheduled.
        for (int i = 0; i < timeAdvancementsTillHealthy - 1; ++i) {
            unhealthyHostConnectionFactory.advanceTime(testExecutor);
            // Assert still unhealthy
            Exception e = assertThrows(ExecutionException.class, () -> lb.selectConnection(any(), null).toFuture().get());
            assertThat(e.getCause(), instanceOf(NoAvailableHostException.class));
        }
    } finally {
        // Shutdown the concurrent validation of unhealthiness.
        executor.shutdownNow();
        executor.awaitTermination(10, SECONDS);
    }
    unhealthyHostConnectionFactory.advanceTime(testExecutor);
    final TestLoadBalancedConnection selectedConnection = lb.selectConnection(any(), null).toFuture().get();
    assertThat(selectedConnection, equalTo(properConnection.toFuture().get()));
}
Also used : Executor(io.servicetalk.concurrent.api.Executor) DelegatingExecutor(io.servicetalk.concurrent.api.DelegatingExecutor) TestExecutor(io.servicetalk.concurrent.api.TestExecutor) NoAvailableHostException(io.servicetalk.client.api.NoAvailableHostException) ExecutorService(java.util.concurrent.ExecutorService) DeliberateException(io.servicetalk.concurrent.internal.DeliberateException) ConnectionRejectedException(io.servicetalk.client.api.ConnectionRejectedException) DeliberateException(io.servicetalk.concurrent.internal.DeliberateException) NoSuchElementException(java.util.NoSuchElementException) NoAvailableHostException(io.servicetalk.client.api.NoAvailableHostException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.jupiter.api.Test)

Aggregations

Executor (io.servicetalk.concurrent.api.Executor)14 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)7 Test (org.junit.jupiter.api.Test)7 Single (io.servicetalk.concurrent.api.Single)5 SourceAdapters.toSource (io.servicetalk.concurrent.api.SourceAdapters.toSource)5 Cancellable (io.servicetalk.concurrent.Cancellable)4 Completable (io.servicetalk.concurrent.api.Completable)4 Publisher (io.servicetalk.concurrent.api.Publisher)4 DEFAULT_ALLOCATOR (io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR)3 ConnectionRejectedException (io.servicetalk.client.api.ConnectionRejectedException)3 Executors (io.servicetalk.concurrent.api.Executors)3 ServerContext (io.servicetalk.transport.api.ServerContext)3 ExecutionException (java.util.concurrent.ExecutionException)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 Nullable (javax.annotation.Nullable)3 Matchers.is (org.hamcrest.Matchers.is)3 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)2 ChannelInboundHandlerAdapter (io.netty.channel.ChannelInboundHandlerAdapter)2 Buffer (io.servicetalk.buffer.api.Buffer)2 PublisherSource (io.servicetalk.concurrent.PublisherSource)2