Package org.jdbi.v3.core
Class AbstractHandleSupplier
java.lang.Object
org.jdbi.v3.core.AbstractHandleSupplier
- All Implemented Interfaces:
AutoCloseable,HandleSupplier
- Direct Known Subclasses:
ConstantHandleSupplier,LazyHandleSupplier
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBooleanprivate final Deque<ExtensionContext> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected ExtensionContextReturns the current extension context or null if none exists.<V> VinvokeInContext(ExtensionContext extensionContext, Callable<V> task) Bind a newExtensionContextto the Handle, invoke the given task, then restore the Handle's extension state.private voidprivate voidpushExtensionContext(ExtensionContext extensionContext) protected abstract voidwithHandle(Consumer<Handle> handleConsumer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.extension.HandleSupplier
getConfig, getHandle, getJdbi
-
Field Details
-
closed
-
extensionContexts
-
-
Constructor Details
-
AbstractHandleSupplier
protected AbstractHandleSupplier()
-
-
Method Details
-
invokeInContext
Description copied from interface:HandleSupplierBind a newExtensionContextto the Handle, invoke the given task, then restore the Handle's extension state.- Specified by:
invokeInContextin interfaceHandleSupplier- Type Parameters:
V- the result type of the task- Parameters:
extensionContext- AnExtensionContextobject that manages the extension state.task- the code to execute in an extension context- Returns:
- the callable's result
- Throws:
Exception- if any exception is thrown
-
currentExtensionContext
Returns the current extension context or null if none exists. -
withHandle
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceHandleSupplier
-
pushExtensionContext
-
popExtensionContext
private void popExtensionContext()
-