Skip to main content

[jsr352-public] JobExecution.awaitCompletion(long timeout)?

  • From: Cheng Fang < >
  • To:
  • Subject: [jsr352-public] JobExecution.awaitCompletion(long timeout)?
  • Date: Wed, 13 Mar 2013 22:27:16 -0400

One of the TCK SPI is to implement a JobEndCallback so the test can be notified of job completion. I was wondering if we could have a portable way to catch job completion, something like:

JobExecution.awaitCompletion(long timeout)?

which will blocks the calling thread till the job batch status is completed. 3 main benefits:

1, help ease TCK test config by avoiding implementing the JobEndCallback SPI;

2, if TCK needs a JobEndCallback, chances are application development will also need similar mechanism for their testing, and should not need to invent their own callback protocol;

3, it could be a real use case in batch applications. For instance, right after a job execution is done, the status on a monitoring tool is updated. In absence of a standard method, I foresee many applications will be tempted to sleep, or poll for job completion.

An example of  using the above method:

public void testJob1() throw Exception {
    long executionId = operator.start(job1);
    JobExecution execution = operator.getJobExecution(executionId);
    execution.awaitCompletion(TIMEOUT);
    assertEquals(COMPLETED, execution.getBatchStatus);
}

Or should it be awaitTermination, to wait for all types of termination (end, or stop, or fail, or abandon)?

For long-running jobs, the application can invoke awaitCompletion asynchronously.

Thanks,
Cheng




[jsr352-public] JobExecution.awaitCompletion(long timeout)?

Cheng Fang 03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Scott Kurz 03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Christopher Vignola 03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Michael Minella 03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Scott Kurz 03/14/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Cheng Fang 03/15/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Scott Kurz 03/15/2013

Message not available

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Scott Kurz 03/15/2013

Message not available

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Scott Kurz 03/15/2013

[jsr352-public] Re: JobExecution.awaitCompletion(long timeout)?

Cheng Fang 03/16/2013
 
 
Close
loading
Please Confirm
Close