Open k2sd opened 7 years ago
I'm not quite so sure but we might want to prevent completedExecutions from being added if there is no callbacks.
diff --git a/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/callback/JobEndCallbackManagerImpl.java b/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/callback/JobEndCallbackManagerImpl.java
old mode 100755
new mode 100644
index da64700..3fd33d3
--- a/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/callback/JobEndCallbackManagerImpl.java
+++ b/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/callback/JobEndCallbackManagerImpl.java
@@ -59,6 +59,9 @@
@Override
public synchronized void done(long jobExecutionId) {
+ if (callbacks.isEmpty()) {
+ return;
+ }
if (logger.isLoggable(Level.FINER)) {
logger.finer("Firing callbacks for job execution id: " + jobExecutionId);
}
I'm afraid the
completedExecutions
field in the JobEndCallbackManagerImpl consumes heap if a lot of job executions get done without restarting the 'job end callback service.'An execution is finished, the execution id is added to the map as follows:
There seems no method that reduces the size of the map, so I think it will eventually exhaust heap (Of course it depends on how many executions are done while the service is alive).
Is it necessary to check completed execution ids when calling the job-end-callbacks?