Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Job-related questions
Job-related questions [message #324049] Thu, 17 January 2008 01:28 Go to next message
Eclipse UserFriend
Originally posted by: first.last.oracle.com

1. Is there any way to cancel a running Job and prevent it from being re-scheduled
when it finishes, which it will do if #schedule() has been called on it while it is
running?

2. Related: Is there any way to determine whether a Job has a pending #schedule()
call, i.e. it will be re-scheduled when it is finished with its current execution?

The problem I have: I have a Job that executes repeatedly. I would like to cancel
and re-schedule it whenever certain events occur. It seems like it is possible for
the Job to be re-scheduled between my calls to #cancel() and #schedule(), meaning
that my #schedule() call will cause the Job to be run yet one extra time, which
I don't really want. Any ideas?

Thanks.
Re: Job-related questions [message #324068 is a reply to message #324049] Thu, 17 January 2008 05:17 Go to previous message
Eclipse UserFriend
I have a function that deals with the first and might suggest a solution
to the second:

public void stopNow() {
if (getState() == WAITING || getState() == RUNNING) {
cancel();
}
if (getState() == SLEEPING) {
wakeUp();
cancel();
}
}

On Thu, 2008-01-17 at 01:28 -0500, Brian Vosburgh wrote:
> 1. Is there any way to cancel a running Job and prevent it from being re-scheduled
> when it finishes, which it will do if #schedule() has been called on it while it is
> running?
>
> 2. Related: Is there any way to determine whether a Job has a pending #schedule()
> call, i.e. it will be re-scheduled when it is finished with its current execution?
>
> The problem I have: I have a Job that executes repeatedly. I would like to cancel
> and re-schedule it whenever certain events occur. It seems like it is possible for
> the Job to be re-scheduled between my calls to #cancel() and #schedule(), meaning
> that my #schedule() call will cause the Job to be run yet one extra time, which
> I don't really want. Any ideas?
>
> Thanks.
Previous Topic:Libraries vanish
Next Topic:Code locking
Goto Forum:
  


Current Time: Wed Jul 16 15:30:08 EDT 2025

Powered by FUDForum. Page generated in 0.04312 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top