ops4j/org.ops4j.orient — pull request #1 by morphace (2013-07-22 12:53:06+00:00)
Title: invalidate connection handle rather than closing database inside cleanUp...

Hi Harald,

As indicated, I have replaced the closeDatabase() call inside the cleanUp() method of OrientManagedConnectionImpl by calling a method that invalidates the connection handle (OrientDatabaseConnectionImpl).

From what I understood from the JCA Spec, a client needs to close the connection after using it, which in turn enables the app server to put the managed connection back into the pool. The database connection must not be closed, but its associated (client) connection handle needs to be invalidated (should throw an exception if used after a close).

As OrientDatabaseConnectionImpl provides direct references to OObjectDatabaseTx, ODatabaseDocumentTx, etc., it would be even better to wrap these references into a decorator that provides means to be invalidated as well (i.e. a dynamic proxy). This way it would not be able to use the database handle any more after a close, which however is the case atm. Since there is no single interface that defines all methods of those connection types, I was reluctant to implement this type of proxy.