When set up for connection
pooling, the Java Connection Factory tries to fulfill each client's
requests for connections by using an existing connection to an IOM
server. This method is less time consuming than creating a new connection.
Behind the scenes, the Java Connection Factory keeps a configurable
number of connections alive at all times. For connection pooling to
work properly, you must notify the Java Connection Factory when you
are finished using a connection by calling
close()
on a factory-managed connection.
For more details, see
Returning Connections to the Java Connection Factory . When a client uses an object, it has exclusive
access to the connection serving that object. When the client is finished
using the object, the object is closed before the connection is returned
to the pool. These actions help preserve the performance and security
of the single connection case.
To create a pool, create
the servers and then create the puddles.
You can maintain performance
standards by spreading a pool of connections over more than one server
and then setting an upper limit on the number of connections that
each server can contribute to the pool. To specify multiple servers,
provide a separate
Server
object for each
server that is to participate in the pool. You can specify the following
properties for each server (
Server
object)
in addition to the other server properties described earlier.
specifies the maximum
number of connections that the pool will be allowed to make to the
server at one time. Factors that you should consider when determining
a value for this field include the number and type of processors on
the machine, the amount of memory present, the type of clients that
will be requesting objects, and the number of different pools the
server participates in. This property is optional. The default value
is 10.
specifies the number
of times a connection to the server will be reused in a pool before
it is disconnected (recycled). If the value is 0, then there will
be no limit on the number of times a connection to the server can
be reused. This property is optional. The default value is 0.
must be either true or false. If the value is false, then
unallocated live connections will be disconnected after a period of
time (determined by the value of ServerShutdownAfter) unless they are allocated to a user before that period of time
passes. Otherwise, unallocated live connections will remain alive
indefinitely. This property is optional. The default value is true.
specifies the period
of time, in minutes, that an unallocated live connection will wait
to be allocated to a user before shutting down. This property is optional
and it is ignored if the value of ServerRunForever is true. The value must not
be less than 0, and it must not be greater than 1440 (the number of
minutes in a day). The default value is 3. If the value is 0, then
a connection returned to a pool by a user will be disconnected immediately
unless another user is waiting for a connection from the pool.
A pool consists of one or more puddles (
Puddle
objects). A puddle is an association of one or
more IOM servers with exactly one IOM login. In addition to the information
about the servers that participate in a connection pool, you must
specify information in order to create the puddles. You provide this
information to the Java Connection Factory on the
Puddle
object. Here is a list of the properties that can be specified:
specifies the login
credential object that is associated with the puddle.
specifies the minimum
number of connections that the Java Connection Factory can maintain
for a puddle (after the initial start-up period). This number includes
both the connections that are in use and the connections that are
idle. This property is optional. The default value is 0.
specifies the minimum
number of idle connections that the Java Connection Factory can maintain
for a puddle. This number includes only the connections that are idle.
This property is optional. The default value is 0.
To specify multiple
puddles, provide a separate
Puddle
object
for each puddle that is to participate in the pool. You can then make
a connection factory configuration with the list of puddles. For more
details about supplying pooling and puddle information directly in
the source code, see the Java API class documentation for the Java
Connection Service at
http://support.sas.com/rnd/javadoc/93
.