Details
-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
1.4.0.Alpha1, 1.3.4.Final
-
None
-
None
Description
As described in the pull request 120 I copy the description body:
Hi,
today I found that if time-limit was set to a big number of seconds my JVM struggled keeping track of thousands of threads named chunk-checkpoint-timer on certain job.
Investigating on the source code I found that org.jberet.runtime.runner.ChunkRunner class, when time-limit attribute on chunk tag was set bigger than 0, scheduled a timed thread just to update a boolean flag
if (timeLimit > 0) { final Timer timer = new Timer("chunk-checkpoint-timer", true); timer.schedule(new TimerTask() { @Override public void run() { processingInfo.timerExpired = true; } }, timeLimit * 1000); }
I don't know if can be an intended behavior, but java.util.Timer class was not officially but practically deprecated in favor of java.util.concurrent.ScheduledThreadPoolExecutor. In any case here I tried to totally bypass the usage of threads and checking the expiration of the chunk only with a simpler check on the current millis with System.currentTimeMillis().