Class CurrentManagedContext

java.lang.Object
io.quarkus.arc.impl.CurrentManagedContext
All Implemented Interfaces:
InjectableContext, ManagedContext, jakarta.enterprise.context.spi.AlterableContext, jakarta.enterprise.context.spi.Context
Direct Known Subclasses:
SessionContext

public abstract class CurrentManagedContext extends Object implements ManagedContext
A managed context backed by the CurrentContext.
  • Constructor Details

  • Method Details

    • getState

      public InjectableContext.ContextState getState()
      Specified by:
      getState in interface InjectableContext
      Returns:
      the current state
    • activate

      Description copied from interface: ManagedContext
      Activate the context.

      If invoked with null parameter, a fresh InjectableContext.ContextState is automatically created.

      Specified by:
      activate in interface ManagedContext
      Parameters:
      initialState - The initial state, may be null
      Returns:
      the context state
    • deactivate

      public void deactivate()
      Description copied from interface: ManagedContext
      Deactivate the context - do not destroy existing contextual instances.
      Specified by:
      deactivate in interface ManagedContext
    • getIfActive

      public <T> T getIfActive(jakarta.enterprise.context.spi.Contextual<T> contextual, Function<jakarta.enterprise.context.spi.Contextual<T>,jakarta.enterprise.context.spi.CreationalContext<T>> creationalContextFun)
      Description copied from interface: InjectableContext
      If the context is active then return an existing instance of certain contextual type or create a new instance, otherwise return a null value. This allows for the Context.isActive() check and the actual creation to happen in a single method, which gives a performance benefit by performing fewer thread local operations.
      Specified by:
      getIfActive in interface InjectableContext
      Type Parameters:
      T - the type of contextual type
      Parameters:
      contextual - the contextual type
      creationalContextFun - the creational context function
      Returns:
      the contextual instance, or a null value
    • get

      public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext)
      Specified by:
      get in interface jakarta.enterprise.context.spi.Context
    • get

      public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual)
      Specified by:
      get in interface jakarta.enterprise.context.spi.Context
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface jakarta.enterprise.context.spi.Context
    • destroy

      public void destroy()
      Description copied from interface: InjectableContext
      Destroys the current context and all existing contextual instances.
      Specified by:
      destroy in interface InjectableContext
    • destroy

      public void destroy(jakarta.enterprise.context.spi.Contextual<?> contextual)
      Specified by:
      destroy in interface jakarta.enterprise.context.spi.AlterableContext
    • destroy

      public void destroy(InjectableContext.ContextState state)
      Description copied from interface: InjectableContext
      Destroy all contextual instances from the given state.

      The default implementation is not optimized and does not guarantee proper sychronization. Implementations of this interface are encouraged to provide an optimized implementation of this method.

      Specified by:
      destroy in interface InjectableContext
      Parameters:
      state -
    • initializeState

      Description copied from interface: ManagedContext
      Creates a new InjectableContext.ContextState.

      Creating a context state does not fire @Initialized event for given context.

      Specified by:
      initializeState in interface ManagedContext
      Returns:
      a new initialized context state
    • traceLog

      protected org.jboss.logging.Logger traceLog()
    • traceActivate

      protected void traceActivate(InjectableContext.ContextState initialState)
    • traceDeactivate

      protected void traceDeactivate()
    • traceDestroy

      protected void traceDestroy(InjectableContext.ContextState state)
    • notActive

      protected abstract jakarta.enterprise.context.ContextNotActiveException notActive()