Interface ManagedConnection

All Known Implementing Classes:
AbstractManagedConnection

public interface ManagedConnection
Wrapper for a connection to the datastore, allowing management. A connection is handed out using
getConnection
, and returned using
release
.
  • Method Details

    • getConnection

      Object getConnection()
      Accessor for the datastore connection.
      Returns:
      The underlying connection for this datastore
    • release

      void release()
      Method to release the datastore connection back. Will have been handed out with a getConnection(). This may trigger a commit() of the connection depending on its operating mode at the time.
    • transactionFlushed

      void transactionFlushed()
      Flush the connection. It must invoke the operation ManagedConnectionResourceListener.transactionFlushed()
    • transactionPreClose

      void transactionPreClose()
      Prepare the connection for end of transaction. It must invoke the operation ManagedConnectionResourceListener.transactionPreClose()
    • 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.
    • setCommitOnRelease

      void setCommitOnRelease(boolean commit)
    • setCloseOnRelease

      void setCloseOnRelease(boolean close)
    • commitOnRelease

      boolean commitOnRelease()
    • closeOnRelease

      boolean closeOnRelease()
    • getXAResource

      XAResource getXAResource()
      An XAResoure for this datastore connection. Returns null if the connection is not usable in an XA sense
      Returns:
      The XAResource
    • isLocked

      boolean isLocked()
    • lock

      void lock()
    • unlock

      void unlock()
    • addListener

      void addListener(ManagedConnectionResourceListener listener)
      Registers a ManagedConnectionResourceListener to be notified of events.
      Parameters:
      listener - The listener
    • removeListener

      void removeListener(ManagedConnectionResourceListener listener)
      Deregister a ManagedConnectionResourceListener.
      Parameters:
      listener - The listener
    • closeAfterTransactionEnd

      boolean closeAfterTransactionEnd()
      Convenience method for whether this connection should be closed after the end of transaction. In DN 2.x, 3.0, 3.1 this was always true, and a connection lasted until txn commit, and then had to get a new connection. In DN 3.2+ this is configurable per datastore connection factory.
      Returns:
      Whether the ConnectionManager should call close() on it when a txn ends
    • setSavepoint

      void setSavepoint(String name)
      Set this position in the txn as a savepoint with the provided name (if supported, otherwise do nothing).
      Parameters:
      name - Name of savepoint
    • releaseSavepoint

      void releaseSavepoint(String name)
      Release the named savepoint (or do nothing if not supported).
      Parameters:
      name - Name of savepoint
    • rollbackToSavepoint

      void rollbackToSavepoint(String name)
      Rollback the connection to the named savepoint (or do nothing if not supported).
      Parameters:
      name - Name of savepoint