Package org.apache.cassandra.net
Class AbstractMessageHandler.WaitQueue
java.lang.Object
org.apache.cassandra.net.AbstractMessageHandler.WaitQueue
- Enclosing class:
- AbstractMessageHandler
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
a
AbstractMessageHandler.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 global ResourceLimits.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 the signal()-calling thread. At most one such attempt
will be in progress at any given time.
Handlers that can be reactivated will be grouped by their EventLoop and a single
AbstractMessageHandler.WaitQueue.ReactivateHandlers task will be scheduled per event loop, on the corresponding
event loops.
When run, the AbstractMessageHandler.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.
See schedule(), Runnable.run(), AbstractMessageHandler.WaitQueue.Ticket.reactivateHandler(Limit).-
Method Summary
Modifier and TypeMethodDescriptionendpoint(ResourceLimits.Limit endpointReserveCapacity) global(ResourceLimits.Limit globalReserveCapacity) voidsignal()
-
Method Details
-
endpoint
public static AbstractMessageHandler.WaitQueue endpoint(ResourceLimits.Limit endpointReserveCapacity) -
global
-
signal
public void signal()
-