Job-related questions [message #324049] |
Thu, 17 January 2008 01:28  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04312 seconds