Hitachi

uCosminexus Application Server Expansion Guide


2.9.2 Processing flow of GC control

GC control is processed as shown in the following figure.

Figure 2‒15: Processing flow of GC control

[Figure]

  1. Monitoring memory

    Monitoring timer thread monitors memory of JavaVM. The GC control functionality is requested to perform GC when certain conditions are met. For the conditions, see section (1) shown later.

  2. Checking resource exclusion

    When requested to perform GC, the GC control functionality checks whether excluded resources exist.

  3. Placing Full GC in a wait state

    Full GC is placed in a wait state while resources are excluded.

  4. Performing Full GC

    When the resources are not excluded, Full GC starts.

The following subsections describe each process:

Organization of this subsection

(1) Monitoring memory

The monitoring timer thread monitors the memory used by the Java VM and, when any of the following conditions are met, requests the GC control functionality to perform GC:

If serial GC is enabled:
  • Size of the used Tenured area / Size of the entire Tenured area × 100 ≥ GC control threshold value

  • Size of the entire New area / Maximum size of free Tenured area × 100 ≥ GC control threshold value

  • Size of the used Metaspace area / Maximum size of the Metaspace area × 100 ≥ GC control threshold value

If G1 GC is enabled:
  • Size of the used Java heap area / Size of the entire Java heap area × 100 ≥ GC control threshold value

  • Size of the used Metaspace area / Maximum size of the Metaspace area × 100 ≥ GC control threshold value

(2) Checking resource exclusion

When requested to perform GC, the GC control functionality runs a check on the connections used by the batch application. When checking the connections, the functionality confirms whether the batch application is performing resource exclusion.

The following table describes states considered as the resources are in exclusion.

Table 2‒28: States considered as resource is under exclusion

Transaction

State

DB Connector

JDBC

Out of transaction

Executing SQL statement#1

  • When executing java.sql.Statement#execute

  • When executing java.sql.Statement#executeUpdate

  • When executing java.sql.Statement#executeQuery

  • When executing java.sql.Statement#executeBatch

Y

N

Performing operations for ResultSet

  • When executing java.sql.ResultSet#deleteRow

  • When executing java.sql.ResultSet#insertRow

  • When executing java.sql.ResultSet#updateRow

Y

N

Performing operation such as object acquisition#1

  • When executing java.sql.Statement#addBatch

  • When executing java.sql.Connection#prepareCall

  • When executing java.sql.Connection#prepareStatement

Y

N

During transaction

  • When executing transaction with Connection API#2

  • When executing local transaction (JTA)#2.

Y

N

When executing global transaction (JTA)

--

--

Legend: Y: Handled as resource under exclusion

N: Handled as resource not under exclusion

--: Not applicable

#1: java.sql.Statement in the table -includes sub-interfaces java.sql.PreparedStatement and java.sql.CallableStatement.

#2: Shows a status after starting a transaction (after executing setAutoCommit(false) or UserTransaction.begin), in which execution of SQL statement or operation for ResultSet is performed one or more times, and transaction conclusion processing is not complete.

Resource operations performed by using JDBC are handled as no resource exclusion. For example, if you execute a program that includes execution of SQL statements for JDBC and transaction processing in DB Connector, only the transaction processing in DB Connector is subject to GC control.

(3) Placing Full GC in a wait state

If the functionality judges that excluded resources exist, it outputs the KDJE55024-I message and places Full GC in a wait state. Full GC continues to wait while there is at least one excluded resource. The following figure shows an example case where Full GC is placed in a wait state.

Figure 2‒16: Example case where Full GC is placed in a wait state

[Figure]

In this figure, two resources are accessed in a single job program. If the GC control functionality is requested to perform Full GC while resources are excluded, the functionality places Full GC in a wait state. When con2.commit() that ends the access of two resources is executed, the exclusion is removed.

(4) Performing GC

When no resources are excluded, the functionality performs Full GC.

(5) Notes