org.datanucleus
Interface ManagedConnection


public interface ManagedConnection

Wrapper for a connection to the datastore, allowing management.


Method Summary
 void addListener(ManagedConnectionResourceListener listener)
          Registers a ManagedConnectionResourceListener
 void close()
          Close the connection to the datastore.
 void flush()
          Flush the connection.
 java.lang.Object getConnection()
          Connection to the datastore
 javax.transaction.xa.XAResource getXAResource()
          An XAResoure for this datastore connection.
 boolean isLocked()
          whether access to this ManagedConnection has been locked.
 void lock()
          lock the access to this ManagedConnection
 void release()
          Method to release the connection when non-transactional.
 void removeListener(ManagedConnectionResourceListener listener)
          Deregister a ManagedConnectionResourceListener
 void setManagedResource()
          Whether this connection is managed by a transaction manager
 void unlock()
          unlock the access to this ManagedConnection
 

Method Detail

getConnection

java.lang.Object getConnection()
Connection to the datastore

Returns:
The underlying connection for this datastore

getXAResource

javax.transaction.xa.XAResource getXAResource()
An XAResoure for this datastore connection. Returns null if the connection is not transactional

Returns:
The XAResource

release

void release()
Method to release the connection when non-transactional. If this is a managed connection resource does nothing.


close

void close()
Close the connection to the datastore. It most invoke the operations ManagedConnectionResourceListener.managedConnectionPreClose() and ManagedConnectionResourceListener.managedConnectionPostClose(). The listeners are unregistered after this method is invoked.


setManagedResource

void setManagedResource()
Whether this connection is managed by a transaction manager


isLocked

boolean isLocked()
whether access to this ManagedConnection has been locked.

Returns:
true if locked

lock

void lock()
lock the access to this ManagedConnection


unlock

void unlock()
unlock the access to this ManagedConnection


flush

void flush()
Flush the connection. It must invoke the operation ManagedConnectionResourceListener.managedConnectionFlushed()


addListener

void addListener(ManagedConnectionResourceListener listener)
Registers a ManagedConnectionResourceListener

Parameters:
listener - The listener

removeListener

void removeListener(ManagedConnectionResourceListener listener)
Deregister a ManagedConnectionResourceListener

Parameters:
listener - The listener


Copyright © 2009. All Rights Reserved.