|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.util.ConcurrencyThrottleSupport
public abstract class ConcurrencyThrottleSupport
Support class for throttling concurrent access to a specific resource.
Designed for use as a base class, with the subclass invoking the
beforeAccess
and afterAccess
methods at
appropriate points of its workflow. Note that afterAccess
should usually be called in a finally block!.
This class is designed for serializablility, to allow for serializing interceptors that derive from it. Note that the subclass needs to explicitly implement the Serializable marker interface if it is actually serializable.
setConcurrencyLimit(int)
,
beforeAccess()
,
afterAccess()
,
ConcurrencyThrottleInterceptor
,
Serializable
,
Serialized FormField Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
Transient to optimize serialization |
Constructor Summary | |
---|---|
ConcurrencyThrottleSupport()
|
Method Summary | |
---|---|
protected void |
afterAccess()
To be invoked after the main execution logic of concrete subclasses. |
protected void |
beforeAccess()
|
int |
getConcurrencyLimit()
Return the maximum number of parallel accesses allowed. |
boolean |
isThrottleActive()
Return whether this throttle is currently active. |
void |
setConcurrencyLimit(int concurrencyLimit)
Set the maximum number of parallel accesses allowed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient org.apache.commons.logging.Log logger
Constructor Detail |
---|
public ConcurrencyThrottleSupport()
Method Detail |
---|
public void setConcurrencyLimit(int concurrencyLimit)
This limit can in principle be changed at runtime, although it is generally designed as config time setting. NOTE: Do not switch between -1 and any concrete limit at runtime, as this will lead to inconsistent concurrency counts: A limit of -1 effectively turns off concurrency counting completely.
public int getConcurrencyLimit()
public boolean isThrottleActive()
protected void beforeAccess()
protected void afterAccess()
beforeAccess()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |