- All Known Implementing Classes:
DefaultClientResources.Builder
- Enclosing interface:
- ClientResources
public static interface ClientResources.Builder
Builder for
ClientResources.- Since:
- 5.1
-
Method Summary
Modifier and Type Method Description ClientResources.BuilderaddressResolverGroup(AddressResolverGroup<?> addressResolverGroup)Sets theAddressResolverGroupfor DNS resolution.ClientResourcesbuild()default ClientResources.BuildercommandLatencyCollector(CommandLatencyCollector commandLatencyCollector)Deprecated.ClientResources.BuildercommandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)Deprecated.since 6.0.ClientResources.BuildercommandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)Sets theEventPublisherOptionsto publish command latency metrics using theEventBusif theCommandLatencyRecorderis an instance ofCommandLatencyCollectorthat allows latency metric retrieval.ClientResources.BuildercommandLatencyRecorder(CommandLatencyRecorder latencyRecorder)Sets theCommandLatencyRecorderthat can that can be used across different instances of the RedisClient.ClientResources.BuildercomputationThreadPoolSize(int computationThreadPoolSize)Sets the thread pool size (number of threads to use) for computation operations (default value is the number of CPUs).ClientResources.BuilderdnsResolver(DnsResolver dnsResolver)Deprecated.since 6.1.ClientResources.BuildereventBus(EventBus eventBus)Sets theEventBusthat can that can be used across different instances of the RedisClient.ClientResources.BuildereventExecutorGroup(EventExecutorGroup eventExecutorGroup)Sets a sharedevent executor groupthat can be used across different instances ofRedisClientandRedisClusterClient.ClientResources.BuildereventLoopGroupProvider(EventLoopGroupProvider eventLoopGroupProvider)Sets a sharedevent executor providerthat can be used across different instances ofRedisClientandRedisClusterClient.ClientResources.BuilderioThreadPoolSize(int ioThreadPoolSize)Sets the thread pool size (number of threads to use) for I/O operations (default value is the number of CPUs).ClientResources.BuildernettyCustomizer(NettyCustomizer nettyCustomizer)Sets theNettyCustomizerinstance to customize netty components during connection.ClientResources.BuilderreconnectDelay(Delay reconnectDelay)Sets the stateless reconnectDelayto delay reconnect attempts.ClientResources.BuilderreconnectDelay(Supplier<Delay> reconnectDelay)Sets the stateful reconnectSupplierto delay reconnect attempts.ClientResources.BuildersocketAddressResolver(SocketAddressResolver socketAddressResolver)ClientResources.BuilderthreadFactoryProvider(ThreadFactoryProvider threadFactoryProvider)ClientResources.Buildertimer(Timer timer)Sets a sharedTimerthat can be used across different instances ofRedisClientandRedisClusterClientThe providedTimerinstance will not be shut down when shutting down the client resources.ClientResources.Buildertracing(Tracing tracing)Sets theTracinginstance to trace Redis calls.
-
Method Details
-
addressResolverGroup
Sets theAddressResolverGroupfor DNS resolution. This option is only effective ifDnsResolvers.UNRESOLVEDis used asDnsResolver. Defaults toDefaultAddressResolverGroup.INSTANCEif netty-dns-resolver is not available, otherwise defaults toDnsAddressResolverGroup.- Parameters:
addressResolverGroup- theAddressResolverGroupinstance, must not benull.- Returns:
thisClientResources.Builder- Since:
- 6.1
-
commandLatencyCollector
@Deprecated default ClientResources.Builder commandLatencyCollector(CommandLatencyCollector commandLatencyCollector)Deprecated.since 6.0, usecommandLatencyRecorder(CommandLatencyRecorder)instead.Sets theCommandLatencyCollectorthat can that can be used across different instances of the RedisClient.- Parameters:
commandLatencyCollector- the command latency collector, must not benull.- Returns:
thisClientResources.Builder.
-
commandLatencyRecorder
Sets theCommandLatencyRecorderthat can that can be used across different instances of the RedisClient.- Parameters:
latencyRecorder- the command latency recorder, must not benull.- Returns:
thisClientResources.Builder.- Since:
- 6.0
-
commandLatencyCollectorOptions
@Deprecated ClientResources.Builder commandLatencyCollectorOptions(CommandLatencyCollectorOptions commandLatencyCollectorOptions)Deprecated.since 6.0. ConfigureCommandLatencyRecorderdirectly usingCommandLatencyCollectorOptions.Sets theCommandLatencyCollectorOptionsthat can that can be used across different instances of the RedisClient. The options are only effective if nocommandLatencyCollectoris provided.- Parameters:
commandLatencyCollectorOptions- the command latency collector options, must not benull.- Returns:
thisClientResources.Builder.
-
commandLatencyPublisherOptions
ClientResources.Builder commandLatencyPublisherOptions(EventPublisherOptions commandLatencyPublisherOptions)Sets theEventPublisherOptionsto publish command latency metrics using theEventBusif theCommandLatencyRecorderis an instance ofCommandLatencyCollectorthat allows latency metric retrieval.- Parameters:
commandLatencyPublisherOptions- theEventPublisherOptionsto publish command latency metrics using theEventBus, must not benull.- Returns:
thisClientResources.Builder.
-
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 noeventExecutorGroupis provided.- Parameters:
computationThreadPoolSize- the thread pool size, must be greater0.- Returns:
thisClientResources.Builder.
-
dnsResolver
Deprecated.since 6.1. ConfigureAddressResolverGroupinstead.Sets theDnsResolverthat is used to resolve hostnames toInetAddress. Defaults toDnsResolvers.UNRESOLVEDto use netty'sAddressResolverGroup.- Parameters:
dnsResolver- the DNS resolver, must not benull.- Returns:
thisClientResources.Builder.- Since:
- 4.3
-
eventBus
Sets theEventBusthat can that can be used across different instances of the RedisClient.- Parameters:
eventBus- the event bus, must not benull.- Returns:
thisClientResources.Builder.
-
eventExecutorGroup
Sets a sharedevent executor groupthat can be used across different instances ofRedisClientandRedisClusterClient. The providedEventExecutorGroupinstance 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:
thisClientResources.Builder.
-
eventLoopGroupProvider
Sets a sharedevent executor providerthat can be used across different instances ofRedisClientandRedisClusterClient. The providedEventLoopGroupProviderinstance 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:
thisClientResources.Builder.
-
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 noeventLoopGroupProvideris provided.- Parameters:
ioThreadPoolSize- the thread pool size, must be greater0.- Returns:
thisClientResources.Builder.
-
nettyCustomizer
Sets theNettyCustomizerinstance to customize netty components during connection.- Parameters:
nettyCustomizer- the netty customizer instance, must not benull.- Returns:
- this
- Since:
- 4.4
-
reconnectDelay
Sets the stateless reconnectDelayto delay reconnect attempts. Defaults to binary exponential delay capped at 30 SECONDS.reconnectDelaymust be a statelessDelay.- Parameters:
reconnectDelay- the reconnect delay, must not benull.- Returns:
- this
- Since:
- 4.3
-
reconnectDelay
Sets the stateful reconnectSupplierto 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
Sets theSocketAddressResolverthat is used to resolveRedisURItoSocketAddress. Defaults toSocketAddressResolverusing the configuredDnsResolver.- Parameters:
socketAddressResolver- the socket address resolver, must not benull.- Returns:
thisClientResources.Builder.- Since:
- 5.1
-
threadFactoryProvider
Provide a defaultThreadFactoryProviderto obtainThreadFactoryfor apoolNameto create threads.Applies only to threading resources created by
ClientResourceswhen not configuringClientResources.timer(),ClientResources.eventExecutorGroup(), orClientResources.eventLoopGroupProvider().- Parameters:
threadFactoryProvider- a provider to obtain aThreadFactoryfor apoolName, must not benull.- Returns:
thisClientResources.Builder.- Since:
- 6.1.1
- See Also:
eventExecutorGroup(EventExecutorGroup),eventLoopGroupProvider(EventLoopGroupProvider),timer(Timer)
-
timer
Sets a sharedTimerthat can be used across different instances ofRedisClientandRedisClusterClientThe providedTimerinstance 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:
thisClientResources.Builder.- Since:
- 4.3
-
tracing
Sets theTracinginstance 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.
-
commandLatencyRecorder(CommandLatencyRecorder)instead.