Class RedisExecutors
java.lang.Object
net.swofty.redisapi.api.RedisExecutors
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 Summary
Modifier and TypeMethodDescriptionstatic ExecutorServiceStages of the futures handed out byDataRequestandpublishMessage.static ExecutorServicedispatchFor(String channelName) The single-threaded stripe a channel's messages are handled on.static ExecutorServicehandlers()DataRequestRespondercallbacks, which may block on IO.static ExecutorServiceinbound()Envelope work for the internal data request channel, which never blocks.static ExecutorServiceOutbound publishes.static voidshutdown()Stops accepting new work on the current pools and lets queued work drain.
-
Method Details
-
dispatchFor
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
Envelope work for the internal data request channel, which never blocks. -
handlers
DataRequestRespondercallbacks, which may block on IO. -
completions
Stages of the futures handed out byDataRequestandpublishMessage. -
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.
-