Package ch.tocco.nice2.persist.core.api
Interface ContextManager
- All Known Implementing Classes:
ContextManagerAdapter
public interface ContextManager
Allows access to
Context
that is bound to the current thread
and allows to manually create additional contexts.-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Clear and close the implicit context.Create a new context and attach it to the current thread.createNewContext
(Integer queryTimeout) createNewContext
(Connection connection) Create a new context using an existing connection.createNewContext
(Connection connection, Integer queryTimeout) default Invoker
void
setThreadContext
(@Nullable Context ctx)
-
Method Details
-
createNewContext
Context createNewContext()Create a new context and attach it to the current thread. -
createNewContext
Create a new context using an existing connection. This can be useful in special circumstances when a context needs to use the same transaction as an already existing connection. Note: The connection is not closed when the context is closed! -
createNewContext
-
createNewContext
-
setThreadContext
-
getThreadContext
Context getThreadContext() -
clearImplicitContext
void clearImplicitContext()Clear and close the implicit context. Should be called at the end of a test or request. Can also called when the implicit context is no longer needed to release the database connection. -
addContextCreationListener
-
removeContextCreationListener
-
newContext
-