Hitachi

uCosminexus Application Server Compatibility Guide


20.1.4 Connection pool clustering operations

This section describes the available functionality and operations when a connection pool is clustered. You can execute the following functionality with a clustered connection pool:

This section also describes the connection pool states and how to select a connection pool when a connection request is received.

Organization of this subsection

(1) Suspending a connection pool

You can block and suspend a member connection pool. If you execute suspend, a member connection pool is blocked and suspended.

When a J2EE application sends a connection request to the root resource adapter, no connection request is sent to a blocked or suspended member connection pool.

You suspend the member connection pool in the following cases:

Note that the suspension methods include the following two methods:

(a) Auto-suspension

You can automatically suspend the member connection pool when a database node error occurs. When an error is detected, the member connection pool is automatically blocked and then suspended.

If the following events occur when a connection is obtained, a database node error is determined, and the member connection pool is automatically suspended:

  • When a timeout occurs during the detection of the connection errors while a connection is being obtained

  • When a physical connection cannot be obtained

  • When the obtaining of a physical connection times out

  • When the connection management threads deplete

This functionality is enabled by default. Specify the settings for enabling or disabling this functionality as a root resource adapter property. For details on the resource adapter settings, see 5.4 Defining resource adapter properties in the uCosminexus Application Server Application Setup Guide.

(b) Manual suspension

When you perform operations such as database node maintenance, you execute the cjsuspendpool command to manually suspend a connection pool. You can execute manual suspension when the status of a member connection pool is Start, Reserved Start, Auto-suspend, and Reserved Auto-suspend. If you execute the cjsuspendpool command when the member connection pool is in an auto-suspension state, the status changes to manual suspension. Due to this, you can execute operations so that the member connection pool is not restarted automatically after auto-suspension. For details on the manual suspension procedure, see 20.1.5(2) Suspending the connection pool. For command details, see cjsuspendpool (suspend member connection pool).

Important note

A connection pool that is suspended manually with the cjsuspendpool command is not restarted automatically. Restart the connection pool manually.

(2) Restarting a connection pool

You can restart a suspended member connection pool. When the J2EE application makes a connection request to the root resource adapter, the connection requests are now sent to the restarted member connection pool again.

Note that to restart a connection pool, the number of unused connection management threads must be equal to or more than the maximum number of connections in the connection pool.

You restart the connection pool in the following cases:

The restart methods include the following two methods:

(a) Auto-restart

You can automatically restart an auto-suspended member connection pool.

The auto-suspended member connection pool sends a physical connection request at regular intervals to check the state of the database node. At this time, if a connection is obtained successfully, the database node is determined to have recovered, and the restart processing is performed automatically. Also, if you do not want to automatically restart an auto-suspended member connection pool, manually suspend the member connection pool after the pool is suspended automatically. To restart the pool, use manual restart.

Note that if the root resource adapter is stopped, the auto-restart processing is not performed. However, if you stop the root resource adapter while the member connection pool is auto-restarting, the running auto-restart processing is continued.

This functionality is enabled by default. Specify the settings for switching between enabling and disabling and for the interval to check the database node state as the root resource adapter properties. For details on the resource adapter settings, see 5.4 Defining resource adapter properties in the uCosminexus Application Server Application Setup Guide.

(b) Manual restart

You can manually restart an auto-suspended or manually suspended connection pool. To restart manually, use the cjresumepool command. You can execute manual restart when the status of the connection pool is as follows:

  • Auto-suspension

  • Manual suspension

  • Reserved auto-suspension

  • Reserved manual suspension

For details on the manual restart procedure, see 20.1.5(3) Restarting the connection pool. For the command details, see cjresumepool (restart member connection pool).

(3) States of the connection pool

A connection pool state only exists for the member connection pools. Note that the connection pool state is maintained even after you restart the J2EE server and resource adapter.

You can check the state of the member connection pool with the following methods. When you execute manual suspension or manual restart, check the connection pool state before you execute the commands.

This section describes the states of the member connection pools.

The state of the member connection pool is maintained even if you restart the J2EE server and member resource adapter. For the procedure for checking the connection pool states, see 20.1.5(1) Checking the connection pool state.

Note that the connection pools other than those for the member resource adapters do not have a state.

(a) Transition of the connection pool state

The following figure shows the transition of the member connection pool state.

Figure 20‒4: Transition of the member connection pool state (when the pool is suspended manually)

[Figure]

Figure 20‒5: Transition of the member connection pool state (when the pool is suspended automatically)

[Figure]

Note that when the J2EE server starts, if the status of the connection pool is Resuming or Blocked, the connection pool status transits to Suspended.

The following table describes each status.

Table 20‒5: Status of the member connection pools

No.

Status

Status displayed in the message

Explanation

1

Start status

running

A state in which the connection pool receives processing. When a connection request is made to the root resource adapter, the processing is only performed for a started connection pool.

2

Reserved Start status

runningReserved

