org.apache.geronimo.connector.outbound.connectiontracking
Class ConnectionTrackingCoordinator

java.lang.Object
  extended by org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator
All Implemented Interfaces:
ConnectionTracker, TrackedConnectionAssociator

public class ConnectionTrackingCoordinator
extends Object
implements TrackedConnectionAssociator, ConnectionTracker

ConnectionTrackingCoordinator tracks connections that are in use by components such as EJB's. The component must notify the ccm when a method enters and exits. On entrance, the ccm will notify ConnectionManager stacks so the stack can make sure all connection handles left open from previous method calls are attached to ManagedConnections of the correct security context, and the ManagedConnections are enrolled in any current transaction. On exit, the ccm will notify ConnectionManager stacks of the handles left open, so they may be disassociated if appropriate. In addition, when a UserTransaction is started the ccm will notify ConnectionManager stacks so the existing ManagedConnections can be enrolled properly.


Nested Class Summary
static class ConnectionTrackingCoordinator.ConnectionInvocationHandler
           
 
Constructor Summary
ConnectionTrackingCoordinator()
           
ConnectionTrackingCoordinator(boolean lazyConnect)
           
 
Method Summary
 ConnectorInstanceContext enter(ConnectorInstanceContext newContext)
           
 void exit(ConnectorInstanceContext oldContext)
           
 void handleObtained(ConnectionTrackingInterceptor connectionTrackingInterceptor, ConnectionInfo connectionInfo, boolean reassociate)
          A new connection (handle) has been obtained.
 void handleReleased(ConnectionTrackingInterceptor connectionTrackingInterceptor, ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction)
          A connection (handle) has been released or destroyed.
 boolean isLazyConnect()
          If true, ConnectorInstanceContext instance does not have to be kept on a per component basis; otherwise the same instance must be passed to enter each time the specific component instance is entered.
 void newTransaction()
           
 void setEnvironment(ConnectionInfo connectionInfo, String key)
          If we are within a component context, before a connection is obtained, set the connection unshareable and applicationManagedSecurity properties so the correct connection type is obtained.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionTrackingCoordinator

public ConnectionTrackingCoordinator()

ConnectionTrackingCoordinator

public ConnectionTrackingCoordinator(boolean lazyConnect)
Method Detail

isLazyConnect

public boolean isLazyConnect()
Description copied from interface: TrackedConnectionAssociator
If true, ConnectorInstanceContext instance does not have to be kept on a per component basis; otherwise the same instance must be passed to enter each time the specific component instance is entered.

Specified by:
isLazyConnect in interface TrackedConnectionAssociator
Returns:
true if connections are proxied and only connect when invoked

enter

public ConnectorInstanceContext enter(ConnectorInstanceContext newContext)
                               throws ResourceException
Specified by:
enter in interface TrackedConnectionAssociator
Throws:
ResourceException

newTransaction

public void newTransaction()
                    throws ResourceException
Specified by:
newTransaction in interface TrackedConnectionAssociator
Throws:
ResourceException

exit

public void exit(ConnectorInstanceContext oldContext)
          throws ResourceException
Specified by:
exit in interface TrackedConnectionAssociator
Throws:
ResourceException

handleObtained

public void handleObtained(ConnectionTrackingInterceptor connectionTrackingInterceptor,
                           ConnectionInfo connectionInfo,
                           boolean reassociate)
                    throws ResourceException
A new connection (handle) has been obtained. If we are within a component context, store the connection handle so we can disassociate connections that support disassociation on exit.

Specified by:
handleObtained in interface ConnectionTracker
Parameters:
connectionTrackingInterceptor - our interceptor in the connection manager which is used to disassociate the connections
connectionInfo - the connection that was obtained
reassociate -
Throws:
ResourceException

handleReleased

public void handleReleased(ConnectionTrackingInterceptor connectionTrackingInterceptor,
                           ConnectionInfo connectionInfo,
                           ConnectionReturnAction connectionReturnAction)
A connection (handle) has been released or destroyed. If we are within a component context, remove the connection handle from the context.

Specified by:
handleReleased in interface ConnectionTracker
Parameters:
connectionTrackingInterceptor - our interceptor in the connection manager
connectionInfo - the connection that was released
connectionReturnAction -

setEnvironment

public void setEnvironment(ConnectionInfo connectionInfo,
                           String key)
If we are within a component context, before a connection is obtained, set the connection unshareable and applicationManagedSecurity properties so the correct connection type is obtained.

Specified by:
setEnvironment in interface ConnectionTracker
Parameters:
connectionInfo - the connection to be obtained
key - the unique id of the connection manager


Copyright © 2003-2010 Apache Software Foundation. All Rights Reserved.