Class AbstractHandleSupplier

java.lang.Object
org.jdbi.v3.core.AbstractHandleSupplier
All Implemented Interfaces:
AutoCloseable, HandleSupplier
Direct Known Subclasses:
ConstantHandleSupplier, LazyHandleSupplier

abstract class AbstractHandleSupplier extends Object implements HandleSupplier
  • Field Details

  • Constructor Details

    • AbstractHandleSupplier

      protected AbstractHandleSupplier()
  • Method Details

    • invokeInContext

      public <V> V invokeInContext(ExtensionContext extensionContext, Callable<V> task) throws Exception
      Description copied from interface: HandleSupplier
      Bind a new ExtensionContext to the Handle, invoke the given task, then restore the Handle's extension state.
      Specified by:
      invokeInContext in interface HandleSupplier
      Type Parameters:
      V - the result type of the task
      Parameters:
      extensionContext - An ExtensionContext 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
    • currentExtensionContext

      protected ExtensionContext currentExtensionContext()
      Returns the current extension context or null if none exists.
    • withHandle

      protected abstract void withHandle(Consumer<Handle> handleConsumer)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface HandleSupplier
    • pushExtensionContext

      private void pushExtensionContext(ExtensionContext extensionContext)
    • popExtensionContext

      private void popExtensionContext()