Outbound Management

This chapter describes roles and functions of JEUS in an outbound communication from an application to EIS, based on interoperation with a connection pool and transaction.

1. Managing the Connection Pool and Connections

A connection is required for an application, in an outbound communication, to send a request to EIS and receive a response. JEUS provides the connection pool for an application to efficiently use the connection.

1.1. Connection Request Pattern of an Application

An application can request a connection Factory, and then obtain a connection from the factory. This is the same as the method for looking up a data source to obtain a JDBC connection, and then obtaining a connection from the data source.

The following is an example of connection request pattern of an application.

// obtain the initial JNDI Naming context
Context initctx = new InitialContext();
// perform JNDI lookup to obtain the connection factory
jakarta.resource.cci.ConnectionFactory connectionFactory =
  (jakarta.resource.cci.ConnectionFactory)initctx.lookup(“java:comp/env/eis/sampleEIS”);
jakarta.resource.cci.Connection conn = connectionFactory.getConnection();
try {
   // do some works
} finally {
   conn.close();
}

In the example, CCI is used, but a connection factory does not actually have a specified interface. It is defined by a resource adapter and used by an application.

Assuming that the application above is an EJB, the annotation or <resource-ref> in the ejb-jar.xml file should be configured as follows:

Connection request: <ejb-jar.xml>
<ejb-jar>
. . .
<enterprise-beans>
    . . .
    <session>
        . . .
        <resource-ref>
            <res-ref-name>eis/sampleEIS</res-ref-name>
            <res-type>
                jakarta.resource.cci.ConnectionFactory
            </res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
        </resource-ref>
        . . .

In jeus-ejb-dd.xml, a JNDI name to which 'eis/sampleEIS' is to be mapped should be specified.

In the following example, 'sampleConnectionPool', is the JNDI name of the connection pool that is specified in jeus-connector-dd.xml when deploying a resource adapter.

Connection request: <jeus-ejb-dd.xml>
<jeus-ejb-dd>
    . . .
    <beanlist>
        <jeus-bean>
            . . .
            <res-ref>
                <jndi-info>
                    <ref-name>eis/sampleEIS</ref-name>
                    <export-name>sampleConnectionPool</export-name>
                </jndi-info>
            </res-ref>
    . . .

For more information about jeus-connector-dd.xml, refer to Resource Adapter.

1.2. Relationship between Resource Adapter and Connection Pool

If an application requests a connection factory through JNDI, JEUS requests a resource adapter to create the connection factory.

To do so, JEUS passes a connection manager to the resource adapter. The implementation entity of the connection manager is the JEUS connection pool.

The resource adapter will pass the created connection factory to JEUS, and JEUS will pass it to the application. If the application requests the connection factory to create a Connection, the resource adapter requests the connection manager for a connection. The JEUS connection manager then takes a physical connection (or ManagedConnection) from the connection pool to create a connection handle, and returns it to the resource adapter. The resource adapter passes it to the application. A physical connection and connection handle are defined in the JCA standard.

If a connection is no longer needed, the application has to return it. This is called 'closing the connection.' If the application does not properly close a connection, there will be a connection leak.

It is the resource adapter’s choice to use the connection manager passed from JEUS. If a resource adapter creates a connection internally without using a connection manager, JEUS is not involved in connection management and communication between an application and EIS.

  1. For information about the connection manager, refer to the Javadoc and JCA standards for jakarta.resource.spi.ConnectionManager and jakarta.resource.spi.ManagedConnectionFactory.

  2. For further information about physical connection and connection handle, refer to "Chapter 6. Connection Management" of the JCA standards.

1.3. Strength of Connection Pool

The functions of JEUS connection pool provided by JCA are similar to those of DB connection pool but have the following advantages.

  • High performance

    In general, a process for creating a connection to a database or external resource is slow. However, since a physical connection in the connection pool can be reused without having to recreate it each time, overhead for creating a connection can be reduced. The overhead for disconnecting can also be reduced, as a connection closed by an application is not actually disconnected, but returned to the pool.

  • Simultaneous connection management

    The number of clients sending requests to a resource can be controlled. This prevents too many requests from being sent to the resource and causing an outage.

