org.openejb.resource
Class SharedLocalConnectionManager
java.lang.Object
org.openejb.resource.SharedLocalConnectionManager
- All Implemented Interfaces:
- java.io.Serializable, java.util.EventListener, javax.resource.spi.ConnectionEventListener, javax.resource.spi.ConnectionManager
public class SharedLocalConnectionManager
- extends java.lang.Object
- implements javax.resource.spi.ConnectionManager, javax.resource.spi.ConnectionEventListener, java.io.Serializable
This ConnectionManager provides a simple algorithm for managing shared-local transactions for multiple
connectors. It ensures that components participating in the same logical thread of execution share physical connections
to resources like JDBC connections or JMS connections. For example, Component A calls Component B within one transaction.
If both components access the same resource (e.g. some database), they will transparently share the same physical connection.
This makes it possible to group the resource work of both components with the same local transaction (all or nothing tx semantics),
as well as conserving resources.
This ConnectionManager relies on the the container's transaction manager to delineate the scope of the transaction using the
TransactionManager's synchronization facilities. The shared-local resources are not enlisted in 2PC transactions; they execute
only in local transactions.
Multiple connectors can be managed by one instance of the this class. The instance will ensure that components share
access to the correct connectors within the context of a same thread of execution.
- Version:
- $ $
- Author:
- Richard Monson-Haefel
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SharedLocalConnectionManager
public SharedLocalConnectionManager()
throws javax.resource.spi.ApplicationServerInternalException
- Throws:
javax.resource.spi.ApplicationServerInternalException
init
public void init(java.util.Properties props)
allocateConnection
public java.lang.Object allocateConnection(javax.resource.spi.ManagedConnectionFactory factory,
javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
throws javax.resource.ResourceException
- Specified by:
allocateConnection
in interface javax.resource.spi.ConnectionManager
- Throws:
javax.resource.ResourceException
connectionClosed
public void connectionClosed(javax.resource.spi.ConnectionEvent event)
- Specified by:
connectionClosed
in interface javax.resource.spi.ConnectionEventListener
connectionErrorOccurred
public void connectionErrorOccurred(javax.resource.spi.ConnectionEvent event)
- Specified by:
connectionErrorOccurred
in interface javax.resource.spi.ConnectionEventListener
localTransactionCommitted
public void localTransactionCommitted(javax.resource.spi.ConnectionEvent event)
- Specified by:
localTransactionCommitted
in interface javax.resource.spi.ConnectionEventListener
localTransactionRolledback
public void localTransactionRolledback(javax.resource.spi.ConnectionEvent event)
- Specified by:
localTransactionRolledback
in interface javax.resource.spi.ConnectionEventListener
localTransactionStarted
public void localTransactionStarted(javax.resource.spi.ConnectionEvent event)
- Specified by:
localTransactionStarted
in interface javax.resource.spi.ConnectionEventListener
Copyright © 1999-2011 OpenEJB. All Rights Reserved.