Releasing and reconnecting persistent sockets
A TCP/IP connection between the IMS™ TM resource adapter and IMS Connect is persistent and remains open for both a shareable persistent socket connection and a dedicated persistent socket connection unless an error occurs.
The socket might close when either the IMS TM resource adapter or IMS Connect encounter an error, or when WebSphere® Application Server disconnects the socket for connection pool management.
In a dedicated persistent socket connection, the socket connection can be used only by interactions that have the same client ID that was used to establish the connection. The number of socket connections increases as new client IDs are used for interactions on dedicated persistent socket connections.
If you set both the maximum connections property and the connection timeout property in the WebSphere Application Server administrative console to a non-zero value, when the maximum connections value is reached and all the connections are in use, the application gets a ConnectionWaitTimeoutException exception after the connection timeout has elapsed. This behavior is a standard behavior for WebSphere Application Server. The ConnectionWaitTimeoutException applies to both dedicated persistent sockets and shareable persistent sockets.
However, if the maximum connections value is reached and one of the persistent socket connections is not in use, WebSphere Application Server would disconnect that socket to respond to the request to create a new persistent socket connection. This standard behavior of WebSphere Application Server applies to both dedicated persistent sockets and shareable persistent sockets.
Socket reconnect
The IMS TM resource adapter has a socket reconnect feature that tries to reestablish a stale connection in a connection pool when one of the connections encounters a communication problem in the process of sending a request to or receiving a response from IMS Connect.
When a request comes in, if the IMS TM resource adapter detects a stale connection, the adapter throws an exception. When the next request comes in and tries to use the stale connection, the IMS TM resource adapter checks to see if IMS Connect is up. If IMS Connect is up, the IMS TM resource adapter would reconnect before submitting the interaction request. When the connection is restored, an ICO0140I informational message is logged.
This socket reconnect feature increases the fault-tolerance of the IMS TM resource adapter when a temporary network connection issue occurs. More importantly, with this feature you can recycle IMS Connect as part of your system maintenance without having to resubmit any IMS TM resource adapter interactions from the client application.
When a sysplex distributor is used between the IMS TM resource adapter and WebSphere Application Server, a WebSphere Application Server connection pool might have connections that are connected to more than one IMS Connect. If one of the IMS Connect instances is being recycled, new requests are directed to other IMS Connect instances. New requests would go to the recycled IMS Connect only when this IMS Connect instance comes back up and if other IMS Connect instances can no longer handle the workload.
To help redistribute the workload among the IMS Connect instances, you can use the aged timeout property in WebSphere Application Server connection pool settings. Because connections with an expired age are discarded, a new connection helps redistribute the connection to recycled IMS Connect instances.
For a callout request, the IMS TM resource adapter would attempt to reconnect based on the values of the IMSActivationSpec retryLimit and retryInterval properties. The retryLimit property specifies the maximum number of times the IMS TM resource adapter would attempt to reconnect to IMS Connect if a connection is lost, or to IMS if the connection to the IMS data store is lost. The retryInterval property specifies the time delay before the next attempt to check the IMS Connect status.