Try OpenEdge Now
skip to main content
Java Open Clients
Proxy Objects and Methods : Running methods on session-free AppObjects : Sharing of the connection pool between session-free AppObjects
 

Sharing of the connection pool between session-free AppObjects

A session-free AppObject is instantiated using an explicitly provided Connection object. The Connection object instance establishes a reference to the AppObject's connection pool. If the same Connection object instance is then used to instantiate other session-free AppObject instances, the subsequent AppObject instances will share the connection pool referenced by the Connection object. SubAppObjects and ProcObjects always share the connection pool of their associated AppObject.
The Connection object's reference to the connection pool will be maintained until the releaseConnection() method is called on the Connection object. This reference may affect the life cycle of the connection pool. That is, the Connection object may be used to sustain the existence of the connection pool beyond the lifetime of the AppObject (and its associated SubAppObjects and ProcObjects). It is your responsibility to call releaseConnection() on the Connection object to remove the reference to the connection pool.
It should be noted that a single Connection object can be used to instantiate instances of different AppObject classes, provided that the Connection object refers to an AppServer that provides the necessary application services. This is possible since a single AppServer can serve multiple application services. However, no validation of this is provided.
The Connection object does not maintain a reference to a session-managed AppObject, regardless of how it is constructed. If a session-managed AppObject is constructed using a Connection object that contains a reference to a connection pool, an exception is thrown. In other words, Connection objects cannot be shared between session-free and session-managed AppObjects.