public class CleanupService extends AbstractContexed implements AppContextService<CleanupService>
CleanupService
implements deferred actions to be performed later (usually when the AppContext
is closed.
When running from a servlet this usually triggers the close to be performed in a background
thread so as not to delay the browser.conn| Constructor and Description |
|---|
CleanupService(AppContext conn) |
| Modifier and Type | Method and Description |
|---|---|
void |
action()
action to be performed.
|
void |
action(java.lang.Class template) |
void |
add(java.lang.Runnable r)
Add a
Runnable to the set of actions performed on cleanup. |
void |
cleanup()
AppContext is being closed. |
java.util.LinkedHashSet<java.lang.Runnable> |
getActions() |
java.lang.Class<? super CleanupService> |
getType()
Returns the type of service the class should be registered under.
|
boolean |
hasActions() |
void |
reset() |
getContext, getLogger, resetLoggerpublic CleanupService(AppContext conn)
public void add(java.lang.Runnable r)
Runnable to the set of actions performed on cleanup.
The runnable object should implement Object.hashCode() and Object.equals(Object) so identical
actions are not run twice.
The class should also be annotated with PreRequisiteService if they use an AppContextService.r - public final void cleanup()
AppContextCleanupAppContext 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 AppContextCleanuppublic void action()
public void action(java.lang.Class template)
public boolean hasActions()
public void reset()
public java.util.LinkedHashSet<java.lang.Runnable> getActions()
public final java.lang.Class<? super CleanupService> getType()
AppContextServicegetType in interface AppContextService<CleanupService>