You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by st...@apache.org on 2018/07/03 13:25:11 UTC

incubator-batchee git commit: BATCHEE-133 fix remote stop

Repository: incubator-batchee
Updated Branches:
  refs/heads/master 86c407c63 -> 563c55eab


BATCHEE-133 fix remote stop

starting a batch with
./bin/batchee.sh start -archive testbatch.war -name testjob -socket 8900

and stopping with

./bin/batchee.sh -id 0 -socket 8900


Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/563c55ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/563c55ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/563c55ea

Branch: refs/heads/master
Commit: 563c55eab7cc4eaaa9fd50753850471dfd2c9e52
Parents: 86c407c
Author: Mark Struberg <st...@apache.org>
Authored: Tue Jul 3 15:07:06 2018 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Tue Jul 3 15:07:06 2018 +0200

----------------------------------------------------------------------
 .../callback/SimpleJobExecutionCallbackService.java    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/563c55ea/jbatch/src/main/java/org/apache/batchee/container/services/callback/SimpleJobExecutionCallbackService.java
----------------------------------------------------------------------
diff --git a/jbatch/src/main/java/org/apache/batchee/container/services/callback/SimpleJobExecutionCallbackService.java b/jbatch/src/main/java/org/apache/batchee/container/services/callback/SimpleJobExecutionCallbackService.java
index faf0f60..f98eedd 100644
--- a/jbatch/src/main/java/org/apache/batchee/container/services/callback/SimpleJobExecutionCallbackService.java
+++ b/jbatch/src/main/java/org/apache/batchee/container/services/callback/SimpleJobExecutionCallbackService.java
@@ -46,12 +46,12 @@ public class SimpleJobExecutionCallbackService implements JobExecutionCallbackSe
 
     @Override
     public void waitFor(final long id) {
-        Collection<CountDownLatch> toRealease = waiters.remove(id);
-        if (toRealease == null) {
-            toRealease = new CopyOnWriteArrayList<CountDownLatch>();
-            final Collection<CountDownLatch> existing = waiters.putIfAbsent(id, toRealease);
+        Collection<CountDownLatch> toRelease = waiters.get(id);
+        if (toRelease == null) {
+            toRelease = new CopyOnWriteArrayList<CountDownLatch>();
+            final Collection<CountDownLatch> existing = waiters.putIfAbsent(id, toRelease);
             if (existing != null) {
-                toRealease = existing;
+                toRelease = existing;
             }
         }
 
@@ -63,9 +63,10 @@ public class SimpleJobExecutionCallbackService implements JobExecutionCallbackSe
         }
 
         final CountDownLatch latch = new CountDownLatch(1);
-        toRealease.add(latch);
+        toRelease.add(latch);
         try {
             latch.await();
+            waiters.remove(id);
         } catch (final InterruptedException e) {
             throw new BatchContainerRuntimeException(e);
         }