I believe I understand what you are looking for. It's an event that you are  
look for that will indicate that the job has been requested to stop, but not 
necessarily stopped.

I haven't looked at the code in question but a job should be persisting it's 
state in the JCR. Whenever a change to the JOB STATUS occurs there's an OSGi 
event triggered because a property has been modified. 

If there was  a status change to indicate that the job is in the process of 
stopping that would provide two avenues of reporting. The first would be the 
ability to monitor for an event that that state has been initiated, the other 
would be generating a view of the jobs where it would be clear that a JOB is in 
a stopping, and not yet stopped, state and you could see how long it was in 
that state by the last modified time.

- Jason

On Tue, Aug 14, 2018, at 4:02 PM, John Logan wrote:
> <trying this again without the incorrect reply header...>
> 
> Hi,
> 
> In essence I'm trying to detect the in-progress state of a job being stopped.
> 
> I see in the sling-event implementation that calling 
> jobHandler.stopJobById() eventually works its way down to calling 
> jobHandler.stop(), setting a flag in the JobHandler.
> 
> The JobExecutor is responsible for calling 
> jobExecutionContext.isStopped(), and if it returns true, the JobExecutor 
> should clean up, call  and exit.
> 
> There might be some time elapsed between the request to stop and the 
> JobExecutor returning the JobExecutionResult that updates job state.  Is 
> there a way to detect this interim condition via sling-event-api?  I had 
> a look at the code and didn't see anything obvious.
> 
> What I'm trying to do is indicate in my UI that a job is being 
> cancelled, but cancellation isn't complete yet.
> 
> Thanks!  John

Reply via email to