Feb 17th, 2012, 11:38 AM
Instance variables used in ItemProcessor
I wrote customized job launcher that can process multiple same type of jobs in a process (JVM). the job parameters are different from tables.
some instance variables are used by a ItemProcessor in a step. some of them a late binding job parameters. others store data that is good for a job instance.
Let's say, I have a type of job XYZ
customized job launcher will launch a job XYZ with job parameters a=1 b=1 (that are from application tables).
ItemProcessor is instanced (created), it's instance variable stores aa=1 from a job parameter, bb = abc from a flat file. it works fine.
After 1st job finishs, customized job launcher continue to start same job XYZ with different ob parameters a=2 b=2 in same process.
I guess ItemProcessor is NOT instanced (created) again at thistime based on my knowledge from Spring core,
it's instance variable stores aa=2 from a job parameter this time, BUT "bb = abc" results from last job run.
I APPRECIATE THAT ANY PERSON could confirm it. .
it means I need to reset the instance variable via beforeStep() or some program logic, e.g. reset it when processing a flat file HEADER record etc.
Any comment is appreciated.
Thanks in advance! xzhou