Interface HandleSupplier
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Returns the current Jdbi config.Returns a handle, possibly creating it lazily.getJdbi()
Returns the owning Jdbi instance.<V> V
invokeInContext
(ExtensionContext extensionContext, Callable<V> task) Bind a newExtensionContext
to the Handle, invoke the given task, then restore the Handle's extension state.
-
Method Details
-
getHandle
Handle getHandle()Returns a handle, possibly creating it lazily. A Handle holds a database connection, so extensions should only call this method in order to interact with the database.- Returns:
- An open Handle.
-
getJdbi
-
getConfig
ConfigRegistry getConfig()Returns the current Jdbi config.- Returns:
- The current Jdbi configuration.
-
invokeInContext
Bind a newExtensionContext
to the Handle, invoke the given task, then restore the Handle's extension state.- Type Parameters:
V
- the result type of the task- Parameters:
extensionContext
- AnExtensionContext
object 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
-
close
default void close()- Specified by:
close
in interfaceAutoCloseable
-