reuse of job with different parameters outofmemoryexception - heap space
Hi all,
I create a job that reads a file and processes it and deletes it
I reuse the job passing it to JobLauncher again but with a new parameters object with new timestamp
When i run this for a lot of times say a few hundred files I get the above exception.
I have removed all the code that the job does so it is literally is sending a new job to the launcher and editing parameters and launching it and it does nothing and finishes.
I still get the same error
Can I use a job in this way using it over again with different parameters?
Code:
While (True)
{
//poll for new files in dir add to rdifiles arraylist
Resource r = new FileSystemResource(new File((String) rdifiles.get(i)));
reader.getDelegate().setStrict(false);
reader.getDelegate().setResource(r);
ExecutionContext e = new ExecutionContext();
reader.getDelegate().open(e);
JobParameters jobParameters = new JobParametersBuilder.addDate("now", new Date()).addString("JobType", "RDI").toJobParameters();
try
{
jobLauncher.run(job, jobParameters).getStatus();
}
}