For more information about DB Connection Pool, refer to Database Connection Pool and JDBC in JEUS Server Guide.

1.4. Connection Pool Configuration

JEUS connection pool can be configured in the jeus-connector-dd.xml file when deploying a resource adapter.

JCA connection pool is automatically created without being configured. In order for an application to use a connection pool, a JNDI name is required, which is automatically created according to the rule set by JEUS. In order for a user to specify a JNDI name, it should be set in jeus-connector-dd.xml file. A connection pool can be configured inside the <jeus-connector-dd> tag, which is inside the<connection-pool> tag, in jeus-connector-dd.xml file. For information about how to include the jeus-connector-dd.xml file in RAR, refer to Resource Adapters.

By the JCA standard, multiple connection pools can be configured to one resource adapter. A connection pool is based on <connection-definition> element in ra.xml file, and its sub-element, <connectionfactory-interface>. For example, if five separate <connection-definition> elements are specified, five connection pools are created in JEUS.

<connectionfactory-interface> defined in ra.xml file cannot be repeated. If the same value is repeated in ra.xml file, the validity check will fail, and deployment will also fail.

The following is an example of the jeus-connector-dd.xml file. For more information about each tag, refer to Connection Pool Configuration.

  • <connectionfactory-interface>

    • If ra.xml file contains two or more <connection-definition> elements, <connectionfactory-interface> element should be specified. Otherwise, it is impossible to create a connection pool, and a deployment error will occur.

    • Specify a value for the <connectionfactory-interface> element specified inside each <connection-definition> element in ra.xml file. For details about <connectionfactory-interface>, refer to Resource Adapters.

  • <export-name>

    • JNDI name of a connection pool.

    • The name should be unique within the server, and it is required.

  • <transaction-support>

    • Specify a transaction type supported by the connection pool. The specified value overrides the configuration in ra.xml file.

      • NoTransaction

      • LocalTransaction

      • XATransaction

  • <user>

    • User ID sent to the connection pool to create a Connection.

  • <password>

    • Password sent to the connection pool to create a Connection.

    • To store an encrypted password, configure it as follows:

      {algorithm}ciphertext

      Example:

      {DES}FQrLbQ/D8O1lDVS71L28rw==
  • <use-lazy-transaction-enlistment>

    • Determines whether to use the "Lazy Transaction Enlistment" option, which is one of the transaction optimization functions stated in the JCA standard. (Default value: false)

  • <pool-management>

    Main options of a connection pool exist inside the <pool-management> sub-element of the <connection-pool> element.

    • <min>: Initial value for the number of connections (Default value: 2)

    • <max>: he maximum number of connections allowed in a connection pool (Default value: 10)

    • <step>: The number of connections added when it needs to be increased. (Default value: 1)

    • <period>: Sets the size of a connection pool to the minimum value at specified intervals. If there is no idle connection in the pool, the size is not reduced to the minimum value. The unit is in milliseconds. This setting replaces the <pooled-timeout> value. (Default value: 10 minutes, Unit: ms)

    • <wait-connection>: Determines how to process a connection request that is issued when there is no idle connection and the size of the connection pool reaches the maximum value.

      Tag Description

      <wait-connection>

      • true: The system will wait to obtain a valid connection. If it fails to obtain a connection during the wait time, an exception occurs.

      • false: Provide the application with a newly created connection and when the application returns it, close the connection without saving it in the pool. This is called a 'disposable connection' in JEUS. (Default value)

      <wait-timeout>

      Only valid when <wait-connection> is set to true. Specifies how long a user should wait for a connection. If no connection is available for the user during the time period, an exception occurs.

      (Default value: 10 seconds, Unit: ms)

    • <use-match-connection>: Determines whether to use Connection Match. (Default value: false)

    • <allow-disposable-connection-when-match-failed>: Determines whether to use a disposable connection if Connection Match fails. If Connection Match is not set, this setting is not used. (Default value: false)

    • <connection-validation>: Sets a validity check for a connection.

      Tag Description

      <enabled>

      Determines whether to use the connection validity check function.

      Even if this tag is set to true, the resource adapter must implement the jakarta.resource.spi.ValidatingManagedConnectionFactory interface to use this setting.

      <period>

      Specifies an interval for the connection validity check. Checks the validity of idle connections at specified intervals. (Unit: ms)

      <non-validation-interval>

      If the gap between the last time the connection was used and the start time of the validity check is smaller than the specified value, validity check is not performed. This setting can reduce the overhead of the check. (Unit: ms)

      <validation-retrial-count>

      When the destroy policy is set to FailedConnectionOnly, the validity check is performed only once. When the policy is set to AllConnections, the check is performed twice for each connection, and another one if the first one fails.

      If more validity checks are needed, the number can be increased using this setting.

      <destroy-policy-on-validation>

      Determines how to process connections in the connection pool when the connection validity check fails.

      • FailedConnectionOnly: Only closes the physical connection for which the validity check failed. (Default value)

      • AllConnections: If the validity check fails, it will be performed for another connection in the pool. If the check fails again, all connections in the pool will be closed. This includes all connections that are being used by the application.

    • <action-on-connection-leak>: Sets logging or return action for connections used by a component (Mainly stateless components- servlet/JSP, stateless session beans, and MDB). If not set, the default setting for Action On Resource Leak configured in the server will be performed. (Default value: Warning)

    • <connection-trace>: Option to monitor connections. The default setting is that the stack trace during getConnection is displayed in order to show which applications are using the connections. Such information is also displayed when Action On Resource Leak configured in the server is processed.

      Option Description

      enabled

      Turn the connection trace function on/off.

      get-connection-trace

      Stores stack trace information when an application obtains a connection (calling getConnection). (Default value: true)

      local-transaction-trace

      Determines whether to trace information about local transactions between an application and a resource adapter.

      When used with the <get-connection-trace> setting, it is helpful for tracing an application that did not properly commit or roll back a local transaction.

    • <max-use-count>: A connection can be used as many times as the specified value, and after that, it is closed and a new connection is created. (Default value: 0, meaning that the connections will continue to be used without being replaced).

    • <pool-destroy-timeout>: Waiting time to destroy a connection pool. A connection pool is destroyed when undeploying the resource adapter. Doing network communication with the resource while closing connections may cause the system to hang. If destruction is not executed during the specified waiting time, undeploy will continue to be processed ignoring the setting. (Default value: 10 seconds)

  • <property>

    • Adds a property to be applied to ManagedConnectionFactory. Used to replace or add a value specified in the ra.xml file.

