Module lettuce.core

Interface ClientResources

All Known Implementing Classes:
DefaultClientResources

public interface ClientResources
Strategy interface to provide all the infrastructure building blocks like environment settings and thread pools so that the client can work with it properly. 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:
Since:
3.4
Author:
Mark Paluch, Mikhael Sokolov, Yohei Ueki
See Also:
DefaultClientResources
  • Method Details

    • create

      static ClientResources create()
      Create a new ClientResources using default settings.
      Returns:
      a new instance of default client resources.
    • create

      static ClientResources create​(ThreadFactoryProvider threadFactoryProvider)
      Create a new ClientResources using default settings.
      Parameters:
      threadFactoryProvider - provides a ThreadFactory to create threads.
      Returns:
      a new instance of default client resources.
      Since:
      6.1.1
    • builder

      static ClientResources.Builder builder()
      Create a new ClientResources using default settings.
      Returns:
      a new instance of a default client resources.
    • mutate

      Return a builder to create new ClientResources whose settings are replicated from the current ClientResources.
      Returns:
      a ClientResources.Builder to create new ClientResources whose settings are replicated from the current ClientResources
      Since:
      5.1
    • shutdown

      Future<Boolean> shutdown()
      Shutdown the ClientResources.
      Returns:
      eventually the success/failure of the shutdown without errors.
    • shutdown

      Future<Boolean> shutdown​(long quietPeriod, long timeout, TimeUnit timeUnit)
      Shutdown the ClientResources.
      Parameters:
      quietPeriod - the quiet period as described in the documentation
      timeout - the maximum amount of time to wait until the executor is shutdown regardless if a task was submitted during the quiet period
      timeUnit - the unit of quietPeriod and timeout
      Returns:
      eventually the success/failure of the shutdown without errors.
    • addressResolverGroup

      AddressResolverGroup<?> addressResolverGroup()
      Return the AddressResolverGroup instance for DNS resolution.
      Returns:
      the address resolver group.
      Since:
      6.1
    • commandLatencyPublisherOptions

      EventPublisherOptions commandLatencyPublisherOptions()
      Return the EventPublisherOptions for latency event publishing.
      Returns:
      the EventPublisherOptions for latency event publishing.
    • commandLatencyRecorder

      CommandLatencyRecorder commandLatencyRecorder()
      Returns:
      the command latency recorder.
      Since:
      6.0
    • computationThreadPoolSize

      int computationThreadPoolSize()
      Return the pool size (number of threads) for all computation tasks.
      Returns:
      the pool size (number of threads to use).
    • dnsResolver

      DnsResolver dnsResolver()
      Return the DnsResolver.
      Returns:
      the DNS resolver.
      Since:
      4.3
    • eventBus

      EventBus eventBus()
      Return the event bus used to publish events.
      Returns:
      the event bus
    • eventLoopGroupProvider

      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). You can use DefaultEventLoopGroupProvider as default implementation or implement an own EventLoopGroupProvider to share existing EventLoopGroup's with lettuce.
      Returns:
      the EventLoopGroupProvider which provides access to the particular event loop groups
    • eventExecutorGroup

      EventExecutorGroup eventExecutorGroup()
      Return the computation pool used for internal operations. Such tasks are periodic Redis Cluster and Redis Sentinel topology updates and scheduling of connection reconnection by ConnectionWatchdog.
      Returns:
      the computation pool used for internal operations
    • ioThreadPoolSize

      int ioThreadPoolSize()
      Return the pool size (number of threads) for IO threads. The indicated size does not reflect the number for all IO threads. TCP and socket connections (epoll) require different IO pool.
      Returns:
      the pool size (number of threads) for all IO tasks.
    • nettyCustomizer

      NettyCustomizer nettyCustomizer()
      Return the NettyCustomizer to customize netty components.
      Returns:
      the configured NettyCustomizer.
      Since:
      4.4
    • reconnectDelay

      Delay reconnectDelay()
      Return the Delay for reconnect attempts. May return a different instance on each call.
      Returns:
      the reconnect Delay.
      Since:
      4.3
    • socketAddressResolver

      SocketAddressResolver socketAddressResolver()
      Returns:
      the socket address resolver.
      Since:
      5.1
    • timer

      Timer timer()
      Return the 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().
      Returns:
      the timer.
      Since:
      4.3
    • tracing

      Tracing tracing()
      Return the Tracing instance to support tracing of Redis commands.
      Returns:
      the configured Tracing.
      Since:
      5.1