类 SynchronizationManagerSupport<E,​C>


  • public abstract class SynchronizationManagerSupport<E,​C>
    extends java.lang.Object
    Central convenience class for framework use in managing the scope context.
    从以下版本开始:
    3.0
    作者:
    Dave Syer, Jimmy Praet, Mahmoud Ben Hassine
    • 方法概要

      所有方法 实例方法 抽象方法 具体方法 
      修饰符和类型方法说明
      voidclose()
      Method for unregistering the current context - should always and only be used by in conjunction with a matching register(Object) to ensure that getContext() always returns the correct value.
      protected abstract voidclose​(C context) 
      protected abstract CcreateNewContext​(E execution, BatchPropertyContext propertyContext) 
      CgetContext()
      Getter for the current context if there is one, otherwise returns null.
      java.util.Stack<E>getCurrent() 
      voidincrement() 
      Cregister​(E execution)
      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.
      Cregister​(E execution, BatchPropertyContext propertyContext)
      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.
      voidrelease()
      A convenient "deep" close operation.
      • 从类继承的方法 java.lang.Object

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

      • getContext

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

        @Nullable
        public C register​(@Nullable
                          E execution)
        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.
        参数:
        execution - the execution to register
        返回:
        a new context or the current one if it has the same execution
      • register

        @Nullable
        public C register​(@Nullable
                          E execution,
                          @Nullable
                          BatchPropertyContext propertyContext)
        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.
        参数:
        execution - the execution to register
        propertyContext - instance of BatchPropertyContext to be registered with this thread.
        返回:
        a new context or the current one if it has the same execution
      • close

        public void close()
        Method for unregistering the current context - should always and only be used by in conjunction with a matching register(Object) to ensure that getContext() always returns the correct value. Does not call close on the context - 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 execution actually ended.
      • release

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

        protected abstract void close​(C context)