For more information about Connection Match and Lazy Transaction Enlistment, refer to the JCA standard.

1.5. Connection Pool Features

A connection pool can examine the validity of connections, and handle connection leaks.

Connection Validity Check

When an application requests a connection, a connection pool can request a resource adapter to check validity of a connection. This is useful for checking disconnection caused by an internal error of the connection, or socket disconnection caused by the firewall. If validity check fails, a new physical connection is created and returned to the application.

If validity check is performed too often incurring overhead, configure the <non-validation-interval> setting. If the gap between the last time the connection was used and the start time of the validity check is less than the specified value, the validity check is not performed since the connection is considered valid in this case.

For example, if an interval is set to 5 seconds (5,000 ms), and less than five seconds have passed since the connection was last used, the connection is assumed to be valid.

The following is an example of the <non-validation-interval> element.

<non-validation-interval>5000</non-validation-interval>

To execute the validity check, the resource adapter has to first implement the jakarta.resource.spi.ValidatingManagedConnectionFactory interface. Sometimes, when validity check is requested to a resource adapter, there may be no response. Since WAS does not currently have a solution for this, a timeout option should be provided by the resource adapters.

If validity check fails, the user can specify a destroy policy for the other connections in the connection pool. The policy is described in the following table.

Policy Description

FailedConnectionOnly

