org.apache.catalina.valves
public class SemaphoreValve extends ValveBase implements Lifecycle
Implementation of a Valve that limits concurrency.
This Valve may be attached to any Container, depending on the granularity of the concurrency control you wish to perform.
Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $
| Field Summary | |
|---|---|
| protected boolean | block
Block until a permit is available. |
| protected int | concurrency
Concurrency level of the semaphore. |
| protected boolean | fairness
Fairness of the semaphore. |
| protected boolean | interruptible
Block interruptibly until a permit is available. |
| protected LifecycleSupport | lifecycle
The lifecycle event support for this component. |
| protected Semaphore | semaphore
Semaphore. |
| Method Summary | |
|---|---|
| void | addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component.
|
| boolean | controlConcurrency(Request request, Response response)
Subclass friendly method to add conditions. |
| LifecycleListener[] | findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
| boolean | getBlock() |
| int | getConcurrency() |
| boolean | getFairness() |
| String | getInfo()
Return descriptive information about this Valve implementation. |
| boolean | getInterruptible() |
| void | invoke(Request request, Response response)
Do concurrency control on the request using the semaphore.
|
| void | permitDenied(Request request, Response response)
Subclass friendly method to add error handling when a permit isn't granted. |
| void | removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component.
|
| void | setBlock(boolean block) |
| void | setConcurrency(int concurrency) |
| void | setFairness(boolean fairness) |
| void | setInterruptible(boolean interruptible) |
| void | start()
Prepare for the beginning of active use of the public methods of this
component. |
| void | stop()
Gracefully terminate the active use of the public methods of this
component. |
Parameters: listener The listener to add
Parameters: request The servlet request to be processed response The servlet response to be created
Throws: IOException if an input/output error occurs ServletException if a servlet error occurs
Parameters: listener The listener to add
configure(),
and before any of the public methods of the component are utilized.
Throws: LifecycleException if this component detects a fatal error that prevents this component from being used
Throws: LifecycleException if this component detects a fatal error that needs to be reported