public class Throttler extends DelayProcessorSupport implements Traceable
Modifier and Type | Class and Description |
---|---|
protected class |
Throttler.TimeSlot |
log
processor
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
Throttler(CamelContext camelContext,
Processor processor,
Expression maxRequestsPerPeriodExpression,
long timePeriodMillis,
ScheduledExecutorService executorService,
boolean shutdownExecutorService,
boolean rejectExecution) |
Modifier and Type | Method and Description |
---|---|
protected long |
calculateDelay(Exchange exchange) |
long |
getCurrentMaximumRequestsPerPeriod()
Gets the current maximum request per period value.
|
Expression |
getMaximumRequestsPerPeriodExpression() |
long |
getTimePeriodMillis() |
String |
getTraceLabel()
Gets the trace label used for logging when tracing is enabled.
|
boolean |
isRejectExecution() |
protected Throttler.TimeSlot |
nextSlot() |
protected boolean |
processDelay(Exchange exchange,
AsyncCallback callback,
long delay) |
void |
setMaximumRequestsPerPeriodExpression(Expression maxRequestsPerPeriodExpression)
Sets the maximum number of requests per time period expression
|
void |
setRejectExecution(boolean rejectExecution) |
void |
setTimePeriodMillis(long timePeriodMillis)
Sets the time period during which the maximum number of requests apply
|
String |
toString() |
currentSystemTime, delay, doShutdown, doStart, getDelayedCount, handleSleepInterruptedException, isAsyncDelayed, isCallerRunsWhenRejected, process, setAsyncDelayed, setCallerRunsWhenRejected
doStop, getProcessor, hasNext, next, process, processNext, setProcessor, setProcessor
doResume, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public Throttler(CamelContext camelContext, Processor processor, Expression maxRequestsPerPeriodExpression, long timePeriodMillis, ScheduledExecutorService executorService, boolean shutdownExecutorService, boolean rejectExecution)
public String toString()
toString
in class DelegateAsyncProcessor
public String getTraceLabel()
Traceable
getTraceLabel
in interface Traceable
public void setMaximumRequestsPerPeriodExpression(Expression maxRequestsPerPeriodExpression)
public Expression getMaximumRequestsPerPeriodExpression()
public long getTimePeriodMillis()
public long getCurrentMaximumRequestsPerPeriod()
public void setTimePeriodMillis(long timePeriodMillis)
protected long calculateDelay(Exchange exchange)
calculateDelay
in class DelayProcessorSupport
protected Throttler.TimeSlot nextSlot()
public boolean isRejectExecution()
public void setRejectExecution(boolean rejectExecution)
protected boolean processDelay(Exchange exchange, AsyncCallback callback, long delay)
processDelay
in class DelayProcessorSupport
Apache Camel