Only discards a connection for which validity check failed. (Default value)

AllConnections

Discards all the other connections along with the failed connection. Before discarding all the connections after the validity check fails, another check is attempted. If it fails again, all connections in the pool are discarded.

The following is an example of setting the Destroy policy for connections in the pool when the validity check fails.

<destroy-policy-on-validation>AllConnections</destroy-policy-on-validation>

To increase the number of connection validity checks executed, use <validation-retrial-count>.

Handling Connection Leak

JEUS can specify an action to handle connection leaks in each connection pool or server.

For components such as servlet/JSP, stateless session beans, and message driven bean, whose start and end are clear, it is easy to check if a used connection was returned properly. If a connection has not been returned, it is possible to set an action to force the connection to be closed, or record logs through the Invocation Manager. However, a JCA connection throws an exception for the automatic return (AutoClose) action of the Invocation Manager.

Since from the JCA connection pool it is not possible to know which method closes a connection, the pool cannot directly close the connection. However, if the <connection-interface> element inside the <connection-definition> element in resource adapter’s ra.xml file is configured as the following, the pool is able to close the connection. This is because, in this case, the pool already knows the structure of the 'close' method and the method has no parameters.

The following are the exception handling methods for the AutoClose action of JCA connection’s Invocation Manager.

  • java.sql.Connection

  • jakarta.resource.cci.Connection

If the previous <connection-interface> element is not configured, it is difficult to directly close a connection. However, after calling the cleanup method defined in jakarta.resource.spi.ManagedConnection, the connection is forced to be returned to the pool.

In the 'cleanup' method, the resource adapter’s role is defined as follows:

The cleanup should invalidate all connection handles
that had been created using this ManagedConnection instance.

For more information about the Invocation Manager, refer to Action On Resource Leak in JEUS Server Guide.

2. Managing Transactions

This section describes how JEUS manages a connection pool whose transaction type is either local or global.

2.1. Local Transaction Resource Participating in Global Transaction(XA)

Since a local transaction is a transaction between an application and resource adapter, JEUS cannot request a resource adapter for a connection unless it’s for a global transaction.

When using a local transaction type connection pool for a global transaction, jakarta.resource.spi.LocalTransaction instance obtained from the ManagedConnection instance of a resource adapter can be emulated as an XAResource object.

Even if a resource adapter does not support global transactions (XA), if it supports local transactions, at most one resource can participate in a global transaction (XA). This works like the connection pool data source that uses the XA emulation function.

For detailed information on data sources, refer to Data Source Configuration in JEUS Server Guide.

2.2. Global Transaction (XA) and Connection Sharing

Connection sharing means that the same connection is always used for a particular resource within the same global transaction (XA). JEUS supports connection sharing, and connections can be shared without any settings.

To disable the connection sharing function, for each application, configure the <resource-ref> element as Unsharable.

<resource-ref>
    <res-ref-name>jca/pool</res-ref-name>
    <res-type>jakarta.resource.cci.ConnectionFactory</res-type>
    <res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
  1. For details about connection sharing, refer to the section "8.9 Connection Sharing" of the JCA standard 2.0.

  2. DB Connection Pool also provides Connection Sharing. Refer to Global Transaction (XA) and Connection Sharing in JEUS Server Guide.

3. Example of Connection Pool Configuration

One outbound resource adapter can be used to configure one or more outbound connections.

3.1. Configuring a Connection Pool with One Connection Factory

The following is an example of the ra.xml file that contains jakarta.resource.cci.ConnectionFactory interface as the Connection Factory element. In most cases, there is only one Connection Factory specified as shown in the following.

