public abstract class AbstractManagedConnection extends Object implements ManagedConnection
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closeOnRelease
Whether we should close() when release() of the connection is called.
|
protected boolean |
commitOnRelease
Whether we should commit() the connection on release().
|
protected Object |
conn
The underlying (datastore-specific) connection.
|
protected List<ManagedConnectionResourceListener> |
listeners
Listeners for the connection.
|
protected boolean |
locked
Whether the connection is locked for use.
|
protected int |
useCount
Count on the number of outstanding uses of this connection.
|
| Constructor and Description |
|---|
AbstractManagedConnection() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ManagedConnectionResourceListener listener)
Registers a ManagedConnectionResourceListener to be notified of events.
|
boolean |
closeAfterTransactionEnd()
Convenience method for whether this connection should be closed after the end of transaction.
|
boolean |
closeOnRelease() |
boolean |
commitOnRelease() |
XAResource |
getXAResource()
Obtain an XAResource which can be enlisted in a transaction
Override this if you intend on supporting this as an XA resource (default = not supported).
|
protected void |
incrementUseCount() |
boolean |
isLocked() |
void |
lock() |
void |
release()
Release this connection back to us so we can pool it if required.
|
void |
releaseSavepoint(String name)
Release the named savepoint (or do nothing if not supported).
|
void |
removeListener(ManagedConnectionResourceListener listener)
Deregister a ManagedConnectionResourceListener.
|
void |
rollbackToSavepoint(String name)
Rollback the connection to the named savepoint (or do nothing if not supported).
|
void |
setCloseOnRelease(boolean close) |
void |
setCommitOnRelease(boolean commit) |
void |
setSavepoint(String name)
Set this position in the txn as a savepoint with the provided name (if supported, otherwise do nothing).
|
String |
toString()
Method to return a string form of this object for convenience debug.
|
void |
transactionFlushed()
Flush the connection.
|
void |
transactionPreClose()
Prepare the connection for end of transaction.
|
void |
unlock() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, getConnectionprotected Object conn
protected boolean closeOnRelease
protected boolean commitOnRelease
protected boolean locked
protected List<ManagedConnectionResourceListener> listeners
protected int useCount
protected void incrementUseCount()
public void release()
release in interface ManagedConnectionpublic void transactionFlushed()
ManagedConnectionManagedConnectionResourceListener.transactionFlushed()transactionFlushed in interface ManagedConnectionpublic void transactionPreClose()
ManagedConnectionManagedConnectionResourceListener.transactionPreClose()transactionPreClose in interface ManagedConnectionpublic void setCloseOnRelease(boolean close)
setCloseOnRelease in interface ManagedConnectionpublic void setCommitOnRelease(boolean commit)
setCommitOnRelease in interface ManagedConnectionpublic boolean closeOnRelease()
closeOnRelease in interface ManagedConnectionpublic boolean commitOnRelease()
commitOnRelease in interface ManagedConnectionpublic void addListener(ManagedConnectionResourceListener listener)
ManagedConnectionaddListener in interface ManagedConnectionlistener - The listenerpublic void removeListener(ManagedConnectionResourceListener listener)
ManagedConnectionremoveListener in interface ManagedConnectionlistener - The listenerpublic boolean isLocked()
isLocked in interface ManagedConnectionpublic void lock()
lock in interface ManagedConnectionpublic void unlock()
unlock in interface ManagedConnectionpublic XAResource getXAResource()
getXAResource in interface ManagedConnectionpublic boolean closeAfterTransactionEnd()
ManagedConnectioncloseAfterTransactionEnd in interface ManagedConnectionpublic void setSavepoint(String name)
ManagedConnectionsetSavepoint in interface ManagedConnectionname - Name of savepointpublic void releaseSavepoint(String name)
ManagedConnectionreleaseSavepoint in interface ManagedConnectionname - Name of savepointpublic void rollbackToSavepoint(String name)
ManagedConnectionrollbackToSavepoint in interface ManagedConnectionname - Name of savepointCopyright © 2017. All rights reserved.