File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Java Products and Servers and the fly likes Socket connection(ManagedConnection) cannot be closed during the Application Server shutdown. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Socket connection(ManagedConnection) cannot be closed during the Application Server shutdown." Watch "Socket connection(ManagedConnection) cannot be closed during the Application Server shutdown." New topic
Author

Socket connection(ManagedConnection) cannot be closed during the Application Server shutdown.

rosan samuel
Ranch Hand

Joined: Nov 17, 2010
Posts: 37
Hi All,



Let us asssume the scenario, the application server establish the communication with EIS environment by an (RA) Resource Adapter.The communication only carried by way of sockets.The Resource Adapter ManagedConnectionFactory helps to establish the connection in between Application server and listening agent(Which is running one side, to listen the connections). When RA started by AS, RA creates the connectionfactory objects. The default max connections has to be created inside the connection pool by connection manager of application server. In my case the deafult max connection size is 6. These are all ManagedConnections in Application Server context.When RA wants to do communication with EIS means, the RA asks for connection to AS. The AS checks the Pool for connection availablity , in our case we are having 6 Managed Connection objects we have. So AS gave the one Managed Connection objects for the EIS operation to RA. This managed connection is responible for current communication.A single connection establish the communication to that EIS specifc socket. The usual behaviour is the connection has to be returned into pool after its particular usage.



Real Problem:

****************

The AS once established its connection to the EIS, in case the Application shut down if we call, these connection objects are flushed out. that means destoyed at the time of AS shut down (you could see the below logs.) The AS shut down call, the before destoying the entire pool,it is checking for connection which is in already locked. that means handle remains.below you see in hanlde, there is an handle ,which is unreleased . My doubt is here goes the AS responisbilty to instruct the RA to close the all resource hanldes which are in preovious communication with socket. The AS checks for it , it will mark it as a DESTROY state.



Flush marking checked out connection for destruction

org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@c5e60[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@7f1ac handles=1 lastUse=1329129965443 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202




it will just mark the connection as DESTROY, but it won't give the connections to RA, which must be closed by RA. but the AS instructs the RA to what are the connections which are not in communication, that is out of 6 ,only it supply 6 connection objects to be closed by RA. Not that one , which must be closed during the Flushing process.



My question is why it won't close that connection which is already set with DESTROY state.? Please anyone know anything about this share with me.









After Jboss Shutdown:

**************************



2012-02-13 16:18:50,996 INFO [org.jboss.system.server.Server] Runtime shutdown hook called, forceHalt: true

2012-02-13 16:18:50,998 INFO [org.jboss.system.server.Server] JBoss SHUTDOWN: Undeploying all packages

2012-02-13 16:18:51,000 INFO [org.jboss.ejb.EJBDeployer] Undeploying: file:/C:/ApplicationServers/jboss-4.2.3.GA/server/default/deploy/test.ear/listener-ejb.jar

2012-02-13 16:19:31,036 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Stopping jboss.jca:service=ConnectionFactoryBinding,name=jca/myConnectionFactory

2012-02-13 16:19:31,037 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=jca/myConnectionFactory' from JNDI name 'java:jca/myConnectionFactory'

2012-02-13 16:19:31,041 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Stopped jboss.jca:service=ConnectionFactoryBinding,name=jca/myConnectionFactory

2012-02-13 16:19:31,041 DEBUG [org.jboss.resource.connectionmanager.TxConnectionManager] Stopping jboss.jca:service=TxCM,name=jca/myConnectionFactory

2012-02-13 16:19:31,041 DEBUG [org.jboss.resource.connectionmanager.TxConnectionManager] Stopped jboss.jca:service=TxCM,name=jca/myConnectionFactory

2012-02-13 16:19:31,041 DEBUG [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Stopping jboss.jca:service=ManagedConnectionPool,name=jca/myConnectionFactory

2012-02-13 16:19:31,041 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] internalUnregisterPool: setting interval to Long.MAX_VALUE

2012-02-13 16:19:31,049 DEBUG [org.jboss.resource.connectionmanager.ConnectionValidator] internalUnregisterPool: setting interval to Long.MAX_VALUE

2012-02-13 16:19:31,049 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Flushing pool checkedOut=[org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@c5e60[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@7f1ac handles=1 lastUse=1329129965443 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@18b91cb txSync=null], xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@4c535d txSync=null]] inPool=[org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@12442a2[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@192d7d0 handles=0 lastUse=1329129920564 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@196b73e txSync=null], org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1d85ab9[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@12c4d8f handles=0 lastUse=1329129921392 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@197f538 txSync=null], org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1646de5[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@6b0a6a handles=0 lastUse=1329129922305 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@178efd5 txSync=null], org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@c9b2bc[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@1f58334 handles=0 lastUse=1329129965173 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@1790458 txSync=null]]

2012-02-13 16:19:31,049 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Flush marking checked out connection for destruction org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@c5e60[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@7f1ac handles=1 lastUse=1329129965443 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@18b91cb txSync=null]

2012-02-13 16:19:31,049 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying flushed connection org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@12442a2[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@192d7d0 handles=0 lastUse=1329129920564 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@196b73e txSync=null]

2012-02-13 16:19:31,050 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying flushed connection org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1d85ab9[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@12c4d8f handles=0 lastUse=1329129921392 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@197f538 txSync=null]

2012-02-13 16:19:31,050 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying flushed connection org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1646de5[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@6b0a6a handles=0 lastUse=1329129922305 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@178efd5 txSync=null]

2012-02-13 16:19:31,050 TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying flushed connection org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@c9b2bc[state=NORMAL mc=com.jbase.jremote.jca.RemoteManagedConnection@1f58334 handles=0 lastUse=1329129965173 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@150fcc7 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@38202 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@1790458 txSync=null]

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Stopped jboss.jca:service=ManagedConnectionPool,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Stopping jboss.jca:service=ManagedConnectionFactory,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Stopped jboss.jca:service=ManagedConnectionFactory,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Destroying jboss.jca:service=ConnectionFactoryBinding,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Destroyed jboss.jca:service=ConnectionFactoryBinding,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.TxConnectionManager] Destroying jboss.jca:service=TxCM,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.TxConnectionManager] Destroyed jboss.jca:service=TxCM,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroying jboss.jca:service=ManagedConnectionPool,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Destroyed jboss.jca:service=ManagedConnectionPool,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Destroying jboss.jca:service=ManagedConnectionFactory,name=jca/myConnectionFactory

2012-02-13 16:19:31,053 DEBUG [org.jboss.resource.connectionmanager.RARDeployment] Destroyed jboss.jca:service=ManagedConnectionFactory,name=jca/myConnectionFactory

2012-02-13 16:19:31,058 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Stopping jboss.jca:service=ConnectionFactoryBinding,name=JmsXA

2012-02-13 16:19:31,058 INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Unbound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' from JNDI name 'java:JmsXA'

2012-02-13 16:19:31,062 DEBUG [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Stopped jboss.jca:service=ConnectionFactoryBinding,name=JmsXA

2012-02-13 16:19:31,062 DEBUG [org.jboss.resource.connectionmanager.TxConnectionManager] Stopping jboss.jca:service=TxCM,name=JmsXA

2012-02-13 16:19:31,062 DEBUG [org.jboss.resour


Java Bee
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Socket connection(ManagedConnection) cannot be closed during the Application Server shutdown.