Package io.lettuce.core.resource
Interface ClientResources.Builder
-
- All Known Implementing Classes:
DefaultClientResources.Builder
- Enclosing interface:
- ClientResources
public static interface ClientResources.Builder
Builder forClientResources
.- Since:
- 5.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description ClientResources.Builder
addressResolverGroup(AddressResolverGroup<?> addressResolverGroup)
Sets theAddressResolverGroup
for DNS resolution.ClientResources
build()
default ClientResources.Builder
commandLatencyCollector(CommandLatencyCollector commandLatencyCollector)
Deprecated.since 6.0, usecommandLatencyRecorder(CommandLatencyRecorder)
instead.ClientResources.Builder
commandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)
Deprecated.since 6.0.ClientResources.Builder
commandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)
Sets theEventPublisherOptions
to publish command latency metrics using theEventBus
if theCommandLatencyRecorder
is an instance ofCommandLatencyCollector
that allows latency metric retrieval.ClientResources.Builder
commandLatencyRecorder(CommandLatencyRecorder latencyRecorder)
Sets theCommandLatencyRecorder
that can be used across different instances of the RedisClient.ClientResources.Builder
computationThreadPoolSize(int computationThreadPoolSize)
Sets the thread pool size (number of threads to use) for computation operations (default value is the number of CPUs).ClientResources.Builder
dnsResolver(DnsResolver dnsResolver)
Deprecated.since 6.1.ClientResources.Builder
eventBus(EventBus eventBus)
Sets theEventBus
that can be used across different instances of the RedisClient.ClientResources.Builder
eventExecutorGroup(EventExecutorGroup eventExecutorGroup)
Sets a sharedevent executor group
that can be used across different instances ofRedisClient
andRedisClusterClient
.ClientResources.Builder
eventLoopGroupProvider(EventLoopGroupProvider eventLoopGroupProvider)
Sets a sharedevent executor provider
that can be used across different instances ofRedisClient
andRedisClusterClient
.ClientResources.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).ClientResources.Builder
nettyCustomizer(NettyCustomizer nettyCustomizer)
Sets theNettyCustomizer
instance to customize netty components during connection.ClientResources.Builder
reconnectDelay(Delay reconnectDelay)
Sets the stateless reconnectDelay
to delay reconnect attempts.ClientResources.Builder
reconnectDelay(Supplier<Delay> reconnectDelay)
Sets the stateful reconnectSupplier
to delay reconnect attempts.ClientResources.Builder
socketAddressResolver(SocketAddressResolver socketAddressResolver)
ClientResources.Builder
threadFactoryProvider(ThreadFactoryProvider threadFactoryProvider)
ClientResources.Builder
timer(Timer timer)
Sets a sharedTimer
that can be used across different instances ofRedisClient
andRedisClusterClient
The providedTimer
instance will not be shut down when shutting down the client resources.ClientResources.Builder
tracing(Tracing tracing)
Sets theTracing
instance to trace Redis calls.
-
-
-
Method Detail
-
addressResolverGroup
ClientResources.Builder addressResolverGroup(AddressResolverGroup<?> addressResolverGroup)
Sets theAddressResolverGroup
for DNS resolution. This option is only effective ifDnsResolvers.UNRESOLVED
is used asDnsResolver
. Defaults toDefaultAddressResolverGroup.INSTANCE
if netty-dns-resolver is not available, otherwise defaults toDnsAddressResolverGroup
.- Parameters:
addressResolverGroup
- theAddressResolverGroup
instance, must not benull
.- Returns:
this
ClientResources.Builder
- Since:
- 6.1
-
commandLatencyCollector
@Deprecated default ClientResources.Builder commandLatencyCollector(CommandLatencyCollector commandLatencyCollector)
Deprecated.since 6.0, usecommandLatencyRecorder(CommandLatencyRecorder)
instead.Sets theCommandLatencyCollector
that can be used across different instances of the RedisClient.- Parameters:
commandLatencyCollector
- the command latency collector, must not benull
.- Returns:
this
ClientResources.Builder
.
-
commandLatencyRecorder
ClientResources.Builder commandLatencyRecorder(CommandLatencyRecorder latencyRecorder)
Sets theCommandLatencyRecorder
that can be used across different instances of the RedisClient.- Parameters:
latencyRecorder
- the command latency recorder, must not benull
.- Returns:
this
ClientResources.Builder
.- Since:
- 6.0
-
commandLatencyCollectorOptions
@Deprecated ClientResources.Builder commandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)
Deprecated.since 6.0. ConfigureCommandLatencyRecorder
directly usingCommandLatencyCollectorOptions
.Sets theCommandLatencyCollectorOptions
that can be used across different instances of the RedisClient. The options are only effective if nocommandLatencyCollector
is provided.- Parameters:
commandLatencyCollectorOptions
- the command latency collector options, must not benull
.- Returns:
this
ClientResources.Builder
.
-
commandLatencyPublisherOptions
ClientResources.Builder commandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)
Sets theEventPublisherOptions
to publish command latency metrics using theEventBus
if theCommandLatencyRecorder
is an instance ofCommandLatencyCollector
that allows latency metric retrieval.- Parameters:
commandLatencyPublisherOptions
- theEventPublisherOptions
to publish command latency metrics using theEventBus
, must not benull
.- Returns:
this
ClientResources.Builder
.
-
computationThreadPoolSize
ClientResources.Builder computationThreadPoolSize(int computationThreadPoolSize)
Sets the thread pool size (number of threads to use) for computation operations (default value is the number of CPUs). The thread pool size is only effective if noeventExecutorGroup
is provided.- Parameters:
computationThreadPoolSize
- the thread pool size, must be greater0
.- Returns:
this
ClientResources.Builder
.
-
dnsResolver
@Deprecated ClientResources.Builder dnsResolver(DnsResolver dnsResolver)
Deprecated.since 6.1. ConfigureAddressResolverGroup
instead.Sets theDnsResolver
that is used to resolve hostnames toInetAddress
. Defaults toDnsResolvers.UNRESOLVED
to use netty'sAddressResolverGroup
.- Parameters:
dnsResolver
- the DNS resolver, must not benull
.- Returns:
this
ClientResources.Builder
.- Since:
- 4.3
-
eventBus
ClientResources.Builder eventBus(EventBus eventBus)
Sets theEventBus
that can be used across different instances of the RedisClient.- Parameters:
eventBus
- the event bus, must not benull
.- Returns:
this
ClientResources.Builder
.
-
eventExecutorGroup
ClientResources.Builder eventExecutorGroup(EventExecutorGroup eventExecutorGroup)
Sets a sharedevent executor group
that can be used across different instances ofRedisClient
andRedisClusterClient
. The providedEventExecutorGroup
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.- Parameters:
eventExecutorGroup
- the shared eventExecutorGroup, must not benull
.- Returns:
this
ClientResources.Builder
.
-
eventLoopGroupProvider
ClientResources.Builder eventLoopGroupProvider(EventLoopGroupProvider eventLoopGroupProvider)
Sets a sharedevent executor provider
that can be used across different instances ofRedisClient
andRedisClusterClient
. The providedEventLoopGroupProvider
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.- Parameters:
eventLoopGroupProvider
- the shared eventLoopGroupProvider, must not benull
.- Returns:
this
ClientResources.Builder
.
-
ioThreadPoolSize
ClientResources.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). The thread pool size is only effective if noeventLoopGroupProvider
is provided.- Parameters:
ioThreadPoolSize
- the thread pool size, must be greater0
.- Returns:
this
ClientResources.Builder
.
-
nettyCustomizer
ClientResources.Builder nettyCustomizer(NettyCustomizer nettyCustomizer)
Sets theNettyCustomizer
instance to customize netty components during connection.- Parameters:
nettyCustomizer
- the netty customizer instance, must not benull
.- Returns:
- this
- Since:
- 4.4
-
reconnectDelay
ClientResources.Builder reconnectDelay(Delay reconnectDelay)
Sets the stateless reconnectDelay
to delay reconnect attempts. Defaults to binary exponential delay capped at 30 SECONDS.reconnectDelay
must be a statelessDelay
.- Parameters:
reconnectDelay
- the reconnect delay, must not benull
.- Returns:
- this
- Since:
- 4.3
-
reconnectDelay
ClientResources.Builder reconnectDelay(Supplier<Delay> reconnectDelay)
Sets the stateful reconnectSupplier
to delay reconnect attempts. Defaults to binary exponential delay capped at 30 SECONDS.- Parameters:
reconnectDelay
- the reconnect delay, must not benull
.- Returns:
- this
- Since:
- 4.3
-
socketAddressResolver
ClientResources.Builder socketAddressResolver(SocketAddressResolver socketAddressResolver)
Sets theSocketAddressResolver
that is used to resolveRedisURI
toSocketAddress
. Defaults toSocketAddressResolver
using the configuredDnsResolver
.- Parameters:
socketAddressResolver
- the socket address resolver, must not benull
.- Returns:
this
ClientResources.Builder
.- Since:
- 5.1
-
threadFactoryProvider
ClientResources.Builder threadFactoryProvider(ThreadFactoryProvider threadFactoryProvider)
Provide a defaultThreadFactoryProvider
to obtainThreadFactory
for apoolName
to create threads.Applies only to threading resources created by
ClientResources
when not configuringClientResources.timer()
,ClientResources.eventExecutorGroup()
, orClientResources.eventLoopGroupProvider()
.- Parameters:
threadFactoryProvider
- a provider to obtain aThreadFactory
for apoolName
, must not benull
.- Returns:
this
ClientResources.Builder
.- Since:
- 6.1.1
- See Also:
eventExecutorGroup(EventExecutorGroup)
,eventLoopGroupProvider(EventLoopGroupProvider)
,timer(Timer)
-
timer
ClientResources.Builder timer(Timer timer)
Sets a sharedTimer
that can be used across different instances ofRedisClient
andRedisClusterClient
The providedTimer
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.- Parameters:
timer
- the sharedTimer
, must not benull
.- Returns:
this
ClientResources.Builder
.- Since:
- 4.3
-
tracing
ClientResources.Builder tracing(Tracing tracing)
Sets theTracing
instance to trace Redis calls.- Parameters:
tracing
- the tracer infrastructure instance, must not benull
.- Returns:
- this
- Since:
- 5.1
-
build
ClientResources build()
- Returns:
- a new instance of
DefaultClientResources
.
-
-