Class 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 single JobContext for each thread in a running job. Subsequent calls to FactoryBean.getObject() on the same thread will return the same instance. The JobContext wraps a JobExecution which is obtained in one of two ways:
    Since:
    3.0
    Author:
    Michael Minella
    • Constructor Detail

      • JsrJobContextFactoryBean

        public JsrJobContextFactoryBean()
    • Method Detail

      • getObject

        public javax.batch.runtime.context.JobContext getObject()
                                                         throws java.lang.Exception
        Specified by:
        getObject in interface org.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
        Throws:
        java.lang.Exception
      • getObjectType

        public java.lang.Class<?> getObjectType()
        Specified by:
        getObjectType in interface org.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
      • isSingleton

        public boolean isSingleton()
        Specified by:
        isSingleton in interface org.springframework.beans.factory.FactoryBean<javax.batch.runtime.context.JobContext>
      • setJobExecution

        public void setJobExecution​(JobExecution jobExecution)
        Used to provide JobContext instances to batch artifacts that are not within the scope of a given step.
        Parameters:
        jobExecution - set the current JobExecution
      • close

        public void close()
        Used to remove the JobContext for the current thread. Not used via normal processing but useful for testing.