Configuring a connection pool with one connection factory: <ra.xml>
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="https://jakarta.ee/xml/ns/jakartaee" version="2.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
      	 https://jakarta.ee/xml/ns/jakartaee/connector_2_0.xsd">
    <display-name>ConnectionManagementSample1</display-name>
    <vendor-name>TmaxSoft</vendor-name>
    <eis-type>TestResource</eis-type>
    <resourceadapter-version>2.0</resourceadapter-version>
    <license>
        <license-required>false</license-required>
    </license>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.tmax.SampleManagedConnectionFactory
                </managedconnectionfactory-class>
                <connectionfactory-interface>
                    jakarta.resource.cci.ConnectionFactory
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.tmax.SampleConnectionFactory
                </connectionfactory-impl-class>
                <connection-interface>
                    jakarta.resource.cci.Connection
                </connection-interface>
                <connection-impl-class>
                    com.tmax.SampleConnection
                </connection-impl-class>
            </connection-definition>
            <transaction-support>
                LocalTransaction
            </transaction-support>
            <authentication-mechanism>
                <authentication-mechanism-type>
                    BasicPassword
                </authentication-mechanism-type>
                <credential-interface>
                    jakarta.resource.spi.security.PasswordCredential
                </credential-interface>
            </authentication-mechanism>
            <reauthentication-support>
                false
            </reauthentication-support>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>

If the jeus-connector-dd.xml file is not configured, you cannot create a connection pool corresponding to the <connection-definition> setting in the ra.xml file. Therefore, you must configure the <export-name> element in the jeus-connector-dd.xml file.

The following is an example of the jeus-connector-dd.xml file. For more information about each tag, refer to Connection Pool Configuration.

Configuring a connection pool with one connection factory: <jeus-connector-dd.xml>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jeus-connector-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus">
    <connection-pool>
        <export-name>jcapool</export-name>
        <pool-management>
            <min>10</min>
            <max>50</max>
            <period>600000</period> <!-- 10 minutes -->
            <wait-connection>
                <wait-connection>true</wait-connection>
                <wait-timeout>30000</wait-timeout>
            </wait-connection>
            <action-on-connection-leak>Warning</action-on-connection-leak>
        </pool-management>
    </connection-pool>
</jeus-connector-dd>

3.2. Configuring a Connection Pool with Two Connection Factories

The following is an example of the ra.xml file that configures javax.sql.DataSource and jakarta.resource.cci.ConnectionFactory interfaces as Connection Factory settings.

Configuring a connection pool with two connection factories: <ra.xml>
<?xml version="1.0" encoding="UTF-8"?>
<connector xmlns="https://jakarta.ee/xml/ns/jakartaee" version="2.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
      	 https://jakarta.ee/xml/ns/jakartaee/connector_2_0.xsd">
    <display-name>ConnectionManagementSample1</display-name>
    <vendor-name>TmaxSoft</vendor-name>
    <eis-type>TestResource</eis-type>
    <resourceadapter-version>2.0</resourceadapter-version>
    <license>
        <license-required>false</license-required>
    </license>
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.tmax.DataSourceManagedConnectionFactory
                </managedconnectionfactory-class>
                <connectionfactory-interface>
                    javax.sql.DataSource
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.tmax.JeusDataSource
                </connectionfactory-impl-class>
                <connection-interface>
                    java.sql.Connection
                </connection-interface>
                <connection-impl-class>
                    com.tmax.JeusConnection
                </connection-impl-class>
            </connection-definition>
            <connection-definition>
                <managedconnectionfactory-class>
                    com.tmax.SampleManagedConnectionFactory
                </managedconnectionfactory-class>
                <connectionfactory-interface>
                    jakarta.resource.cci.ConnectionFactory
                </connectionfactory-interface>
                <connectionfactory-impl-class>
                    com.tmax.SampleConnectionFactory
                </connectionfactory-impl-class>
                <connection-interface>
                    jakarta.resource.cci.Connection
                </connection-interface>
                <connection-impl-class>
                    com.tmax.SampleConnection
                </connection-impl-class>
            </connection-definition>
            <transaction-support>
                NoTransaction
            </transaction-support>
            <authentication-mechanism>
                <authentication-mechanism-type>
                    BasicPassword
                </authentication-mechanism-type>
                <credential-interface>
                    jakarta.resource.spi.security.PasswordCredential
                </credential-interface>
            </authentication-mechanism>
            <reauthentication-support>
                false
            </reauthentication-support>
        </outbound-resourceadapter>
    </resourceadapter>
