Class WorkContextHandlerImpl

  • All Implemented Interfaces:
    WorkContextHandler

    @Service
    @PerLookup
    public class WorkContextHandlerImpl
    extends Object
    implements WorkContextHandler
    Handles work contexts submitted as part of the work instance
    Since:
    GlassFish v3
    Author:
    Jagadish Ramu
    • Constructor Detail

      • WorkContextHandlerImpl

        public WorkContextHandlerImpl()
    • Method Detail

      • init

        public void init​(String raName,
                         ClassLoader cl)
        initialize the work-context-handler
        Specified by:
        init in interface WorkContextHandler
        Parameters:
        raName - resource-adapter name
        cl - class-loader of the resource-adapter
      • isContextSupported

        public boolean isContextSupported​(boolean strict,
                                          String workContextClassName)
        indicates whether the provided workContextClass is supported by the container
        Specified by:
        isContextSupported in interface WorkContextHandler
        Parameters:
        strict - indicates whether the type-check need to be strict or not i.e., exact type or its super-class type
        workContextClassName - work context class name
        Returns:
        boolean indicating whether the workContextClass is supported or not
      • canContainerHandleContext

        public boolean canContainerHandleContext​(String contextClassName)
        checks whether the container can handle the contextClass in question. If the exact class type is not supported, container will look for any of its super-class If any of the super-class is available, it is indicated as 'can handle'
        Parameters:
        contextClassName - work context class name
        Returns:
        boolean indicating whether the contextClass is supported or not
      • validateWork

        public void validateWork​(jakarta.resource.spi.work.Work work,
                                 jakarta.resource.spi.work.ExecutionContext ec)
                          throws jakarta.resource.spi.work.WorkCompletedException,
                                 jakarta.resource.spi.work.WorkRejectedException
        validate the submitted work
        Parameters:
        work - work instance to be validated
        ec - ExecutionContext
        Throws:
        jakarta.resource.spi.work.WorkCompletedException - when a submitted context is not supported
        jakarta.resource.spi.work.WorkRejectedException - when validation fails
      • setupContext

        public void setupContext​(jakarta.resource.spi.work.ExecutionContext ec,
                                 WorkCoordinator wc,
                                 OneWork work)
                          throws jakarta.resource.spi.work.WorkCompletedException
        setup the work context or execution context for the work
        Parameters:
        ec - ExecutionContext
        wc - Work coordinator
        Throws:
        jakarta.resource.spi.work.WorkCompletedException
      • debug

        public static void debug​(String message)
      • getExecutionContext

        public static jakarta.resource.spi.work.ExecutionContext getExecutionContext​(jakarta.resource.spi.work.Work work)
      • isContextSupported

        public boolean isContextSupported​(Class contextClass)