public class JobSynchronizationManager
extends java.lang.Object
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.| Constructor and Description |
|---|
JobSynchronizationManager() |
| Modifier and Type | Method and Description |
|---|---|
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. |
static JobContext |
getContext()
Getter for the current context if there is one, otherwise returns
null. |
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. |
static void |
release()
A convenient "deep" close operation.
|
@Nullable public static JobContext getContext()
null.JobContext or null if there is none (if one
has not been registered for this thread).public static JobContext register(JobExecution JobExecution)
close() call in a finally block to ensure that the correct
context is available in the enclosing block.JobExecution - the step context to registerJobContext or the current one if it has the same
JobExecutionpublic static void close()
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.public static void release()
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.