类 JobSynchronizationManager


  • public class JobSynchronizationManager
    extends java.lang.Object
    Central convenience class for framework use in managing the job scope context. Generally only to be used by implementations of Job. N.B. it is the responsibility of every Job implementation to ensure that a JobContext is available on every thread that might be involved in a job execution, including worker threads from a pool.
    从以下版本开始:
    3.0
    作者:
    Dave Syer, Jimmy Praet, Mahmoud Ben Hassine
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型方法说明
      static voidclose()
      Method for unregistering the current context - should always and only be used by in conjunction with a matching register(JobExecution) to ensure that getContext() always returns the correct value.
      static JobContextgetContext()
      Getter for the current context if there is one, otherwise returns null.
      static JobContextregister​(JobExecution JobExecution)
      Register a context with the current thread - always put a matching close() call in a finally block to ensure that the correct context is available in the enclosing block.
      static voidrelease()
      A convenient "deep" close operation.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • getContext

        @Nullable
        public static JobContext getContext()
        Getter for the current context if there is one, otherwise returns null.
        返回:
        the current JobContext or null if there is none (if one has not been registered for this thread).
      • register

        public static JobContext register​(JobExecution JobExecution)
        Register a context with the current thread - always put a matching close() call in a finally block to ensure that the correct context is available in the enclosing block.
        参数:
        JobExecution - the step context to register
        返回:
        a new JobContext or the current one if it has the same JobExecution
      • close

        public static void close()
        Method for unregistering the current context - should always and only be used by in conjunction with a matching register(JobExecution) to ensure that getContext() always returns the correct value. Does not call JobContext.close() - that is left up to the caller because he has a reference to the context (having registered it) and only he has knowledge of when the step actually ended.
      • release

        public static void release()
        A convenient "deep" close operation. Call this instead of close() if the step execution for the current context is ending. Delegates to JobContext.close() and then ensures that close() is also called in a finally block.