public abstract class LimitService extends AbstractContexed implements AppContextService<LimitService>
AppContextService
that can be used to poll for high resource usage
in a request and throw an exception to terminate the request.
The application code needs to explicitlyconn
Constructor and Description |
---|
LimitService(AppContext conn) |
Modifier and Type | Method and Description |
---|---|
abstract void |
checkLimit()
Estimate the resources used by this request and throw a
LimitException
if these exceed a reasonable value for an interactive page. |
void |
cleanup()
AppContext is being closed. |
java.lang.Class<? super LimitService> |
getType()
Returns the type of service the class should be registered under.
|
getContext, getLogger, resetLogger
public LimitService(AppContext conn)
public abstract void checkLimit() throws LimitException
LimitException
if these exceed a reasonable value for an interactive page.
In practice this will be the time since the start of the request and the increase of global memory consumption
since the start of the requestLimitException
public void cleanup()
AppContextCleanup
AppContext
is being closed.
Only use this for cleanup that can't be handled by
normal garbage collection or for state which is never returned by reference.cleanup
in interface AppContextCleanup
public final java.lang.Class<? super LimitService> getType()
AppContextService
getType
in interface AppContextService<LimitService>