public class Throttler
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.Traceable, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware
| Constructor and Description |
|---|
Throttler(org.apache.camel.CamelContext camelContext,
org.apache.camel.Expression maxRequestsPerPeriodExpression,
long timePeriodMillis,
ScheduledExecutorService asyncExecutor,
boolean shutdownAsyncExecutor,
boolean rejectExecution,
org.apache.camel.Expression correlation) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
int |
getCurrentMaximumRequestsPerPeriod()
Gets the current maximum request per period value.
|
String |
getId() |
org.apache.camel.Expression |
getMaximumRequestsPerPeriodExpression() |
String |
getRouteId() |
long |
getTimePeriodMillis() |
String |
getTraceLabel() |
boolean |
isAsyncDelayed() |
boolean |
isCallerRunsWhenRejected() |
boolean |
isRejectExecution() |
boolean |
process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback) |
protected boolean |
processAsynchronously(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback,
org.apache.camel.processor.Throttler.ThrottlingState throttlingState)
Delegate blocking on the DelayQueue to an asyncExecutor.
|
void |
setAsyncDelayed(boolean asyncDelayed) |
void |
setCallerRunsWhenRejected(boolean callerRunsWhenRejected) |
void |
setId(String id) |
void |
setMaximumRequestsPerPeriodExpression(org.apache.camel.Expression maxRequestsPerPeriodExpression)
Sets the maximum number of requests per time period expression
|
void |
setRejectExecution(boolean rejectExecution) |
void |
setRouteId(String routeId) |
void |
setTimePeriodMillis(long timePeriodMillis)
Sets the time period during which the maximum number of requests apply
|
String |
toString() |
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic Throttler(org.apache.camel.CamelContext camelContext,
org.apache.camel.Expression maxRequestsPerPeriodExpression,
long timePeriodMillis,
ScheduledExecutorService asyncExecutor,
boolean shutdownAsyncExecutor,
boolean rejectExecution,
org.apache.camel.Expression correlation)
public boolean process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback)
process in interface org.apache.camel.AsyncProcessorprotected boolean processAsynchronously(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback,
org.apache.camel.processor.Throttler.ThrottlingState throttlingState)
protected void doStart()
throws Exception
doStart in class org.apache.camel.support.AsyncProcessorSupportExceptionprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.AsyncProcessorSupportExceptionprotected void doShutdown()
throws Exception
doShutdown in class org.apache.camel.support.service.BaseServiceExceptionpublic boolean isRejectExecution()
public void setRejectExecution(boolean rejectExecution)
public boolean isAsyncDelayed()
public void setAsyncDelayed(boolean asyncDelayed)
public boolean isCallerRunsWhenRejected()
public void setCallerRunsWhenRejected(boolean callerRunsWhenRejected)
public String getId()
getId in interface org.apache.camel.spi.HasIdpublic void setId(String id)
setId in interface org.apache.camel.spi.IdAwarepublic String getRouteId()
getRouteId in interface org.apache.camel.spi.RouteIdAwarepublic void setRouteId(String routeId)
setRouteId in interface org.apache.camel.spi.RouteIdAwarepublic void setMaximumRequestsPerPeriodExpression(org.apache.camel.Expression maxRequestsPerPeriodExpression)
public org.apache.camel.Expression getMaximumRequestsPerPeriodExpression()
public int getCurrentMaximumRequestsPerPeriod()
public void setTimePeriodMillis(long timePeriodMillis)
public long getTimePeriodMillis()
public String getTraceLabel()
getTraceLabel in interface org.apache.camel.TraceableApache Camel