Class AbstractHandleSupplier

    • Field Detail

      • closed

        private final java.util.concurrent.atomic.AtomicBoolean closed
      • extensionContexts

        private final java.util.Deque<ExtensionContext> extensionContexts
    • Constructor Detail

      • AbstractHandleSupplier

        protected AbstractHandleSupplier()
    • Method Detail

      • invokeInContext

        public <V> V invokeInContext​(ExtensionContext extensionContext,
                                     java.util.concurrent.Callable<V> task)
                              throws java.lang.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:
        java.lang.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​(java.util.function.Consumer<Handle> handleConsumer)
      • close

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

        private void pushExtensionContext​(ExtensionContext extensionContext)
      • popExtensionContext

        private void popExtensionContext()