SAS 9.1.3 Integration Technologies » Developer's Guide


Developing Java Clients
Installation and JRE Requirements
Security
Using the IOM Server
Using the Java Connection Factory
Connecting with Directly Supplied Server Attributes
Connecting with Server Attributes Read from a SAS Metadata Server
Connecting with Server Attributes Read from an LDAP Server
Connecting with Server Attributes Read from the Information Service
Language Service Example
Logging Java Connection Factory Activities
Using Failover
Using Load Balancing
Using Connection Pooling
Pooling with Directly Supplied Server Attributes
Pooling with Server Attributes Read from a Metadata Server
Pooling with Server Attributes Read from the Information Service
Returning Connections to the Java Connection Factory
Using Java CORBA Stubs for IOM Objects
Getting a JDBC Connection Object
Using the Java Workspace Factory
Using SAS Foundation Services
IOM and CORBA Class Documentation
Java Clients

Using Connection Pooling

Pooling enables you to create a pool of connections to IOM servers. These connections are then shared and reused among multiple client applications. Pooling improves the efficiency of connections between clients and servers because clients use the connections only when they need to process a transaction.

When to Use Pooling

Note: Pooling can only be used with SAS Workspace Servers.

Pooling is most useful for applications that require the use of an IOM server for a short period of time. Because pooling reduces the wait that an application incurs when establishing a connection to SAS, pooling can reduce connection times in environments where one or more client applications make frequent but brief requests for IOM services. For example, pooling is useful for Web applications, such as JavaServer Pages (JSPs).

Pooling is least useful for applications that acquire an IOM server and use the server for a long period of time. A pooled connection does not offer any advantage in applications that use connections for an extended period of time.

Locations for Specifying Pooling Parameters

For Java clients using an IOM Bridge connection, specify pool parameters in one of the following locations:

Using Pooled Connections

When a request for a connection arrives, the request is handled as follows:

  • if an existing pooled connection is available, then the Java Connection Factory returns that connection.
  • if an existing pooled connection is not available, then the Java Connection Factory creates a new connection.

Users must notify the factory when they are finished with the connection so that it can be returned to the pool or destroyed.

The factory might have a limit on the number of connections it is allowed to create and manage at a time. If a factory has already allocated all of the connections that it can manage and a new connection request arrives, the factory cannot serve the request immediately. You can specify how long to wait for another user to return a connection to the factory's pool. For details about waiting for connections, see Waiting for Connections to Become Available.

Waiting for Connections to Become Available

At the time of a client's request for an object, it is possible that all of the available connections in a connection pool will be already allocated to other clients. For example, the Java Connection Factory might not be able to make an additional connection to a server because it would violate the sasMaxClients value that has been set for the server. In such cases, the client's request cannot be fulfilled until one of the other clients is finished with its object.

To indicate what action you want the Java Connection Factory to take when a request cannot be fulfilled immediately, you can use a long parameter with the getConnection method in the client program. The following table shows how the value of the long parameter indicates which action to take:

If the long parameter is The Java Connection Factory will
A number greater than zero Try to fulfill the request for up to that number of milliseconds. After that number of milliseconds has passed, if no other client has returned its connection to the pool, then the Java Connection Factory will throw an exception to the caller.
Equal to zero Try to fulfill the request for an unlimited amount of time.
A number less than zero Try to fulfill the request, but, if the request cannot be fulfilled immediately, throw an exception to the caller.