Assembly: IBM.CTG.Client (in IBM.CTG.Client.dll) Version: 1.0.0.0
Syntax
C# |
---|
public class GatewayConnectionPool : IDisposable |
Visual Basic |
---|
Public Class GatewayConnectionPool _ Implements IDisposable |
Visual C++ |
---|
public ref class GatewayConnectionPool : IDisposable |
Remarks
A connection pool contains a number of open GatewayConnection instances which can be acquired for use and then later returned to the pool after user. Pooled connections can be used in exactly the same way as non-pooled connections, the only difference being the way the connection is obtained. To create a pool of Secure Sockets Layer (SSL) connections, use SslGatewayConnectionPool.
A connection pool is created by passing a ConnectionPoolProperties object to the constructor. The properties object contains parameters that control the number of connections in the connection pool and the behaviour of the connection pool. By default, the minimum number of connections is 1 and the maximum number of connections is unlimited (Int32.MaxValue).
Once the connection pool is created, connections can be acquired using GetConnection()()()() or GetConnection(Int32), which return an available connection if there is one in the connection pool. If there are no available connections and the total number of connections is less than the maximum pool size, then a new connection is established. Connections in the pool remain open until either the pool is closed, the connected Gateway daemon is shut down, or the connection is dropped for any reason.
A connection pool can be closed by invoking Close()()()() or Close(Int32). The first of these overloads immediately closes all connections in the pool, whether they are in use or not. The second method allows a timeout period to be specified, during which currently allocated connections from the pool can continue to be used. Once all connections are returned to the pool, or the timeout period expires, all connections are closed.