Class RedisExecutors

java.lang.Object
net.swofty.redisapi.api.RedisExecutors

@Internal public final class RedisExecutors extends Object
Owns every worker thread the Redis layer uses. Queues are bounded and threads are named daemons that exit after a minute idle. A pool that is saturated or already shut down never discards work: the task runs on the thread that submitted it instead, so overload degrades into back-pressure rather than silent loss.

Pools are created lazily on first use and torn down by RedisAPI.shutdown(). An instance generated after that simply gets a fresh set on its first use.

  • Method Details

    • dispatchFor

      public static ExecutorService dispatchFor(String channelName)
      The single-threaded stripe a channel's messages are handled on. Every message for a given channel lands on the same stripe, which keeps per-channel FIFO ordering without serialising every channel behind each other.
      Parameters:
      channelName - the name of the channel the message arrived on
      Returns:
      the executor that channel's handlers run on
    • inbound

      public static ExecutorService inbound()
      Envelope work for the internal data request channel, which never blocks.
    • handlers

      public static ExecutorService handlers()
      DataRequestResponder callbacks, which may block on IO.
    • completions

      public static ExecutorService completions()
      Stages of the futures handed out by DataRequest and publishMessage.
    • publisher

      public static ExecutorService publisher()
      Outbound publishes.
    • shutdown

      public static void shutdown()
      Stops accepting new work on the current pools and lets queued work drain. Anything submitted afterwards runs on the submitting thread until a later call creates fresh pools.