public final class GeneralOptions extends AbstractOptions
A collection of global configuration Option
s
ThreadPoolExecutor executor = new ThreadPoolExecutor(9, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new DefaultThreadFactory("agql-query")); SourceQueryOptions queryOptions = SourceQueryOptions.builder() //this can be any class that implements the Options interface .option(GeneralOptions.READ_TIMEOUT, 3000) .option(GeneralOptions.THREAD_EXECUTOR_SERVICE, executor) .option(FailsafeOptions.FAILSAFE_ENABLED, true) .build(); SourceQueryClient client = new SourceQueryClient(queryOptions);
Option
,
OptionBuilder
Modifier and Type | Field and Description |
---|---|
static Option<Integer> |
CLOSE_TIMEOUT
The maximum number of milliseconds to wait before timing out on close channel operation
|
static Option<Boolean> |
CONNECTION_POOLING
Set to
true to enable channel/connection pooling |
static Option<Integer> |
POOL_ACQUIRE_MAX
Maximum number of allowed pending acquires.
|
static Option<Integer> |
POOL_ACQUIRE_TIMEOUT
The maximum number of milliseconds to wait before a timeout is triggered during
Channel acquisition. |
static Option<FixedNettyChannelPool.AcquireTimeoutAction> |
POOL_ACQUIRE_TIMEOUT_ACTION
The action that will be executed once an acquire timeout is thrown
|
static Option<ChannelHealthChecker> |
POOL_CHANNEL_HEALTH_CHECKER
The
ChannelHealthChecker that is used by the ChannelPool implementation to check if the Channel can be acquired. |
static Option<Integer> |
POOL_MAX_CONNECTIONS
Maximum number of connections to be maintained in the channel/connection pool.
|
static Option<ChannelPoolType> |
POOL_TYPE
The type of
ChannelPool implementation to use (bounded or unbounded) |
static Option<Integer> |
READ_TIMEOUT
Number of milliseconds to wait before we throw a ReadTimeoutException (Default: 5 seconds)
|
static Option<io.netty.util.ResourceLeakDetector.Level> |
RESOURCE_LEAK_DETECTOR_LEVEL
Monitor resource usage leaks.
|
static Option<Integer> |
SOCKET_ALLOC_ADAPTIVE_INIT_SIZE
As per netty: the initial buffer size when no feed back was received.
|
static Option<Integer> |
SOCKET_ALLOC_ADAPTIVE_MAX_SIZE
As per netty: the inclusive upper bound of the expected buffer size.
|
static Option<Integer> |
SOCKET_ALLOC_ADAPTIVE_MIN_SIZE
As per netty: the inclusive lower bound of the expected buffer size.
|
static Option<Integer> |
SOCKET_ALLOC_FIXED_SIZE
The fixed receive buffer size to allocate during channel initialization.
|
static Option<Integer> |
SOCKET_CONNECT_TIMEOUT
The connection timeout value
|
static Option<Boolean> |
SOCKET_KEEP_ALIVE
A channel option, when enabled, allows the application to enable keep-alive packets for a socket connection.
|
static Option<Integer> |
SOCKET_RECVBUF
A channel option that specifies the total per-socket buffer space reserved for receives
|
static Option<BufferAllocatorType> |
SOCKET_RECVBUF_ALLOC_TYPE
The strategy for allocating netty's inbound/outbound pooled buffers.
|
static Option<Integer> |
SOCKET_SNDBUF
A channel option that specifies the total per-socket buffer space reserved for sends
|
static Option<Integer> |
THREAD_CORE_SIZE
The number of threads to be used by the internal
EventLoopGroup . |
static Option<ExecutorService> |
THREAD_EXECUTOR_SERVICE
A custom
ExecutorService that will be used by the client. |
static Option<Integer> |
WRITE_TIMEOUT
Number of milliseconds to wait before we throw a WriteTimeoutException (Default: 5 seconds)
|
Modifier and Type | Method and Description |
---|---|
static Options |
getInstance()
The global
Options container initially populated with the default values but can be overriden at runtime. |
contains, get, get, get, getOrDefault, isLocked, iterator, put, put, putIfAbsent, remove, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getOrDefault, getOrDefault, isEmpty
forEach, spliterator
public static final Option<io.netty.util.ResourceLeakDetector.Level> RESOURCE_LEAK_DETECTOR_LEVEL
ResourceLeakDetector
public static final Option<Integer> READ_TIMEOUT
public static final Option<Integer> WRITE_TIMEOUT
public static final Option<Integer> CLOSE_TIMEOUT
@ApiStatus.Internal public static final Option<ChannelHealthChecker> POOL_CHANNEL_HEALTH_CHECKER
ChannelHealthChecker
that is used by the ChannelPool
implementation to check if the Channel
can be acquired.@ApiStatus.Internal public static final Option<FixedNettyChannelPool.AcquireTimeoutAction> POOL_ACQUIRE_TIMEOUT_ACTION
public static final Option<Integer> POOL_ACQUIRE_TIMEOUT
Channel
acquisition.FixedChannelPool
,
ChannelPoolType
public static final Option<Integer> POOL_ACQUIRE_MAX
Channel
FixedChannelPool
,
ChannelPoolType
public static final Option<Integer> POOL_MAX_CONNECTIONS
POOL_TYPE
is set to ChannelPoolType.FIXED
FixedChannelPool
,
ChannelPoolType
public static final Option<ChannelPoolType> POOL_TYPE
ChannelPool
implementation to use (bounded or unbounded)ChannelPoolType.ADAPTIVE
,
ChannelPoolType.FIXED
public static final Option<Boolean> CONNECTION_POOLING
true
to enable channel/connection poolingpublic static final Option<ExecutorService> THREAD_EXECUTOR_SERVICE
ExecutorService
that will be used by the client. Set to null
to use the global executor provided by the library which is shared across all clients by default. (Default: null
)
Note: If you provide a custom ExecutorService
, then you are responsible for closing it. Only the default executor is closed automatically.
Platform.getDefaultExecutor()
public static final Option<Integer> THREAD_CORE_SIZE
EventLoopGroup
. This is usually less than or equals to the core pool size of the ExecutorService
provided (Default: null
).THREAD_EXECUTOR_SERVICE
public static final Option<BufferAllocatorType> SOCKET_RECVBUF_ALLOC_TYPE
BufferAllocatorType.FIXED
, make sure to also set an optimal value for the buffer size (Default is: BufferAllocatorType.FIXED
)FixedRecvByteBufAllocator
,
AdaptiveRecvByteBufAllocator
,
SOCKET_ALLOC_FIXED_SIZE
public static final Option<Integer> SOCKET_ALLOC_FIXED_SIZE
SOCKET_RECVBUF_ALLOC_TYPE
is set to BufferAllocatorType.FIXED
(Default is: 9216 bytes)FixedRecvByteBufAllocator
,
BufferAllocatorType
,
SOCKET_RECVBUF_ALLOC_TYPE
public static final Option<Integer> SOCKET_ALLOC_ADAPTIVE_INIT_SIZE
BufferAllocatorType.ADAPTIVE
. (Default is 2048 bytes)SOCKET_RECVBUF_ALLOC_TYPE
,
BufferAllocatorType
public static final Option<Integer> SOCKET_ALLOC_ADAPTIVE_MIN_SIZE
BufferAllocatorType.ADAPTIVE
. (Default is 64 bytes)SOCKET_RECVBUF_ALLOC_TYPE
,
BufferAllocatorType
public static final Option<Integer> SOCKET_ALLOC_ADAPTIVE_MAX_SIZE
BufferAllocatorType.ADAPTIVE
. (Default is 65536 bytes)SOCKET_RECVBUF_ALLOC_TYPE
,
BufferAllocatorType
public static final Option<Integer> SOCKET_SNDBUF
public static final Option<Integer> SOCKET_RECVBUF
public static final Option<Boolean> SOCKET_KEEP_ALIVE
Copyright © 2016–2024. All rights reserved.