Questions
* How is the JCA pool be managed ? Is the AppServer controlled or is it managed via any object by the adapter?
* How woud the JCA pooled connections be freed?
* When would a connection be freed?

Answer
When using our JCA adapter in a J2EE standards-compliant application server (which OC4J is), the connection pooling is entirely outside of the adapter control. The connection pooling is implemented and managed by the application server.

In general, a connection becomes available when it is returned to the pool. This is done when the connection object used at the EJB level (or equivalent e.g. at the BPEL level) is closed. When it is closed, the underlying physical connection is placed in the pool and then becomes available for reuse. A common mistake we see with people writing EJBs is that they do not implicitly close the connection object they got (say via JNDI) but instead let the connection be garbage-collected. This is a bad practice since garbage-collection is a slow process and during that process, the referenced connections are locked.

As with any synchronous adapter, it is important to understand what are the capabilities of the backend application when configuring the pool. If, for example, the backend application provides the highest number of interactions per second (say 50) when there are 14 connections and any increase in the number of connections start to reduce this number then one should set the pool to max out at 14 connections and let the application server queue up requests under higher load rather than trying to push the load to the backend since that would just reduce the performance and not increase it.
All this mechanisms are outside of the control of the JCA adapter but are related to its use and need to be considered.