</connector>

As shown in the following, you need to configure the <connectionfactory-interface> element to create a connection pool through the jeus-connector-dd.xml file according to the <connection-definition> setting of the ra.xml file. Otherwise, an error that a connection pool cannot be created occurs during deployment.

Configuring a connection pool with two connection factories: <jeus-connector-dd.xml>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jeus-connector-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus">
    <connection-pool>
        <export-name>jdbcpool</export-name>
        <connectionfactory-interface>
           javax.sql.DataSource
        </connectionfactory-interface>
        <pool-management>
            <min>5</min>
            <max>20</max>
        </pool-management>
    </connection-pool>
    <connection-pool>
        <export-name>ccipool</export-name>
        <connectionfactory-interface>
           jakarta.resource.cci.ConnectionFactory
        </connectionfactory-interface>
        <pool-management>
            <min>1</min>
            <max>10</max>
        </pool-management>
    </connection-pool>
</jeus-connector-dd>

4. Monitoring and Controlling Connection Pools

Use the JEUS console tool (jeusadmin) to monitor and control the JCA Connection Pool. To do so, resource adapter modules must be deployed first. For more information about how to deploy resource adapter modules, refer to JEUS Applications & Deployment Guide.

The examples in this section assume that a resource adapter module, whose JNDI export name of JCA connection pool is 'my_rar_cp,' has already been deployed. For JNDI export name configuration of JCA connection pool, refer to Connection Pool Configuration.

For more information about monitoring and control with console tools, refer to Connection Pool Control and Monitoring Commands in JEUS Reference Guide.

4.1. Controlling Connection Pools

The following shows how to control connection pools using jeusadmin.

[MASTER]domain1.adminServer>cpinfo
The connection pool information on the server [adminServer].
================================================================================
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| Connec | Min | Max | Active | Act | Active | Idle| Dispos | Tot | Wait| Enab |
|  tion  |     |     |   Max  | ive | Average|     |  able  | al  |     | led  |
|Pool ID |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| mysql *|  20 |  20 |      0 |   0 |    0.0 |   0 |      0 |   0 | fal | false|
|        |     |     |        |     |        |     |        |     |se   |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| oracle |   1 |  30 |      0 |   0 |    0.0 |   0 |      0 |   0 | true| false|
| *      |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+

* : has not been created, total = active + idle + disposable
================================================================================
[MASTER]domain1.adminServer>create-connection-pool -id mysql
Servers that successfully created a connection pool : adminServer
Servers that failed to create a connection pool : none.
[MASTER]domain1.adminServer>cpinfo
The connection pool information on the server [adminServer].
================================================================================
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| Connec | Min | Max | Active | Act | Active | Idle| Dispos | Tot | Wait| Enab |
|  tion  |     |     |   Max  | ive | Average|     |  able  | al  |     | led  |
|Pool ID |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| mysql  |  20 |  20 |      1 |   0 |    0.0 |  20 |      0 |  20 | fal | true |
|        |     |     |        |     |        |     |        |     |se   |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| oracle |   1 |  30 |      0 |   0 |    0.0 |   0 |      0 |   0 | true| false|
| *      |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+

* : has not been created, total = active + idle + disposable
================================================================================
[MASTER]domain1.adminServer>control-connection-pool -id mysql -enable
Servers that successfully enabled a connection pool : adminServer
Servers that failed to enable a connection pool : none.
[MASTER]domain1.adminServer>

First, since the Connection Pool has not been created yet, create a Connection Pool with the create-connection-pool command. After that, you can control the Connection Pool with the control-connection-pool command.

The following describes the options for using control-connection-pool.

Button Description

[Enable]

Activates the connection pool.

[Shrink]

Adjusts the number of connections in the connection pool to the minimum value.

[Disable]

