Example: Changing connection pool settings with the wsadmin tool

Using the wsadmin AdminControl object, you can script changes to connection pool settings.

The WebSphere Application Server wsadmin tool provides the ability to run scripts in the Jacl and Jython languages only. You must start the wsadmin scripting client to perform any scripting task. (See the article "Starting the wsadmin scripting client.")

For more information about the AdminControl scripting object, refer to the article "Using the AdminControl object for scripted administration." See the links section at the end of this article.

Connection Timeout

The Connection timeout can be changed at any time while the pool is active. All connection requests that are waiting for a connection are changed to the new value minus the time already waited, and are returned to the wait state if there are no available connections.

For example, if the connection timeout is changed to 300 seconds and a connection request has waited 100 seconds, the connection request waits for 200 more seconds if no connection becomes available.

$AdminControl getAttribute $objectname connectionTimeout
$AdminControl setAttribute $objectname connectionTimeout 200 

For more information about this setting, see Connection pool settings.

Maximum Connections

The maximum connections can be changed at any time except in the case where stuck connection support is active.

If stuck connection support is active, an attempt to change the maximum connections is made. If the attempt fails, an IllegalState exception occurs. See Connection pool advanced settings for more information.

If stuck connection support is not active, the maximum connections are changed to the new value. If the new value is greater than the current value, the number of connections increases to the new value and any requests waiting are notified. If the new value is less than the current value and Aged Timeout or Reap Time is used, the number of connections decreases to the new value depending on pool activity. If agedTimeout or Reap Time are not used, no automatic attempt will be made to reduce the total number of connections. To manually reduce the number of connections to the new maximum connections, use the Mbean function purgePoolContents.

$AdminControl getAttribute $objectname maxConnections
$AdminControl setAttribute $objectname maxConnections 200 

For more information about this setting, see Connection pool settings.

Minimum Connections

The minimum connections can be changed at any time

$AdminControl getAttribute $objectname minConnections
$AdminControl setAttribute $objectname minConnections 200 

For more information about this setting, see Connection pool settings.

Reap Time

The reap time can be changed at any time. The reap time interval is changed to the new value at the next interval.

$AdminControl getAttribute $objectname reapTime
$AdminControl setAttribute $objectname reapTime 30 

Unused Timeout

The unused timeout can be changed at any time.

$AdminControl getAttribute $objectname unusedTimeout
$AdminControl setAttribute $objectname unusedTimeout 900 

For more information about this setting, see Connection pool settings.

Aged Timeout

The Aged Timeout can be changed at any time.

$AdminControl getAttribute $objectname agedTimeout
$AdminControl setAttribute $objectname agedTimeout 900 

For more information about this setting, see Connection pool settings.

Purge Policy

The purge policy can be changed at any time.

$AdminControl getAttribute $objectname purgePolicy
$AdminControl setAttribute $objectname purgePolicy "Failing Connection Only" 

For more information about this setting, see Connection pool settings.

Surge Protection Support

Surge connection support starts if surgeThreshold is > -1 and surgeCreationInterval is > 0. The surge protection properties can be changed at any time.

$AdminControl getAttribute $objectname surgeCreationInterval
$AdminControl setAttribute $objectname surgeCreationInterval 30
$AdminControl getAttribute $objectname surgeThreshold
$AdminControl setAttribute $objectname surgeThreshold 15

For more information about this setting, see Connection pool advanced settings.

Stuck connection Support

An attempt is made to change the stuckTime, stuckTimerTime or stuckThreshold properties. If the attempt fails, an IllegalState exception occurs. The pool cannot have any active requests or active connections during this request. For the stuck connection support to start, all three stuck property values must be greater than 0, and the maximum connections value must be > 0.

If the connection pool is stuck, you cannot change the stuck or the maximum connection properties. If you are stuck, there are active connections.

$AdminControl getAttribute $objectname stuckTime
$AdminControl setAttribute $objectname stuckTime 30
$AdminControl getAttribute $objectname stuckTimerTime
$AdminControl setAttribute $objectname stuckTimerTime 15
$AdminControl getAttribute $objectname stuckThreshold
$AdminControl setAttribute $objectname stuckThreshold 10 

For more information about this setting, see Connection pool advanced settings.

Test Connection Support (This is only supported for a DataSource)

The test connection support starts when the testConnection property is set to true, and the interval is > 0. The test connection properties can be changed at any time.

$AdminControl getAttribute $objectname testConnection
$AdminControl setAttribute $objectname testConnection 30
$AdminControl getAttribute $objectname testConnectionInterval
$AdminControl setAttribute $objectname testConnectionInterval 15

For more information about this setting, see Test connection service.

Connection Pool Partition Support

$AdminControl invoke $objectname freePoolDistributionTableSize
$AdminControl invoke $objectname numberOfFreePoolPartitions
$AdminControl invoke $objectname numberOfSharedPoolPartitions
$AdminControl invoke $objectname gatherPoolStatisticalData
$AdminControl invoke $objectname enablePoolStatisticalData

For more information about this setting, see Connection pool advanced settings.

Show Pool Information Support

The show pool operations can be changed at any time.

$AdminControl invoke $objectname showAllPoolContents
$AdminControl invoke $objectname showPoolContents
$AdminControl invoke $objectname showAllocationHandleList

Purge Connection Support

PurgePool can be changed at any time.

$AdminControl invoke $objectname purgePoolContents normal
$AdminControl invoke $objectname purgePoolContents immediate

Pool Control Support

Pause and resume can be changed at any time.

$AdminControl invoke $objectname pause
$AdminControl invoke $objectname resume



Related tasks
Starting the wsadmin scripting client
Using the AdminControl object for scripted administration
Related reference
Connection pool settings
Connection pool advanced settings
Reference topic    

Terms of Use | Feedback

Last updated: Feb 19, 2011 5:25:36 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v610web&product=was-nd-mp&topic=rdat_chgconwsadmin
File name: rdat_chgconwsadmin.html