Package org.apache.cassandra.net
Class AbstractMessageHandler.WaitQueue
- java.lang.Object
-
- org.apache.cassandra.net.AbstractMessageHandler.WaitQueue
-
- Enclosing class:
- AbstractMessageHandler
public static final class AbstractMessageHandler.WaitQueue extends java.lang.Object
A special-purpose wait queue to park inbound message handlers that failed to allocate reserve capacity for a message in. Upon such failure a handler registers itself with aAbstractMessageHandler.WaitQueue
of the appropriate kind (either ENDPOINT or GLOBAL - if failed to allocate endpoint or global reserve capacity, respectively), stops processing any accumulated frames or receiving new ones, and waits - until reactivated. Every time permits are returned to an endpoint or globalResourceLimits.Limit
, the respective queue gets signalled, and if there are any handlers registered in it, we will attempt to reactivate as many waiting handlers as current available reserve capacity allows us to - immediately, on thesignal()
-calling thread. At most one such attempt will be in progress at any given time. Handlers that can be reactivated will be grouped by theirEventLoop
and a singleAbstractMessageHandler.WaitQueue.ReactivateHandlers
task will be scheduled per event loop, on the corresponding event loops. When run, theAbstractMessageHandler.WaitQueue.ReactivateHandlers
task will ask each handler in its group to first process one message - using preallocated reserve capacity - and if no obstacles were met - reactivate the handlers, this time using their regular reserves. Seeschedule()
,AbstractMessageHandler.WaitQueue.ReactivateHandlers.run()
,AbstractMessageHandler.WaitQueue.Ticket.reactivateHandler(Limit)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AbstractMessageHandler.WaitQueue
endpoint(ResourceLimits.Limit endpointReserveCapacity)
static AbstractMessageHandler.WaitQueue
global(ResourceLimits.Limit globalReserveCapacity)
void
signal()
-
-
-
Method Detail
-
endpoint
public static AbstractMessageHandler.WaitQueue endpoint(ResourceLimits.Limit endpointReserveCapacity)
-
global
public static AbstractMessageHandler.WaitQueue global(ResourceLimits.Limit globalReserveCapacity)
-
signal
public void signal()
-
-