org.datanucleus.store.connection
Class AbstractManagedConnection

java.lang.Object
  extended by org.datanucleus.store.connection.AbstractManagedConnection
All Implemented Interfaces:
ManagedConnection

public abstract class AbstractManagedConnection
extends java.lang.Object
implements ManagedConnection

Abstract implementation of a managed connection.


Field Summary
protected  java.lang.Object conn
          The underlying Connection.
protected  java.util.List<ManagedConnectionResourceListener> listeners
           
protected  boolean locked
           
protected  boolean managed
          if managed by TransactionManager can reuse several times inside the same transaction.
 
Constructor Summary
AbstractManagedConnection()
           
 
Method Summary
 void addListener(ManagedConnectionResourceListener listener)
          Registers a ManagedConnectionResourceListener
 void flush()
          Flush the connection.
 boolean isLocked()
          whether access to this ManagedConnection has been locked.
 void lock()
          lock the access to this ManagedConnection
 void release()
          Release this connection.
 void removeListener(ManagedConnectionResourceListener listener)
          Deregister a ManagedConnectionResourceListener
 void setManagedResource()
          Whether this connection is managed by a transaction manager
 java.lang.String toString()
           
 void unlock()
          unlock the access to this ManagedConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.connection.ManagedConnection
close, getConnection, getXAResource
 

Field Detail

conn

protected java.lang.Object conn
The underlying Connection.


managed

protected boolean managed
if managed by TransactionManager can reuse several times inside the same transaction.


locked

protected boolean locked

listeners

protected java.util.List<ManagedConnectionResourceListener> listeners
Constructor Detail

AbstractManagedConnection

public AbstractManagedConnection()
Method Detail

release

public void release()
Release this connection. Releasing this connection will allow this managed connection to be used one or more times inside the same transaction. If this managed connection is managed by a transaction manager, release is a no-op, otherwise the physical connection is closed

Specified by:
release in interface ManagedConnection

setManagedResource

public void setManagedResource()
Description copied from interface: ManagedConnection
Whether this connection is managed by a transaction manager

Specified by:
setManagedResource in interface ManagedConnection

addListener

public void addListener(ManagedConnectionResourceListener listener)
Description copied from interface: ManagedConnection
Registers a ManagedConnectionResourceListener

Specified by:
addListener in interface ManagedConnection
Parameters:
listener - The listener

removeListener

public void removeListener(ManagedConnectionResourceListener listener)
Description copied from interface: ManagedConnection
Deregister a ManagedConnectionResourceListener

Specified by:
removeListener in interface ManagedConnection
Parameters:
listener - The listener

flush

public void flush()
Description copied from interface: ManagedConnection
Flush the connection. It must invoke the operation ManagedConnectionResourceListener.managedConnectionFlushed()

Specified by:
flush in interface ManagedConnection

isLocked

public boolean isLocked()
Description copied from interface: ManagedConnection
whether access to this ManagedConnection has been locked.

Specified by:
isLocked in interface ManagedConnection
Returns:
true if locked

lock

public void lock()
Description copied from interface: ManagedConnection
lock the access to this ManagedConnection

Specified by:
lock in interface ManagedConnection

unlock

public void unlock()
Description copied from interface: ManagedConnection
unlock the access to this ManagedConnection

Specified by:
unlock in interface ManagedConnection

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.