2012년 2월 28일 화요일

[wsadmin] Purging the connection pool of a WebSphere Application Server data source using an MBean

Purging the connection pool of a WebSphere Application Server data source using an MBean


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:
  1. Normal:
  2. Immediate:

Examples of operations that can be executed on the data source MBean:
1. List all data sources:

    Using Jacl:
    $AdminControl queryNames *:type=DataSource,*​

    Using Jython:
    AdminControl.queryNames("*:type​=​DataSource,*")​​


2. Initialize a variable to specify a data source (this example uses Default Datasource, but any data source name listed in the output of above command can be used):
    Using Jacl:
    set name "Default Datasource"​
    set ds [$AdminControl queryNames *:type=DataSource,name=$name,*]​ ​

    Using Jython:
    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​

    Using Jython:
    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​

    Using Jython:
    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​

    Using Jython:

    AdminControl.invoke(ds, "purg​ePoolContents", "immediate")​

If the purge operation is successful, no response will be observed. If the purge operation is not successful, the response will indicate a possible reason for failure. One common reason for failure is attempting to purge the contents of a connection pool which is not yet available (the connection pool is not created until a naming lookup of the associated datasource or connection factory occurs), resulting in an illegal state exception.

Change History

Last Updated: 18 August 2010

댓글 없음:

댓글 쓰기