public class DefaultClientResources extends Object implements ClientResources
The DefaultClientResources instance is stateful, you have to shutdown the instance if you're no longer using it.
DefaultClientResources allow to configure:
commandLatencyRecorder which is a provided instance of CommandLatencyRecorder
.ioThreadPoolSize, alternativelyeventLoopGroupProvider which is a provided instance of EventLoopGroupProvider. Higher precedence than
ioThreadPoolSize.eventExecutorGroup which is a provided instance of EventExecutorGroup. Higher precedence than
computationThreadPoolSize.eventBus which is a provided instance of EventBus.dnsResolver which is a provided instance of DnsResolver.nettyCustomizer that is a provided instance of NettyCustomizer.socketAddressResolver which is a provided instance of SocketAddressResolver.threadFactoryProvider to provide a ThreadFactory for default timer, event loop and
event executor instances.timer that is a provided instance of HashedWheelTimer.tracing that is a provided instance of Tracing.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultClientResources.Builder
Builder for
DefaultClientResources. |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_COMPUTATION_THREADS |
static int |
DEFAULT_IO_THREADS |
static NettyCustomizer |
DEFAULT_NETTY_CUSTOMIZER
Default (no-op)
NettyCustomizer. |
static Supplier<Delay> |
DEFAULT_RECONNECT_DELAY
Default delay
Supplier for Delay.exponential() delay. |
protected static InternalLogger |
logger |
static int |
MIN_COMPUTATION_THREADS
Minimum number of computation threads.
|
static int |
MIN_IO_THREADS
Minimum number of I/O threads.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultClientResources(DefaultClientResources.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
static DefaultClientResources.Builder |
builder()
Returns a new
DefaultClientResources.Builder to construct DefaultClientResources. |
EventPublisherOptions |
commandLatencyPublisherOptions()
Return the
EventPublisherOptions for latency event publishing. |
CommandLatencyRecorder |
commandLatencyRecorder()
Return the
CommandLatencyRecorder. |
int |
computationThreadPoolSize()
Return the pool size (number of threads) for all computation tasks.
|
static DefaultClientResources |
create()
Create a new
DefaultClientResources using default settings. |
DnsResolver |
dnsResolver()
Return the
DnsResolver. |
EventBus |
eventBus()
Return the event bus used to publish events.
|
EventExecutorGroup |
eventExecutorGroup()
Return the computation pool used for internal operations.
|
EventLoopGroupProvider |
eventLoopGroupProvider()
Return the
EventLoopGroupProvider that provides access to the particular event loop groups. lettuce requires at least two implementations: NioEventLoopGroup for
TCP/IP connections and EpollEventLoopGroup for unix domain socket connections (epoll). |
protected void |
finalize() |
int |
ioThreadPoolSize()
Return the pool size (number of threads) for IO threads.
|
DefaultClientResources.Builder |
mutate()
Returns a builder to create new
DefaultClientResources whose settings are replicated from the current
DefaultClientResources. |
NettyCustomizer |
nettyCustomizer()
Return the
NettyCustomizer to customize netty components. |
Delay |
reconnectDelay()
Return the
Delay for reconnect attempts. |
Future<Boolean> |
shutdown()
Shutdown the
ClientResources. |
Future<Boolean> |
shutdown(long quietPeriod,
long timeout,
TimeUnit timeUnit)
Shutdown the
ClientResources. |
SocketAddressResolver |
socketAddressResolver()
Return the
SocketAddressResolver. |
Timer |
timer()
Return the
Timer to schedule events. |
Tracing |
tracing()
Return the
Tracing instance to support tracing of Redis commands. |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateprotected static final InternalLogger logger
public static final int MIN_IO_THREADS
public static final int MIN_COMPUTATION_THREADS
public static final int DEFAULT_IO_THREADS
public static final int DEFAULT_COMPUTATION_THREADS
public static final Supplier<Delay> DEFAULT_RECONNECT_DELAY
Supplier for Delay.exponential() delay.public static final NettyCustomizer DEFAULT_NETTY_CUSTOMIZER
NettyCustomizer.protected DefaultClientResources(DefaultClientResources.Builder builder)
public static DefaultClientResources create()
DefaultClientResources using default settings.create in interface ClientResourcespublic static DefaultClientResources.Builder builder()
DefaultClientResources.Builder to construct DefaultClientResources.builder in interface ClientResourcesDefaultClientResources.Builder to construct DefaultClientResources.public DefaultClientResources.Builder mutate()
DefaultClientResources whose settings are replicated from the current
DefaultClientResources.
Note: The resulting DefaultClientResources retains shared state for Timer,
CommandLatencyRecorder, EventExecutorGroup, and EventLoopGroupProvider if these are left
unchanged. Thus you need only to shut down the last created ClientResources instances. Shutdown affects any
previously created ClientResources.
mutate in interface ClientResourcesDefaultClientResources.Builder to create new DefaultClientResources whose settings are
replicated from the current DefaultClientResources.protected void finalize()
throws Throwable
public Future<Boolean> shutdown()
ClientResources.shutdown in interface ClientResourcespublic Future<Boolean> shutdown(long quietPeriod, long timeout, TimeUnit timeUnit)
ClientResources.shutdown in interface ClientResourcesquietPeriod - the quiet period as described in the documentationtimeout - the maximum amount of time to wait until the executor is shutdown regardless if a task was submitted
during the quiet periodtimeUnit - the unit of quietPeriod and timeoutpublic CommandLatencyRecorder commandLatencyRecorder()
ClientResourcesCommandLatencyRecorder.commandLatencyRecorder in interface ClientResourcespublic EventPublisherOptions commandLatencyPublisherOptions()
ClientResourcesEventPublisherOptions for latency event publishing.commandLatencyPublisherOptions in interface ClientResourcesEventPublisherOptions for latency event publishing.public int computationThreadPoolSize()
ClientResourcescomputationThreadPoolSize in interface ClientResourcespublic DnsResolver dnsResolver()
ClientResourcesDnsResolver.dnsResolver in interface ClientResourcespublic EventBus eventBus()
ClientResourceseventBus in interface ClientResourcespublic EventLoopGroupProvider eventLoopGroupProvider()
ClientResourcesEventLoopGroupProvider that provides access to the particular event loop groups. lettuce requires at least two implementations: NioEventLoopGroup for
TCP/IP connections and EpollEventLoopGroup for unix domain socket connections (epoll).
You can use DefaultEventLoopGroupProvider as default implementation or implement an own
EventLoopGroupProvider to share existing EventLoopGroup's with lettuce.eventLoopGroupProvider in interface ClientResourcesEventLoopGroupProvider which provides access to the particular event loop groupspublic EventExecutorGroup eventExecutorGroup()
ClientResourcesConnectionWatchdog.eventExecutorGroup in interface ClientResourcespublic int ioThreadPoolSize()
ClientResourcesioThreadPoolSize in interface ClientResourcespublic NettyCustomizer nettyCustomizer()
ClientResourcesNettyCustomizer to customize netty components.nettyCustomizer in interface ClientResourcesNettyCustomizer.public Delay reconnectDelay()
ClientResourcesDelay for reconnect attempts. May return a different instance on each call.reconnectDelay in interface ClientResourcesDelay.public SocketAddressResolver socketAddressResolver()
ClientResourcesSocketAddressResolver.socketAddressResolver in interface ClientResourcespublic Timer timer()
ClientResourcesTimer to schedule events. A timer object may run single- or multi-threaded but must be used for
scheduling of short-running jobs only. Long-running jobs should be scheduled and executed using
ClientResources.eventExecutorGroup().timer in interface ClientResourcespublic Tracing tracing()
ClientResourcesTracing instance to support tracing of Redis commands.tracing in interface ClientResourcesTracing.Copyright © 2022 lettuce.io. All rights reserved.