Hitachi

uCosminexus Application Server Compatibility Guide


21.4.3 Life cycle of WorkManager, daemon Work and non-daemon Work

This section describes the life cycle of WorkManager, the daemon Work and the non-daemon Work.

Organization of this subsection

(1) Life cycle of WorkManager

WorkManager is created when an application starts. When lookup is performed in an application, WorkManager, created when the application starts, is returned. The same WorkManager, created when the application starts, is invoked even if lookup is performed for multiple times. WorkManager is destroyed when the application stops.

WorkManager is not persisted. As a result, when JavaVM ends, created WorkManager and the scheduled asynchronous process are destroyed.

The following figure shows the life cycle of WorkManager.

Figure 21‒7:  Life cycle of WorkManager

[Figure]

(2) Life cycle of daemon Work

A daemon Work is created when you execute the schedule method. The daemon Work is destroyed when you stop WorkManager (when you stop the applications corresponding to WorkManager). When you stop WorkManager, WorkManager waits until all daemon Work end after executing the release method of the daemon Work.

The following figure shows the life cycle of the daemon Work.

Figure 21‒8:  Life cycle of the daemon Work

[Figure]

(3) Life cycle of the non-daemon Work

A non-daemon Work is created when you execute the schedule method. The non-daemon Work ends when processing of the run method ends. If you want to stop WorkManager (stop the corresponding applications) when non-daemon Work is being executed or is pending in a queue, wait until the non-daemon Work stops and then end WorkManager.

The following figure shows the life cycle of the non-daemon Work.

Figure 21‒9:  Life cycle of non-daemon Work

[Figure]