T
- The type of value associated with the option.public final class SdkAdvancedAsyncClientOption<T> extends ClientOption<T>
ClientAsyncConfiguration.Builder.advancedOption(SdkAdvancedAsyncClientOption,
Object)
.
These options are usually not required outside of testing or advanced libraries, so most users should not need to configure them.
AttributeMap.Key.UnsafeValueType
Modifier and Type | Field and Description |
---|---|
static SdkAdvancedAsyncClientOption<Executor> |
FUTURE_COMPLETION_EXECUTOR
Configure the
Executor that should be used to complete the CompletableFuture that is returned by the async
service client. |
public static final SdkAdvancedAsyncClientOption<Executor> FUTURE_COMPLETION_EXECUTOR
Executor
that should be used to complete the CompletableFuture
that is returned by the async
service client. By default, this is a dedicated, per-client ThreadPoolExecutor
that is managed by the SDK.
The configured Executor
will be invoked by the async HTTP client's I/O threads (e.g., EventLoops), which must be
reserved for non-blocking behavior. Blocking an I/O thread can cause severe performance degradation, including across
multiple clients, as clients are configured, by default, to share a single I/O thread pool (e.g., EventLoopGroup).
You should typically only want to customize the future-completion Executor
for a few possible reasons:
ThreadPoolExecutor
used, such as configuring the pool size
or sharing a single pool between multiple clients.
Executor
is used.
CompletableFuture
usage is strictly non-blocking, and you wish to
remove the minor overhead incurred by using a separate thread. In this case, you can use
Runnable::run
to execute the future-completion directly from within the I/O thread.
Copyright © 2022. All rights reserved.