public interface LifeCycle
| Modifier and Type | Method and Description |
|---|---|
void |
refresh(Env env)
The Service will call this when (service-defined) configurations change.
|
void |
serviceDestroy(Env env)
Parallel to servicePrestart, serviceDestroy tells the implementor that
the service is ending, and to take this opportunity to close out any
content under it's control that can or should be closed explicitly.
|
void |
servicePrestart(Env env)
The Service using LifeCycle Elements is required to call this method at
the appropriate startup time.
|
void |
threadDestroy(Env env)
Parallel to threadPrestart, threadDestroy tells the implementor that the
service is ending this particular thread, and to take this opportunity to
close out any content specific to this thread that can be closed.
|
void |
threadPrestart(Env env)
Many cases of implementations are not thread safe, and mechanisms must be
derived to accomodate them by holding per Thread.
|
void servicePrestart(Env env) throws APIException
An excellent use is to establish security credentials with a backend
after appropriate configurations have been read and available as part of
the Env Object.
env - APIExceptionvoid threadPrestart(Env env) throws APIException
ThreadLocal is a valuable resource, but start up times within the
thread, depending on what it is, can be substantial.
Use ThreadPrestart to do all that is possible before actually performing work, i.e. inside of a client transaction.
env - APIExceptionvoid refresh(Env env) throws APIException
This mechanism allows the Service to recognize events, such as file changes, and pass on the event to all LifeCycle implementors.
The code should take the opportunity to evaluate configuration and change as necessary.
RefreshableThreadObject, because it implements LifeCycle, and
responds to the refresh command.env - APIExceptionvoid threadDestroy(Env env) throws APIException
env - APIExceptionvoid serviceDestroy(Env env) throws APIException
APIExceptionCopyright © 2017. All rights reserved.