public abstract class ThrottleableTransport extends Object implements Transport
| Modifier and Type | Class and Description |
|---|---|
static class |
ThrottleableTransport.Config |
Transport.Factory<T extends Transport>| Modifier and Type | Field and Description |
|---|---|
static String |
CK_THROTTLING_ALLOWED |
| Constructor and Description |
|---|
ThrottleableTransport(com.google.common.eventbus.EventBus eventBus,
Configuration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
blockUntilUnthrottled()
Blocks until the blockLatch is released.
|
boolean |
blockUntilUnthrottled(long timeout,
TimeUnit unit)
Blocks until the blockLatch is released or until the timeout is exceeded.
|
protected boolean |
determineIfThrottled(ThrottleState state)
This method implements the default algorithm for determining whether a transport will be throttled or not.
|
protected abstract void |
doLaunch(MessageInput input)
Performs the same purpose as
launch(org.graylog2.plugin.inputs.MessageInput) but guarantees that the superclass'
actions are performed. |
protected abstract void |
doStop()
Performs the same purpose as
stop() but guarantees that the superclass' actions are performed. |
void |
handleChangedThrottledState(boolean isThrottled)
Transports can override this to be notified when the throttled state changes.
|
boolean |
isThrottled() |
void |
launch(MessageInput input) |
void |
stop() |
void |
updateThrottleState(ThrottleState throttleState)
Only executed if the Allow Throttling checkbox is set in the input's configuration.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetricSet, setMessageAggregatorpublic static final String CK_THROTTLING_ALLOWED
public ThrottleableTransport(com.google.common.eventbus.EventBus eventBus,
Configuration configuration)
public void launch(MessageInput input) throws MisfireException
launch in interface TransportMisfireExceptionprotected abstract void doLaunch(MessageInput input) throws MisfireException
launch(org.graylog2.plugin.inputs.MessageInput) but guarantees that the superclass'
actions are performed.input - MisfireExceptionprotected abstract void doStop()
stop() but guarantees that the superclass' actions are performed.public void updateThrottleState(ThrottleState throttleState)
throttleState - current processing system statepublic void handleChangedThrottledState(boolean isThrottled)
isThrottled - the current throttled state.public boolean isThrottled()
protected boolean determineIfThrottled(ThrottleState state)
Override this method in your subclass if you need to customize the decision.
If the transport was started without the throttling_allowed flag enabled, this method will not be called!
state - the current state of the processing systempublic void blockUntilUnthrottled()
public boolean blockUntilUnthrottled(long timeout,
TimeUnit unit)
timeout - the maximum time to waitunit - the time unit for the timeout argument.true if the blockLatch was released before the timeout elapsed. and
false if the timeout was exceeded before the blockLatch was released.Copyright © 2012–2021 Graylog, Inc.. All rights reserved.