Hitachi

uCosminexus Application Server Compatibility Guide


21.2.2 Java EE functionality that you can use in the asynchronous parallel processing of threads

You can use the Java EE functionality in processes that are executed as the asynchronous parallel processing. APIs of TimerManager and WorkManager, which can use the Java EE functionality, are as follows:

TimerManager
  • TimerListener.timerExpired

    This method is executed when reaching the set up time.

  • StopTimerListener.timerStop

    This method is executed when the TimerManager.stop method is executed or when the application stops.

  • CancelTimerListener.timerCancel

    The method is executed when the TimerManager.cancel method is executed.

WorkManager
  • Work.run

    This is a processing method, which is asynchronously executed on WorkManager.

  • WorkListener.workAccepted

    This method is executed when WorkManager receives the scheduled Work.

  • WorkListener.workCompleted

    This method is executed immediately after completing the run method of the scheduled Work.

  • WorkListener.workRejected

    This method is executed when you cannot continue the schedule processing, after WorkManager receives the scheduled Work.

  • WorkListener.workStarted

    This method is executed immediately before executing the run method of the scheduled Work.

For details on APIs, see API specifications for Timer and Work Manager for Application Servers.

The following table describes the Java EE functionality that you can use in TimerManager and WorkManager.

Table 21‒2:  Java EE functionality that you can use in TimerManager and WorkManager

Functionality

Usage status

Reference location

Invoking Enterprise Bean

N

--

Naming Service

Y#

(1)

Transaction service and resource connections

Y#

(2)

Log and trace output

Y

(3)

Using container extension library

Y

(4)

Method cancellation

N

--

Legend:

Y: Can be used

N: Cannot be used

--: Not applicable

#

However, you cannot use a part of the functionality. For details on the functionality that you can use, see the information given in the Reference location column.

The following sections classify and describe the functionality that you can use with TimerManager and WorkManager. The sections also describe the points to be considered when using the functionality.

Organization of this subsection

(1) Naming Service

The following table describes whether the functionality provided as Naming Service can be used with TimerManager and WorkManager.

Table 21‒3:  Usage status of Naming Service functionality

Functionality

Usage status

Lookup of DB Connector by using JNDI

Y

Lookup of Java Mail by using JNDI

N

Lookup of JavaBeans resource by using JNDI

N

Lookup of EntityManager by using JNDI

N

Lookup of EntityManagerFactory by using JNDI

N

Lookup of TimerManager by using JNDI

N#1

Lookup of WorkManager by using JNDI

N#1

Lookup of user transaction by using JNDI

Y#2

Legend:

Y: Can be used

N: Cannot be used

#1

You cannot invoke TimerManager or WorkManager by extending the schedule of TimerManager or WorkManager.

#2

If the schedule source is an EJB that manages transactions in CMT, you cannot perform a lookup with java:comp/UserTransaction. Make sure to perform a lookup by using HITACHI_EJB/SERVERS/J2EE-server-name/SERVICES/UserTransaction.

Important note

In WorkManager or TimerManager, do not use a DB Connector or user transaction acquired at a schedule source. Make sure to acquire the executed processes in the implemented Timer Listener or Work.

(2) Transaction service and resource connections

You can only use DB Connectors for resource adapters. The following table describes the DB Connectors that you can use with TimerManager and WorkManager.

Table 21‒4:  Usage status of DB Connectors

DB Connector name

Usage status

DBConnector_HiRDB_Type4_CP.rar

Y

DBConnector_HiRDB_Type4_XA.rar

Y

DBConnector_Oracle_CP.rar

Y

DBConnector_Oracle_XA.rar

Y

DBConnector_HiRDB_Type4_CP_Cosminexus_RM.rar

N

DBConnector_HiRDB_Type4_XA_Cosminexus_RM.rar

N

DBConnector_Oracle_CP_Cosminexus_RM.rar

N

DBConnector_Oracle_XA_Cosminexus_RM.rar

N

DBConnector_CP_ClusterPool_Root.rar

N

DBConnector_Oracle_CP_ClusterPool_Member.rar

N

Legend:

Y: Can be used

N: Cannot be used

When using a DB Connector, specify NoTransaction, LocalTransaction, or XATransaction for the transaction support level. You must specify an optional name of a DB Connector to acquire the connection of the DB Connector. With a lookup by JNDI, use the specified optional name and acquire the connection of the DB Connector. For details on how to acquire the connection by using the optional name of the DB Connector, see 2.6 Assigning an optional name to Enterprise Bean or the J2EE Server (user-specified name space functionality) in the uCosminexus Application Server Common Container Functionality Guide.

The following table describes whether the functionality provided as a resource connection and transaction service can be used in TimerManager and WorkManager.

Table 21‒5:  Usage status of the transaction service functionality

Functionality

Usage status

Transaction

(user transaction)

Local transaction

Y

Global transaction

Y

Automatic conclusion of transaction#1

Δ

Transaction timeout

Y

Connection pooling

Connection pooling by using DB Connector

Y

Warm-up of connection pool

Y

Adjusting number of connections

Y

Connection sharing#2

Δ

Connection association

N

Statement pooling of DB Connector

Y

Detecting connection faults

Y

Waiting for acquiring connections when connections are exhausted

Y

Retrying acquisition of connections

Y

Automatically closing connections

N

Connection sweeper

Y

Output of SQL for examining faults

Y

Legend:

Y: Can be used

Δ: Some part of the functionality cannot be used

N: Cannot be used

#1

You must conclude the user transaction before returning from the Listener processing method. Otherwise, the transaction is rolled back even when an exception does not occur, and the message (KDJE43179-W) is output.

#2

The range of connections that you can share is only the same transaction, which is set by default.

Important note

Connections of the acquired DB Connector are not automatically closed, so make sure to set the closure of connections inside a method.

(3) Log and trace output

The following table describes whether the functionality that outputs logs and traces can be used in TimerManager and WorkManager.

Table 21‒6:  Usage status of the log and trace functionality

Functionality

Usage status

User log

Y

Performance analysis trace

Y

Legend:

Y: Can be used

Reference note

About the operation name of a performance analysis trace

With the performance analysis trace of TimerManager and WorkManager, you can acquire unique numbers for schedules. This information is output to the operation name of the trace information. For details on the trace information that you can acquire, see 8. Trace Collection Points and PRF Trace Collection Levels of the Trace Based Performance Analysis in the uCosminexus Application Server Maintenance and Migration Guide.

(4) Using container extension library

You can use the same container extension library as in the case when TimerManager and WorkManager are not used.