Class JsrJobContextFactoryBean
- java.lang.Object
- org.springframework.batch.core.jsr.JsrJobContextFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
public class JsrJobContextFactoryBean extends java.lang.Object implements org.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
Provides a singleJobContext
for each thread in a running job. Subsequent calls toFactoryBean.getObject()
on the same thread will return the same instance. TheJobContext
wraps aJobExecution
which is obtained in one of two ways:- The current step scope (getting it from the current
StepExecution
- The provided
JobExecution
via thesetJobExecution(JobExecution)
- Since:
- 3.0
- Author:
- Michael Minella
Constructor Summary
Constructors Constructor Description JsrJobContextFactoryBean()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Used to remove theJobContext
for the current thread.javax.batch.runtime.context.JobContext
getObject()
java.lang.Class<?>
getObjectType()
boolean
isSingleton()
void
setBatchPropertyContext(BatchPropertyContext propertyContext)
void
setJobExecution(JobExecution jobExecution)
Used to provideJobContext
instances to batch artifacts that are not within the scope of a given step.
Method Detail
getObject
public javax.batch.runtime.context.JobContext getObject() throws java.lang.Exception
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
- Throws:
java.lang.Exception
getObjectType
public java.lang.Class<?> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
setJobExecution
public void setJobExecution(JobExecution jobExecution)
Used to provideJobContext
instances to batch artifacts that are not within the scope of a given step.- Parameters:
jobExecution
- set the currentJobExecution
setBatchPropertyContext
public void setBatchPropertyContext(BatchPropertyContext propertyContext)
- Parameters:
propertyContext
- theBatchPropertyContext
to obtain job properties from
close
public void close()
Used to remove theJobContext
for the current thread. Not used via normal processing but useful for testing.