public static final class AbstractMessageHandler.WaitQueue
extends java.lang.Object
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
ReactivateHandlers
task will be scheduled per event loop, on the corresponding
event loops.
When run, the 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()
, ReactivateHandlers#run()
, Ticket#reactivateHandler(Limit)
.Modifier and Type | Method and Description |
---|---|
static AbstractMessageHandler.WaitQueue |
endpoint(ResourceLimits.Limit endpointReserveCapacity) |
static AbstractMessageHandler.WaitQueue |
global(ResourceLimits.Limit globalReserveCapacity) |
void |
signal() |
public static AbstractMessageHandler.WaitQueue endpoint(ResourceLimits.Limit endpointReserveCapacity)
public static AbstractMessageHandler.WaitQueue global(ResourceLimits.Limit globalReserveCapacity)
public void signal()
Copyright © 2009-2021 The Apache Software Foundation