Problem(Abstract)
You can purge the connection pool of a WebSphere Application Server data source using an MBean operation.Resolving the problem
WebSphere
Application Server has an operation on the data source MBean that can
be used to purge the connection pool. The operation name is: purgePoolContents.
The purgePoolContents operation has two options:
Examples of operations that can be executed on the data source MBean:
1. List all data sources:
3. View the pool contents by invoking the getPoolContents operation (version 5.1) or the showPoolContents (all other versions) operation of the data source MBean; the example below is for a version other than V5.1:
4. View contents of all pools by invoking the getAllPoolContents operation (version 5.1) or the showAllPoolContents (all other versions) operation of the data source MBean; the example below is for a version other than V5.1:
5. Immediately purge the pool by invoking the purgePoolContents operation of the data source MBean with the immediate option:
Change History
Last Updated: 18 August 2010
The purgePoolContents operation has two options:
- Normal:
- This is the default option.
- Existing in-flight transactions will be allowed to continue work.
- Shared connection requests will be honored.
- Free connections are cleaned up and destroyed.
- In use connections (for example: connections in transactions) are cleaned up and destroyed when returned to the connection pool.
- A close() call issued on any connection obtained prior to the
purgePoolContents
will be done asynchronously (for example: wait for the jdbc driver to return before proceeding). - Requests for new connections (not handles to existing old connections) will be honored.
- Immediate:
- No new transactions will be allowed to start on any connections obtained prior to the
purgePoolContents
call. Instead, a StaleConnectionException is thrown. - No new handles will be handed out on any connections obtained prior to the
purgePoolContents
call. Instead, a StaleConnectionException is thrown. - Existing in-flight transactions will be allowed to continue work. Any new activities on a purged Connection will cause a StaleConnectionException or an XAER_FAIL exception (in the case of XA)
- A close() call issued on any connection obtained prior to the
purgePoolContents
call will be done asynchronously (for example: no waiting for the jdbc driver to return) This is useful if the driver returns. - Due to the fact that close() does not wait, the number of connections will be decremented immediately in WebSphere Application Server. This might cause the total number of connections in WebSphere Application Server to be temporarily out of sync with the database total number of connections.
- Requests for new connections (for example: not handles to existing old connections) will be honored.
- No new transactions will be allowed to start on any connections obtained prior to the
Examples of operations that can be executed on the data source MBean:
1. List all data sources:
- Using Jacl:
$AdminControl queryNames *:type=DataSource,* |
AdminControl.queryNames("*:type=DataSource,*") |
|
- Using Jacl:
set name "Default Datasource" set ds [$AdminControl queryNames *:type=DataSource,name=$name,*] |
name = "Default Datasource" ds = AdminControl.queryNames("*:type=DataSource,name="+name+",*") |
3. View the pool contents by invoking the getPoolContents operation (version 5.1) or the showPoolContents (all other versions) operation of the data source MBean; the example below is for a version other than V5.1:
- Using Jacl:
$AdminControl invoke $ds showPoolContents |
print AdminControl.invoke(ds, "showPoolContents") |
4. View contents of all pools by invoking the getAllPoolContents operation (version 5.1) or the showAllPoolContents (all other versions) operation of the data source MBean; the example below is for a version other than V5.1:
- Using Jacl:
$AdminControl invoke $ds showAllPoolContents |
print AdminControl.invoke(ds, "showAllPoolContents") |
5. Immediately purge the pool by invoking the purgePoolContents operation of the data source MBean with the immediate option:
- Using Jacl:
$AdminControl invoke $ds purgePoolContents immediate |
AdminControl.invoke(ds, "purgePoolContents", "immediate") |
Change History
Last Updated: 18 August 2010
- 18 August 2010: Corrected syntax error in one of the jython commands and retested all commands and added information about the response to the purge operation.
댓글 없음:
댓글 쓰기