public static class DefaultClientResources.Builder extends Object implements ClientResources.Builder
DefaultClientResources
.Modifier and Type | Method and Description |
---|---|
DefaultClientResources.Builder |
addressResolverGroup(AddressResolverGroup<?> addressResolverGroup)
Sets the
AddressResolverGroup for DNS resolution. |
DefaultClientResources |
build() |
DefaultClientResources.Builder |
commandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)
Deprecated.
since 6.0. Configure
CommandLatencyRecorder directly using
CommandLatencyCollectorOptions . |
DefaultClientResources.Builder |
commandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)
Sets the
EventPublisherOptions to publish command latency metrics using the EventBus if the
CommandLatencyRecorder is an instance of CommandLatencyCollector that allows latency metric
retrieval. |
DefaultClientResources.Builder |
commandLatencyRecorder(CommandLatencyRecorder commandLatencyRecorder)
Sets the
CommandLatencyRecorder that can that can be used across different instances of the RedisClient. |
DefaultClientResources.Builder |
computationThreadPoolSize(int computationThreadPoolSize)
Sets the thread pool size (number of threads to use) for computation operations (default value is the number of
CPUs).
|
DefaultClientResources.Builder |
dnsResolver(DnsResolver dnsResolver)
Sets the
DnsResolver that is used to resolve hostnames to InetAddress . |
DefaultClientResources.Builder |
eventBus(EventBus eventBus)
Sets the
EventBus that can that can be used across different instances of the RedisClient. |
DefaultClientResources.Builder |
eventExecutorGroup(EventExecutorGroup eventExecutorGroup)
Sets a shared
event executor group that can be used across different instances of
RedisClient and RedisClusterClient . |
DefaultClientResources.Builder |
eventLoopGroupProvider(EventLoopGroupProvider eventLoopGroupProvider)
Sets a shared
event executor provider that can be used across different instances of
RedisClient and RedisClusterClient . |
DefaultClientResources.Builder |
ioThreadPoolSize(int ioThreadPoolSize)
Sets the thread pool size (number of threads to use) for I/O operations (default value is the number of CPUs).
|
DefaultClientResources.Builder |
nettyCustomizer(NettyCustomizer nettyCustomizer)
Sets the
NettyCustomizer instance to customize netty components during connection. |
DefaultClientResources.Builder |
reconnectDelay(Delay reconnectDelay)
Sets the stateless reconnect
Delay to delay reconnect attempts. |
DefaultClientResources.Builder |
reconnectDelay(Supplier<Delay> reconnectDelay)
Sets the stateful reconnect
Supplier to delay reconnect attempts. |
ClientResources.Builder |
socketAddressResolver(SocketAddressResolver socketAddressResolver)
|
ClientResources.Builder |
threadFactoryProvider(ThreadFactoryProvider threadFactoryProvider)
|
DefaultClientResources.Builder |
timer(Timer timer)
Sets a shared
Timer that can be used across different instances of RedisClient and
RedisClusterClient The provided Timer instance will not be shut down when
shutting down the client resources. |
DefaultClientResources.Builder |
tracing(Tracing tracing)
Sets the
Tracing instance to trace Redis calls. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
commandLatencyCollector
public DefaultClientResources.Builder addressResolverGroup(AddressResolverGroup<?> addressResolverGroup)
AddressResolverGroup
for DNS resolution. This option is only effective if
DnsResolvers.UNRESOLVED
is used as DnsResolver
. Defaults to
DefaultAddressResolverGroup.INSTANCE
if netty-dns-resolver is not available,
otherwise defaults to DnsAddressResolverGroup
.addressResolverGroup
in interface ClientResources.Builder
addressResolverGroup
- the AddressResolverGroup
instance, must not be null
.this
ClientResources.Builder
public DefaultClientResources.Builder commandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)
EventPublisherOptions
to publish command latency metrics using the EventBus
if the
CommandLatencyRecorder
is an instance of CommandLatencyCollector
that allows latency metric
retrieval.commandLatencyPublisherOptions
in interface ClientResources.Builder
commandLatencyPublisherOptions
- the EventPublisherOptions
to publish command latency metrics using the
EventBus
, must not be null
.this
ClientResources.Builder
.@Deprecated public DefaultClientResources.Builder commandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)
CommandLatencyRecorder
directly using
CommandLatencyCollectorOptions
.CommandLatencyCollectorOptions
that can that can be used across different instances of the
RedisClient. The options are only effective if no commandLatencyCollector
is provided.commandLatencyCollectorOptions
in interface ClientResources.Builder
commandLatencyCollectorOptions
- the command latency collector options, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder commandLatencyRecorder(CommandLatencyRecorder commandLatencyRecorder)
CommandLatencyRecorder
that can that can be used across different instances of the RedisClient.commandLatencyRecorder
in interface ClientResources.Builder
commandLatencyRecorder
- the command latency recorder, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder computationThreadPoolSize(int computationThreadPoolSize)
eventExecutorGroup
is provided.computationThreadPoolSize
in interface ClientResources.Builder
computationThreadPoolSize
- the thread pool size, must be greater than 0
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder dnsResolver(DnsResolver dnsResolver)
DnsResolver
that is used to resolve hostnames to InetAddress
. Defaults to
DnsResolvers.JVM_DEFAULT
dnsResolver
in interface ClientResources.Builder
dnsResolver
- the DNS resolver, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder eventBus(EventBus eventBus)
EventBus
that can that can be used across different instances of the RedisClient.eventBus
in interface ClientResources.Builder
eventBus
- the event bus, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder eventLoopGroupProvider(EventLoopGroupProvider eventLoopGroupProvider)
event executor provider
that can be used across different instances of
RedisClient
and RedisClusterClient
. The provided
EventLoopGroupProvider
instance will not be shut down when shutting down the client resources. You have to
take care of that. This is an advanced configuration that should only be used if you know what you are doing.eventLoopGroupProvider
in interface ClientResources.Builder
eventLoopGroupProvider
- the shared eventLoopGroupProvider, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder eventExecutorGroup(EventExecutorGroup eventExecutorGroup)
event executor group
that can be used across different instances of
RedisClient
and RedisClusterClient
. The provided
EventExecutorGroup
instance will not be shut down when shutting down the client resources. You have to take
care of that. This is an advanced configuration that should only be used if you know what you are doing.eventExecutorGroup
in interface ClientResources.Builder
eventExecutorGroup
- the shared eventExecutorGroup, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder nettyCustomizer(NettyCustomizer nettyCustomizer)
NettyCustomizer
instance to customize netty components during connection.nettyCustomizer
in interface ClientResources.Builder
nettyCustomizer
- the netty customizer instance, must not be null
.public DefaultClientResources.Builder ioThreadPoolSize(int ioThreadPoolSize)
eventLoopGroupProvider
is provided.ioThreadPoolSize
in interface ClientResources.Builder
ioThreadPoolSize
- the thread pool size, must be greater 0
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder reconnectDelay(Delay reconnectDelay)
Delay
to delay reconnect attempts. Defaults to binary exponential delay capped
at 30 SECONDS. reconnectDelay
must be a stateless Delay
.reconnectDelay
in interface ClientResources.Builder
reconnectDelay
- the reconnect delay, must not be null
.public DefaultClientResources.Builder reconnectDelay(Supplier<Delay> reconnectDelay)
Supplier
to delay reconnect attempts. Defaults to binary exponential delay capped
at 30 SECONDS.reconnectDelay
in interface ClientResources.Builder
reconnectDelay
- the reconnect delay, must not be null
.public ClientResources.Builder socketAddressResolver(SocketAddressResolver socketAddressResolver)
SocketAddressResolver
that is used to resolve RedisURI
to
SocketAddress
. Defaults to SocketAddressResolver
using the configured DnsResolver
.socketAddressResolver
in interface ClientResources.Builder
socketAddressResolver
- the socket address resolver, must not be null
.this
ClientResources.Builder
.public ClientResources.Builder threadFactoryProvider(ThreadFactoryProvider threadFactoryProvider)
ThreadFactoryProvider
to obtain ThreadFactory
for a
poolName
.
Applies only to threading resources created by DefaultClientResources
when not configuring ClientResources.timer()
,
ClientResources.eventExecutorGroup()
, or ClientResources.eventLoopGroupProvider()
.
threadFactoryProvider
in interface ClientResources.Builder
threadFactoryProvider
- a provider to obtain a ThreadFactory
for a
poolName
, must not be null
.this
ClientResources.Builder
.eventExecutorGroup(EventExecutorGroup)
,
eventLoopGroupProvider(EventLoopGroupProvider)
,
timer(Timer)
public DefaultClientResources.Builder timer(Timer timer)
Timer
that can be used across different instances of RedisClient
and
RedisClusterClient
The provided Timer
instance will not be shut down when
shutting down the client resources. You have to take care of that. This is an advanced configuration that should only
be used if you know what you are doing.timer
in interface ClientResources.Builder
timer
- the shared Timer
, must not be null
.this
DefaultClientResources.Builder
.public DefaultClientResources.Builder tracing(Tracing tracing)
Tracing
instance to trace Redis calls.tracing
in interface ClientResources.Builder
tracing
- the tracer infrastructure instance, must not be null
.public DefaultClientResources build()
build
in interface ClientResources.Builder
DefaultClientResources
.Copyright © 2023 lettuce.io. All rights reserved.