Class ThrottleInterceptor
java.lang.Object
com.predic8.membrane.core.interceptor.AbstractInterceptor
com.predic8.membrane.core.interceptor.ThrottleInterceptor
- All Implemented Interfaces:
Interceptor
- Description
The throttle feature can slow down traffic to thwart denial of service attacks.
- Topic
- 6. Security
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.predic8.membrane.core.interceptor.Interceptor
Interceptor.Flow -
Field Summary
Fields inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
name, router -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintlonggetDelay()intvoidhandleAbort(Exchange exchange) Called when anyInterceptor.handleRequest(Exchange)orInterceptor.handleResponse(Exchange)later in the chain returnedOutcome.ABORTor threw an exception.handleRequest(Exchange exc) handleResponse(Exchange exc) voidsetBusyDelay(int busyDelay) voidsetDelay(long delay) voidsetMaxThreads(int maxThreads) Methods inherited from class com.predic8.membrane.core.interceptor.AbstractInterceptor
getDisplayName, getFlow, getHelpId, getMessage, getRouter, getRule, init, init, setDisplayName, setFlow
-
Constructor Details
-
ThrottleInterceptor
public ThrottleInterceptor()
-
-
Method Details
-
handleRequest
- Specified by:
handleRequestin interfaceInterceptor- Overrides:
handleRequestin classAbstractInterceptor- Throws:
Exception
-
handleResponse
- Specified by:
handleResponsein interfaceInterceptor- Overrides:
handleResponsein classAbstractInterceptor- Throws:
Exception
-
handleAbort
Description copied from interface:InterceptorCalled when anyInterceptor.handleRequest(Exchange)orInterceptor.handleResponse(Exchange)later in the chain returnedOutcome.ABORTor threw an exception.handleAbort is called in the reverse order of the chain (as handleResponse is).
- Specified by:
handleAbortin interfaceInterceptor- Overrides:
handleAbortin classAbstractInterceptor
-
getDelay
public long getDelay() -
setDelay
public void setDelay(long delay) - Default
- 0
- Description
- If non-zero, delays requests by specified number of milliseconds.
- Example
- 1000
-
getMaxThreads
public int getMaxThreads() -
setMaxThreads
public void setMaxThreads(int maxThreads) - Default
- 0
- Description
- If non-zero, newly incoming request are aborted if the number of running requests has reached this limit.
- Example
- 5
-
getBusyDelay
public int getBusyDelay() -
setBusyDelay
public void setBusyDelay(int busyDelay) - Default
- 0
- Description
- If a newly incoming request exceeds maxThreads, the interceptor waits the specified number in milliseconds and retries once before aborting the request.
- Example
- 3000
-
getShortDescription
- Specified by:
getShortDescriptionin interfaceInterceptor- Overrides:
getShortDescriptionin classAbstractInterceptor
-
getLongDescription
- Specified by:
getLongDescriptionin interfaceInterceptor- Overrides:
getLongDescriptionin classAbstractInterceptor
-