Skip to content
Permalink
Browse files
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
  • Loading branch information
struberg committed Jul 3, 2018
1 parent 86c407c commit 563c55eab7cc4eaaa9fd50753850471dfd2c9e52
Showing 1 changed file with 7 additions and 6 deletions.
@@ -46,12 +46,12 @@ public void onJobExecutionDone(final RuntimeJobExecution jobExecution) {

@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 void waitFor(final long id) {
}

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);
}

0 comments on commit 563c55e

Please sign in to comment.