public class IoEventQueueThrottle extends java.lang.Object implements IoEventQueueHandler
| Modifier and Type | Field and Description |
|---|---|
private java.util.concurrent.atomic.AtomicInteger |
counter |
private IoEventSizeEstimator |
eventSizeEstimator
The event size estimator instance
|
private java.lang.Object |
lock |
private static org.slf4j.Logger |
LOGGER
A logger for this class
|
private int |
threshold |
private int |
waiters |
NOOP| Constructor and Description |
|---|
IoEventQueueThrottle() |
IoEventQueueThrottle(int threshold) |
IoEventQueueThrottle(IoEventSizeEstimator eventSizeEstimator,
int threshold) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(java.lang.Object source,
IoEvent event)
Returns true if and only if the specified event is
allowed to be offered to the event queue.
|
protected void |
block() |
private int |
estimateSize(IoEvent event) |
int |
getCounter() |
IoEventSizeEstimator |
getEventSizeEstimator() |
int |
getThreshold() |
private void |
logState() |
void |
offered(java.lang.Object source,
IoEvent event)
Invoked after the specified event has been offered to the
event queue.
|
void |
polled(java.lang.Object source,
IoEvent event)
Invoked after the specified event has been polled from the
event queue.
|
void |
setThreshold(int threshold) |
protected void |
unblock() |
private static final org.slf4j.Logger LOGGER
private final IoEventSizeEstimator eventSizeEstimator
private volatile int threshold
private final java.lang.Object lock
private final java.util.concurrent.atomic.AtomicInteger counter
private int waiters
public IoEventQueueThrottle()
public IoEventQueueThrottle(int threshold)
public IoEventQueueThrottle(IoEventSizeEstimator eventSizeEstimator, int threshold)
public IoEventSizeEstimator getEventSizeEstimator()
public int getThreshold()
public int getCounter()
public void setThreshold(int threshold)
public boolean accept(java.lang.Object source,
IoEvent event)
IoEventQueueHandleraccept in interface IoEventQueueHandlerpublic void offered(java.lang.Object source,
IoEvent event)
IoEventQueueHandleroffered in interface IoEventQueueHandlerpublic void polled(java.lang.Object source,
IoEvent event)
IoEventQueueHandlerpolled in interface IoEventQueueHandlerprivate int estimateSize(IoEvent event)
private void logState()
protected void block()
protected void unblock()