A state in which the resource adapter is stopped when the connection pool has the Start status. The status of a connection pool with the Reserved Start status changes to the Start status when you start the resource adapter. This status is reached immediately after the resource adapter is deployed.

3

Auto-restarting status

resumingAutomatically

A state in which the connection pool performs the restart processing using the auto-restart functionality. If the restart processing is successful, the status changes to the Start status. If the restart processing fails, the status returns to the Auto-suspension status. No request is sent to a connection pool with the Auto-restarting status when a connection request is sent to the root resource adapter.

4

Manual Restarting status

  • resumingManuallyFromSuspendedAutomatically

  • resumingManuallyFromSuspendedManually

  • resumingManually

A state in which the connection pool performs the restart processing by executing the cjresumepool command in the Auto-suspension status or Manual Suspension status. If the restart processing is successful, the status changes to the Start status. If the restart processing fails, the status returns to the one before the command was executed. No request is sent to a connection pool with the Manual Restarting status when a connection request is sent to the root resource adapter.

5

Automatically Blocked status

blockedAutomatically

A state in which the auto-suspension functionality is used to block a connection pool and perform the suspension processing. When the suspension processing finishes, the status changes to the Auto-suspension status. No request is sent to a connection pool with the Automatically Blocked status when a connection request is sent to the root resource adapter.

6

Manually Blocked status

blockedManually

A state in which the cjsuspendpool command is used to block a connection pool and perform the suspension processing. When the suspension processing finishes, the status changes to the Manual Suspension status. No request is sent to a connection pool with the Manually Blocked status when a connection request is sent to the root resource adapter.

7

Auto-suspension status

suspendedAutomatically

A state in which the auto-suspension functionality is used to suspend the connection pool. There are no connections in the connection pool. No request is sent to a connection pool with the Auto-suspension status when a connection request is sent to the root resource adapter.

8

Manual Suspension status

suspendedManually

A state in which the cjsuspendpool command is used to suspend the connection pool. There are no connections in the connection pool. No request is sent to a connection pool with the Manual Suspension status when a connection request is sent to the root resource adapter.

9

Reserved Auto-suspension status

suspendedAutomaticallyReserved

A state in which the resource adapter is stopped when the connection pool is in the Auto-suspension status. A connection pool with the Reserved Auto-suspension status changes to the Auto-suspension status when the resource adapter is started. Note that at this time the connection pool warming up functionality is disabled.

10

Reserved Manual Suspension status

suspendedManuallyReserved

A state in which the resource adapter is stopped when the connection pool is in the Manual Suspension status. A connection pool with the Reserved Manual Suspension status changes to the Manual Suspension status when the resource adapter is started. Note that at this time the connection pool warming up functionality is disabled.

Note

The numbers indicate the numbers in Figure 20-4 and Figure 20-5.

(b) Executability of commands based on the connection pool status

Depending on the state of the connection pool, some commands can be executed and some cannot be executed. The following table describes whether the commands can be executed for each connection pool state.

Table 20‒6: Executability of commands based on the connection pool status

Command

Connection pool status

Start

Reserved Start

Auto-restarting/ Manual Restarting

Automatically Blocked/ Manually Blocked

Auto-suspension

Manual Suspension

Reserved Auto-suspension

Reserved Manual Suspension

cjstartrar

N

Y

N

N

N

N

Y

Y

cjstoprar

Y

N

R#1

R#2

Y

Y

N

N

cjclearpool

Y

N

N

N

N

N

N

N

cjlistrar

Y

Y

Y

Y

Y

Y

Y

Y

cjsuspendpool

Y

Y

N

N

Y

N

Y

N

cjresumepool

N

N

N

N

Y

Y

Y

Y

cjstopsv (for a normal termination)

Y

Y

R#1

R#2

Y

Y

Y

Y

cjstopsv (for a forced termination)

Y

Y

Y

Y

Y

Y

Y

Y

Legend:

Y: Can be executed

R: Restricted

N: Cannot be executed

#1

The command is received, but the processing is executed when the status changes to Start or Suspend.

#2

The command is received, but the processing is executed when the status changes to Suspend.

(4) How to select a connection pool

When the J2EE application sends a connection request to the root resource adapter, one member connection pool is selected. The method by which the member connection pool is selected at this time is the round-robin method.

The connection pool that is selected is a member connection pool with the Start status. A member connection pool that has free connections is selected on priority.

However, if only a member connection pool with depleted connections is available, the connection request changes to pending. Furthermore, if a timeout occurs in a pending connection, the connection cannot be obtained. Also, if a connection pool is blocked when a connection request is pending, the connection request is restarted and an attempt is made to obtain a connection from the member connection pool that is next in the priority order. If a connection cannot be obtained from any of the member connection pools, the attempt to obtain the connection fails.

Note that if there is a connection request when a member connection pool with the Start status does not exist, the attempt to obtain the connection fails.

To specify the maximum size of each member connection pool, use the following guideline:

Maximum-size-of -the-member-connection-pool-(number) = Maximum-number-of-concurrent-connections-permitted-for-the-system / number-of-database-nodes