I am unit testing a JCA adapter and am interested in what happens when the container shutsdown. My test case is below...
I was hoping to see the ManageConnection destroy() method being called once when the openejb container shutdown. It wasn't called but the cleanup() method was called twice (once for each handle). I am relying on the destroy() method to actually close the physical connection. Is this a bug or am i making a wrong assumption? The console output from running my test is below... INFO - ******************************************************************************** INFO - OpenEJB http://openejb.apache.org/ INFO - Startup: Thu Nov 22 23:53:09 EST 2012 INFO - Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved. INFO - Version: 4.5.0 INFO - Build date: 20120928 INFO - Build time: 08:12 INFO - ******************************************************************************** INFO - openejb.home = D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca INFO - openejb.base = D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca INFO - Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@4b142196 INFO - Succeeded in installing singleton service INFO - Cannot find the configuration file [conf/openejb.xml]. Will attempt to create one for the beans deployed. INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) INFO - Found ConnectorModule in classpath: d:\users\anthony\documents\dev\unify\unify\sabre-jca\target\classes INFO - Searched 9 classpath urls in 2165 milliseconds. Average 240 milliseconds per url. INFO - Beginning load: d:\users\anthony\documents\dev\unify\unify\sabre-jca\target\test-classes INFO - Beginning load: d:\users\anthony\documents\dev\unify\unify\sabre-jca\target\classes INFO - Configuring enterprise application: D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca\classpath.ear Constructing SabreResourceAdapter... WARNING - Method 'lookup' is not available for 'javax.annotation.Resource'. Probably using an older Runtime. INFO - Dumping Generated ra.xml to: D:\Users\Anthony\AppData\Local\Temp\ra-6211126439618963159sabre-jca.xml INFO - Configuring Service(id=sabre-jcaRA, type=Resource, provider-id=sabre-jcaRA) INFO - Configuring Service(id=sabre-jca, type=Resource, provider-id=sabre-jca) INFO - Enterprise application "D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca\classpath.ear" loaded. INFO - Creating TransactionManager(id=Default Transaction Manager) INFO - Creating SecurityService(id=Default Security Service) INFO - Assembling app: D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca\classpath.ear INFO - Creating Resource(id=sabre-jcaRA) Constructing SabreResourceAdapter... Starting up sabre resource adapter... INFO - Creating Resource(id=sabre-jca) INFO - Creating ConnectionManager for Resource(id=sabre-jca) INFO - No runtime TransactionSupport WARNING - Property "EisProductVersion" not supported by "sabre-jca" WARNING - Property "EisProductName" not supported by "sabre-jca" WARNING - Property "MaxConnections" not supported by "sabre-jca" INFO - Existing thread singleton service in SystemInstance() org.apache.openejb.cdi.ThreadSingletonServiceImpl@4b142196 INFO - OpenWebBeans Container is starting... INFO - Adding OpenWebBeansPlugin : [CdiPlugin] INFO - All injection points are validated successfully. INFO - OpenWebBeans Container has started, it took 45 ms. INFO - LocalClient(class=com.virginaustralia.sabre.jca.SabreResourceAdapterTest, module=test-classes) INFO - Deployed Application(path=D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca\classpath.ear) SabreManagedConnection.cleanup()... SabreManagedConnection.cleanup()... INFO - Destroying container system INFO - Undeploying app: D:\Users\Anthony\Documents\DEV\Unify\unify\sabre-jca\classpath.ear INFO - Stopping ResourceAdapter: sabre-jcaRA -- View this message in context: http://openejb.979440.n4.nabble.com/openejb-not-destroying-ManagedConnections-on-shutdown-tp4658799.html Sent from the OpenEJB User mailing list archive at Nabble.com.