Inactivates the connection pool.

[Refresh]

Replaces connections of the connection pool with new connections.

4.2. Monitoring Connection Pools

The following shows how to monitor connection pools using jeusadmin.

[MASTER]domain1.adminServer>cpinfo
The connection pool information on the server [adminServer].
================================================================================
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| Connec | Min | Max | Active | Act | Active | Idle| Dispos | Tot | Wait| Enab |
|  tion  |     |     |   Max  | ive | Average|     |  able  | al  |     | led  |
|Pool ID |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| mysql  |  20 |  20 |      1 |   0 |    0.0 |  20 |      0 |  20 | fal | true |
|        |     |     |        |     |        |     |        |     |se   |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+
| oracle |   1 |  30 |      0 |   0 |    0.0 |   0 |      0 |   0 | true| false|
| *      |     |     |        |     |        |     |        |     |     |      |
+--------+-----+-----+--------+-----+--------+-----+--------+-----+-----+------+

* : has not been created, total = active + idle + disposable
================================================================================

The following is a list of connection pool items.

Item Description

Connection Pool ID

ID of the connection pool.

Min

The minimum number of connections allowed for the connection pool.

Max

The maximum number of connections allowed for the connection pool.

Active Max

The maximum number of active connections after creating the connection pool.

Active

The number of connections in use.

Active Average

The average number of connections over the past hour.

Idle

The number of available connections in idle.

Disposable

The number of disposable connections that are used when there are no idle connections in the connection pool. The disposable connections are created only when the Wait column is set to false.

Total

The total number connections that are active, idle, or disposable.

Wait

Determines whether to create disposable connections if there are no available idle connections in the connection pool.

Enabled

Determines whether to activate the connection pool.

If you specify the ID of a specific connection pool using the option, the details of the connections in the connection pool are displayed.

[MASTER]domain1.adminServer>cpinfo -id mysql
Information about connections in the server [adminServer]'s connection pool [mysql].
================================================================================
+-------------------+-------+--------------------------+--------------+--------+
|   Connection ID   | State |      State Time(sec)     |   Use Count  |  Type  |
+-------------------+-------+--------------------------+--------------+--------+
| mysql-14          | idle  |                    7.607 |            0 | pooled |
| mysql-4           | idle  |                    7.609 |            0 | pooled |
| mysql-20          | idle  |                    7.605 |            0 | pooled |
| mysql-2           | idle  |                     7.61 |            0 | pooled |
| mysql-6           | idle  |                    7.609 |            0 | pooled |
| mysql-8           | idle  |                    7.608 |            0 | pooled |
| mysql-7           | idle  |                    7.609 |            0 | pooled |
| mysql-17          | idle  |                    7.606 |            0 | pooled |
| mysql-12          | idle  |                    7.607 |            0 | pooled |
| mysql-1           | idle  |                     7.61 |            0 | pooled |
| mysql-5           | idle  |                    7.609 |            0 | pooled |
| mysql-15          | idle  |                    7.606 |            0 | pooled |
| mysql-16          | idle  |                    7.606 |            0 | pooled |
| mysql-11          | idle  |                    7.607 |            0 | pooled |
| mysql-13          | idle  |                    7.607 |            0 | pooled |
| mysql-10          | idle  |                    7.608 |            0 | pooled |
| mysql-3           | idle  |                     7.61 |            0 | pooled |
| mysql-9           | idle  |                    7.608 |            0 | pooled |
| mysql-18          | idle  |                    7.606 |            0 | pooled |
| mysql-19          | idle  |                    7.605 |            0 | pooled |
+-------------------+-------+--------------------------+--------------+--------+
================================================================================

The following describes connection pool items.

Item Description

Connection ID

Connection identifier.

State

Connection state.

  • idle: Available.

  • active: In use.

State Time

Period of time during which the state is maintained.

Use Count

The number of times the connection was used.

Type

Shows if the connection is disposable or not.

  • disposable: Disposable connection.

  • pooled: Non-disposable connection.