public class ConnectionManagerImpl extends Object implements ConnectionManager
The "allocateConnection" method can create connections and enlist them (like most normal persistence operations need) or create a connection and return it without enlisting it into a transaction, for example on a read-only operation, or when running non-transactional, or to get schema information.
Connections can be locked per ExecutionContext basis. Locking of connections is used to handle the connection over to the user application. A locked connection denies any further access to the datastore, until the user application unlock it.
| Constructor and Description |
|---|
ConnectionManagerImpl(StoreManager storeMgr)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method to close the connection manager.
|
void |
closeAllConnections(ExecutionContext ec)
Method to close all pooled connections for the specified ExecutionContext.
|
void |
disableConnectionCaching()
Disable binding objects to ExecutionContext references, so automatically disables the connection caching.
|
ManagedConnection |
getConnection(boolean primary,
ExecutionContext ec,
Transaction txn)
Accessor for a connection from the specified factory, for the specified ExecutionContext dependent on whether the connection will be enlisted.
|
ManagedConnection |
getConnection(ExecutionContext ec,
Map options)
Accessor for a connection for the specified ExecutionContext.
|
ManagedConnection |
getConnection(int isolationLevel)
Accessor for a connection for the specified transaction isolation level.
|
protected ManagedConnection |
getManagedConnection(boolean primary,
ExecutionContext ec)
Get a ManagedConnection from the cache.
|
protected void |
putManagedConnection(boolean primary,
ExecutionContext ec,
ManagedConnection mconn)
Put a ManagedConnection into the cache.
|
protected void |
removeManagedConnection(boolean primary,
ExecutionContext ec)
Method to remove the ManagedConnection from the cache.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConnectionpublic ConnectionManagerImpl(StoreManager storeMgr)
storeMgr - Store manager for whom we are managing connectionspublic void close()
ConnectionManagerclose in interface ConnectionManagerpublic void disableConnectionCaching()
disableConnectionCaching in interface ConnectionManagerpublic ManagedConnection getConnection(ExecutionContext ec, Map options)
ConnectionManagergetConnection in interface ConnectionManagerec - execution contextoptions - connection optionspublic ManagedConnection getConnection(int isolationLevel)
ConnectionManagergetConnection in interface ConnectionManagerisolationLevel - Isolation level (-1 implies use the default for the datastore).public ManagedConnection getConnection(boolean primary, ExecutionContext ec, Transaction txn)
ConnectionManagergetConnection in interface ConnectionManagerprimary - Whether to take use the "primary" connection factory, otherwise takes the "secondary"ec - ExecutionContexttxn - The Transactionpublic void closeAllConnections(ExecutionContext ec)
ConnectionManagercloseAllConnections in interface ConnectionManagerec - The ExecutionContextprotected void removeManagedConnection(boolean primary,
ExecutionContext ec)
primary - Whether to use the primary ConnectionFactoryec - ExecutionContextprotected ManagedConnection getManagedConnection(boolean primary, ExecutionContext ec)
primary - Whether to use the primary ConnectionFactoryec - ExecutionContextprotected void putManagedConnection(boolean primary,
ExecutionContext ec,
ManagedConnection mconn)
primary - Whether to use the primary ConnectionFactoryec - ExecutionContextmconn - The ManagedConnectionCopyright © 2019. All rights reserved.