BATCH-2078: Close application contexts as batch jobs finish
This commit is contained in:
@@ -544,6 +544,15 @@ public class JsrJobOperatorTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplicationContextClosingAfterJobSuccessful() throws Exception {
|
||||
for(int i = 0; i < 3; i++) {
|
||||
javax.batch.runtime.JobExecution execution = runJob("contextClosingTests", new Properties(), TIMEOUT);
|
||||
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
}
|
||||
}
|
||||
|
||||
public static class LongRunningBatchlet implements Batchlet {
|
||||
|
||||
private boolean stopped = false;
|
||||
@@ -568,4 +577,25 @@ public class JsrJobOperatorTests {
|
||||
throw new RuntimeException("blah");
|
||||
}
|
||||
}
|
||||
|
||||
public static class MustBeClosedBatchlet extends AbstractBatchlet {
|
||||
|
||||
public static boolean closed = true;
|
||||
|
||||
public MustBeClosedBatchlet() {
|
||||
if(!closed) {
|
||||
throw new RuntimeException("Batchlet wasn't closed last time");
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
closed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String process() throws Exception {
|
||||
closed = false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user