public class NullLifeCycle extends Object implements LifeCycle
If more are overloaded, it is recommended just to implement LifeCycle.
This only works, though, if the Object doesn't need to extend something else, due to Java's Single Extension policy. In other cases, just implement LifeCycle, and leave them empty.
| Constructor and Description |
|---|
NullLifeCycle() |
| 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.
|
public void servicePrestart(Env env) throws APIException
LifeCycle
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.
servicePrestart in interface LifeCycleAPIExceptionpublic void threadPrestart(Env env) throws APIException
LifeCycle
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.
threadPrestart in interface LifeCycleAPIExceptionpublic void refresh(Env env) throws APIException
LifeCycleThis 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.refresh in interface LifeCycleAPIExceptionpublic void threadDestroy(Env env) throws APIException
LifeCyclethreadDestroy in interface LifeCycleAPIExceptionpublic void serviceDestroy(Env env) throws APIException
LifeCycleserviceDestroy in interface LifeCycleAPIExceptionCopyright © 2017. All rights reserved.