Class SynchronizationManagerSupport<E,C>
java.lang.Object
org.springframework.batch.core.scope.context.SynchronizationManagerSupport<E,C>
Central convenience class for framework use in managing the scope context.
- Since:
- 3.0
- Author:
- Dave Syer, Jimmy Praet, Mahmoud Ben Hassine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Method for unregistering the current context - should always and only be used by in conjunction with a matchingregister(Object)to ensure thatgetContext()always returns the correct value.protected abstract voidprotected abstract CcreateNewContext(E execution) Getter for the current context if there is one, otherwise returnsnull.voidRegister a context with the current thread - always put a matchingclose()call in a finally block to ensure that the correct context is available in the enclosing block.voidrelease()A convenient "deep" close operation.
-
Constructor Details
-
SynchronizationManagerSupport
public SynchronizationManagerSupport()
-
-
Method Details
-
getContext
Getter for the current context if there is one, otherwise returnsnull.- Returns:
- the current context or
nullif there is none (if one has not been registered for this thread).
-
register
Register a context with the current thread - always put a matchingclose()call in a finally block to ensure that the correct context is available in the enclosing block.- Parameters:
execution- the execution to register- Returns:
- 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 matchingregister(Object)to ensure thatgetContext()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. -
increment
public void increment() -
getCurrent
-
release
public void release()A convenient "deep" close operation. Call this instead ofclose()if the execution for the current context is ending. Delegates toclose(Object)and then ensures thatclose()is also called in a finally block. -
close
-
createNewContext
-