public interface 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.
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.
|
default ManagedConnection |
getConnection(ExecutionContext ec)
Accessor for a connection for the specified ExecutionContext.
|
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.
|
void close()
void disableConnectionCaching()
default ManagedConnection getConnection(ExecutionContext ec)
ec
- execution contextNucleusException
- Thrown if an error occurs getting the connectionManagedConnection getConnection(ExecutionContext ec, Map options)
ec
- execution contextoptions
- connection optionsNucleusException
- Thrown if an error occurs getting the connectionManagedConnection getConnection(int isolationLevel)
isolationLevel
- Isolation level (-1 implies use the default for the datastore).NucleusException
- Thrown if an error occurs getting the connectionManagedConnection getConnection(boolean primary, ExecutionContext ec, Transaction txn)
primary
- Whether to take use the "primary" connection factory, otherwise takes the "secondary"ec
- ExecutionContexttxn
- The Transactionvoid closeAllConnections(ExecutionContext ec)
ec
- The ExecutionContextCopyright © 2019. All rights reserved.