public class JobContext extends SynchronizedAttributeAccessor
JobExecution
and some of its associated
properties using expressions
based on bean paths. Has public getters for the job execution and
convenience methods for accessing commonly used properties like the ExecutionContext
associated with the job
execution.StepContext
), Mahmoud Ben HassineConstructor and Description |
---|
JobContext(JobExecution jobExecution) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Clean up the context at the end of a step execution.
|
boolean |
equals(java.lang.Object other)
Extend the base class method to include the job execution itself as a key
(i.e.
|
java.lang.String |
getId() |
JobExecution |
getJobExecution()
The current
JobExecution that is active in this context. |
java.util.Map<java.lang.String,java.lang.Object> |
getJobExecutionContext() |
java.lang.String |
getJobName()
Convenient accessor for current job name identifier.
|
java.util.Map<java.lang.String,java.lang.Object> |
getJobParameters() |
java.util.Properties |
getSystemProperties()
Convenient accessor for System properties to make it easy to access them
from placeholder expressions.
|
int |
hashCode()
Overrides the default behaviour to provide a hash code based only on the
job execution.
|
void |
registerDestructionCallback(java.lang.String name,
java.lang.Runnable callback)
Allow clients to register callbacks for clean up on close.
|
java.lang.Object |
removeAttribute(java.lang.String name)
Override base class behaviour to ensure destruction callbacks are
unregistered as well as the default behaviour.
|
java.lang.String |
toString() |
attributeNames, getAttribute, hasAttribute, setAttribute, setAttributeIfAbsent
public JobContext(JobExecution jobExecution)
public java.lang.String getJobName()
JobInstance
associated with the current
JobExecution
public java.util.Properties getSystemProperties()
public java.util.Map<java.lang.String,java.lang.Object> getJobExecutionContext()
ExecutionContext
public java.util.Map<java.lang.String,java.lang.Object> getJobParameters()
JobParameters
public void registerDestructionCallback(java.lang.String name, java.lang.Runnable callback)
name
- the callback id (unique attribute key in this context)callback
- a callback to execute on close@Nullable public java.lang.Object removeAttribute(java.lang.String name)
removeAttribute
in interface org.springframework.core.AttributeAccessor
removeAttribute
in class SynchronizedAttributeAccessor
SynchronizedAttributeAccessor.removeAttribute(String)
public void close()
StepScope
.public JobExecution getJobExecution()
JobExecution
that is active in this context.JobExecution
public java.lang.String getId()
public boolean equals(java.lang.Object other)
equals
in class SynchronizedAttributeAccessor
public int hashCode()
hashCode
in class SynchronizedAttributeAccessor
public java.lang.String toString()
toString
in class SynchronizedAttributeAccessor