public interface ClientResources
ClientResources
can be shared amongst multiple client instances if created outside
the client creation. Implementations of ClientResources
are stateful and must be shutdown()
after they are
no longer in use.
ClientResources
provides in particular:
AddressResolverGroup
for DNS resolution.CommandLatencyRecorder
to collect latency details. Enabled using
DefaultCommandLatencyCollector
when HdrHistogram is on the classpath.EventBus
for client event dispatchingEventLoopGroupProvider
to obtain particular EventLoopGroups
EventExecutorGroup
to perform internal computation tasksDelay
.SocketAddressResolver
for to map/resolve DNS addresses to a InetSocketAddress
.Timer
for schedulingTracing
to trace Redis commands.DefaultClientResources
Modifier and Type | Interface and Description |
---|---|
static interface |
ClientResources.Builder
Builder for
ClientResources . |
Modifier and Type | Method and Description |
---|---|
AddressResolverGroup<?> |
addressResolverGroup()
Return the
AddressResolverGroup instance for DNS resolution. |
static ClientResources.Builder |
builder()
Create a new
ClientResources using default settings. |
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 ClientResources |
create()
Create a new
ClientResources using default settings. |
static ClientResources |
create(ThreadFactoryProvider threadFactoryProvider)
Create a new
ClientResources 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 . |
int |
ioThreadPoolSize()
Return the pool size (number of threads) for IO threads.
|
ClientResources.Builder |
mutate()
Return a builder to create new
ClientResources whose settings are replicated from the current
ClientResources . |
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. |
static ClientResources create()
ClientResources
using default settings.static ClientResources create(ThreadFactoryProvider threadFactoryProvider)
ClientResources
using default settings.threadFactoryProvider
- provides a ThreadFactory
to create threads.static ClientResources.Builder builder()
ClientResources
using default settings.ClientResources.Builder mutate()
ClientResources
whose settings are replicated from the current
ClientResources
.ClientResources.Builder
to create new ClientResources
whose settings are replicated from the
current ClientResources
Future<Boolean> shutdown()
ClientResources
.Future<Boolean> shutdown(long quietPeriod, long timeout, TimeUnit timeUnit)
ClientResources
.quietPeriod
- 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 timeout
AddressResolverGroup<?> addressResolverGroup()
AddressResolverGroup
instance for DNS resolution.EventPublisherOptions commandLatencyPublisherOptions()
EventPublisherOptions
for latency event publishing.EventPublisherOptions
for latency event publishing.CommandLatencyRecorder commandLatencyRecorder()
CommandLatencyRecorder
.int computationThreadPoolSize()
DnsResolver dnsResolver()
DnsResolver
.EventBus eventBus()
EventLoopGroupProvider eventLoopGroupProvider()
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).
You can use DefaultEventLoopGroupProvider
as default implementation or implement an own
EventLoopGroupProvider
to share existing EventLoopGroup's
with lettuce.EventLoopGroupProvider
which provides access to the particular event loop groups
EventExecutorGroup eventExecutorGroup()
ConnectionWatchdog
.int ioThreadPoolSize()
NettyCustomizer nettyCustomizer()
NettyCustomizer
to customize netty components.NettyCustomizer
.Delay reconnectDelay()
Delay
for reconnect attempts. May return a different instance on each call.Delay
.SocketAddressResolver socketAddressResolver()
SocketAddressResolver
.Timer timer()
Timer
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
eventExecutorGroup()
.Copyright © 2024 lettuce.io. All rights reserved.