I'm happy to announce the 6th alpha release of our IronJacamar 1.1 series.
Full release notes are here.
This release marks one of the first new major features of the IronJacamar 1.1 series over the stable release used in JBoss Application Server 7.1 namely the first commit of our lazy connection manager.
So what is a lazy connection manager and why should you care ?
The lazy connection manager is an optional part of the Java EE Connector Architecture 1.6 specification and is divided into two parts
Our first commit is in the
associatable part, which will allow the JCA container to reassign physical connections to other logical connection handles.
Eh, what ? You may say... Ok, lets say you have an application which uses connections to an Enterprise Information System (EIS):
Connection c1 = myEIS.getConnection(); // Do work with c1 Connection c2 = myEIS.getConnection(); // Do work with c2 c1.close(); c2.close();
But what happens if there is only one physical connection to the EIS available ? The
c2 will get a timeout on the creation call, since all connections are controlled by the JCA container.
This is where the
associatable part comes into the picture; IronJacamar will detect that the application is asking for another connection, but there aren't any available in the pool. IronJacamar will then ask the EIS resource adapter to dissociate the physical connection for
c1 and attach it to
c2. Whenever either
c2 is used it is up to the resource adapter to make sure that the physical connection handle is valid against the logical one.
This basically allows you to multiplex connection handles on fewer physical connections; say 1000 to 100, and thereby saving system resources in the EIS layer.
Just to give you an idea of how a resource adapter could look we have added a
HelloWorld/Lazy example to our documentation.
And you can disable the functionality - if your resource adapter supports it - by setting the
sharable attribute to false.
A note to the hard-core group of the JCA community; we have extended the specification API with the following methods:
/** * Associate a managed connection to a logical connection * * @param connection The connection * @param mcf The managed connection factory * @param cri The connection request information * @return The managed connection * @exception ResourceException Thrown if an error occurs */ public ManagedConnection associateManagedConnection(Object connection, ManagedConnectionFactory mcf, ConnectionRequestInfo cri) throws ResourceException; /** * Dissociate a managed connection from a logical connection. The return value * of this method will indicate if the managed connection has more connections * attached (false), or if it was return to the pool (true). * * If the managed connection is return to the pool its <code>cleanup</code> method * will be called * * @param connection The connection * @param mc The managed connection * @param mcf The managed connection factory * @return True if the managed connection was freed; otherwise false * @exception ResourceException Thrown if an error occurs */ public boolean dissociateManagedConnection(Object connection, ManagedConnection mc, ManagedConnectionFactory mcf) throws ResourceException;
The first method will help you, if you doesn't have an easy link between the connection and the managed connection; the
associateConnection callback will still happen - keep that in mind.
The second method will allow you to dissociate the managed connection when you know you aren't going to use it for a while. Thereby making it easier for the JCA container to hand it out to other callers. This use-case isn't part of the existing JCA specification. Yummi stuff.
This is only the first step, but we are on our way now :)
The other changes in this release are mostly around fixing bugs found during our testing with JBoss Application Server and our upcoming JBoss Enterprise Application Platform release.
There is a nice update to our code generator though, which should give you a better starting point for your development.
Testing continues, and we have more cool stuff in the pipeline, so be sure to check back, or give us a shout in our forums.
For Those About to Rock, We Salute You !