|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tenduke.lifecycle.LifecycleManager
public final class LifecycleManager
Initialization and shutdown procedures for a 10Duke SDK based application.
Lifecycle manager is responsible for essential initialization procedures that are to happen
before SDK classes and static methods are used. Although some static methods can be used without
calling beginLifecycle() first, it is advisable to do so except for the methods listed below.
Things you can set before calling beginLifecycle()
Configuration.
ClassScanner if optimizing serializable class loading is required.
SchemeHandlers class.
If the above values are not explicitly set, consult the documentation for each class about how their default values are obtained.
When the application no longer needs 10Duke SDK, call endLifecycle() to free system resources.
Usually the application lifecycle coincides with the 10Duke SDK life cycle, but this is not mandatory.
| Method Summary | |
|---|---|
void |
attach(Observer<LifecycleEvent> observer)
Attach observer for lifecycle events. |
void |
beginLifecycle()
Begin 10Duke SDK life cycle with default configuration seach. |
void |
beginLifecycleCore()
Begin 10Duke SDK life cycle without initialization. |
void |
detach(Observer<LifecycleEvent> observer)
Detach observer for lifecycle events. |
void |
endLifecycle()
End 10Duke SDK life cycle. |
LifecycleState |
getLifecycleState()
Get the lifecycle state. |
ServiceManager |
getServiceManager()
Return the service manager instance that is exposed to external users like jsp. |
static LifecycleManager |
instance()
Return the application instance that is exposed to external users like jsp. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void attach(Observer<LifecycleEvent> observer)
attach in interface Subject<LifecycleEvent>observer - Observer to be attached.
public void beginLifecycle()
throws java.lang.Throwable
Begin 10Duke SDK life cycle with default configuration seach.
First initializes the scan path, logs some useful info and initializes the main configuraiton, i.e,
Configuration.logLocationInformation() to log useful information.
Configuration.initializeConfiguration() to read the main configuration. If you wish to use custom
root and main URIs, set them before calling beginLifecycle() method.
After this, the beginLifecycleCore() is called, which performs the following
(events are of type LifecycleEvent):
APPLICATION_START event to observers.
PRE_PLATFORM_START event to observers.
SerializableObjectFactory.loadAllSerializableClasses().
ReportingClientInitializer.initialize().
POST_PLATFORM_START event to observers.
PRE_SERVICES_START event to observers.
ServiceManager and call ServiceManager.initializeServiceManager() on it.
All dynamically loadable services listed in the main configuration are created.
startService() method on each Service just created. Services are started in the
order in the main configuration file.
POST_SERVICES_START event to observers.
APPLICATION_STARTED event to observers
LifecycleState to LIFECYCLE_ACTIVE or LIFECYCLE_CORRUPTED depending
whether the startup was successful or not, correspondingly. The life cycle state can be checked with
getLifecycleState() method.
java.lang.Throwable - If error occurred while beginning application life cycle.
public void beginLifecycleCore()
throws java.lang.Throwable
Begin 10Duke SDK life cycle without initialization.
This is documented as part of the beginLifecycle() method.
java.lang.Throwable - If error occurred while beginning application life cycle.public void detach(Observer<LifecycleEvent> observer)
detach in interface Subject<LifecycleEvent>observer - Observer to be detached.public void endLifecycle()
End 10Duke SDK life cycle.
Ending sequence is the inverse of begin (events are of type LifecycleEvent):
APPLICATION_STOP event to observers.
PRE_SERVICES_STOP event to observers.
stopService() on each loaded service. Services are stopped in reverse startup order.
POST_SERVICES_STOP event to observers.
PRE_PLATFORM_STOP event to observers.
POST_PLATFORM_STOP event to observers.
APPLICATION_STOPPED event to observers.
LifecycleState to LIFECYCLE_ENDED or LIFECYCLE_ENDED_WITH_ERRORS depending
whether the shutdown was successful or not, correspondingly. The life cycle state can be checked with
getLifecycleState() method.
public LifecycleState getLifecycleState()
beginLifecycle()
the lifecycle state is LifecycleState.LIFECYCLE_UNDEFINED.
public ServiceManager getServiceManager()
public static LifecycleManager instance()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||