Closed refond closed 5 years ago
Hi @refond,
There has been interest in this feature in the past (i.e. #77), but no one has volunteered. Your approach sounds good. If you make a PR (with a couple of tests), I'll take a look at merging it in.
Thanks!
Hi @enragedginger,
Thanks for pointing at #77. I will do a PR as soon as I have managed to create some tests.
Regards
Hi @enragedginger,
I finally found time to make a PR #81 with corresponding tests. I have a bit extended the scope of the PR to include not only unscheduleJob
aka deleteJobSchedule
but also the corresponding create and update operations, using existing methods as building blocks.
Looking forward your feedback
@refond I've merged your changes and published build 1.8.0-akka-2.5.x
. Thank you for your work on this!
@enragedginger Great! Thank you for publishing and for this project !
I will upgrade to 1.8.0-akka-2.5.x soon.
||
On 08.02.19 14:14, Stephen Hopper wrote:
@refond https://github.com/refond I've merged your changes and published build |1.8.0-akka-2.5.x|. Thank you for your work on this!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/enragedginger/akka-quartz-scheduler/issues/79#issuecomment-461798756, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWBf1UZcETlS0MpxLQ5N7ntNiRvwIlFks5vLXgrgaJpZM4Y73AD.
Note: I refer to
QuartzSchedulerExtension
instance asscheduler
While using
scheduler.cancelJob("MY_JOB_1")
for a corresponding existing job, the job stops from firing as expected. There is no more reference to it inscheduler.runningJobs
unlikescheduler.schedules
which still holds a reference to the removed job !A simple extra call to
scheduler.removeSchedule("MY_JOB_1")
would fix it, but this method is private.To fix this with a minimum of impact on existing code I would propose adding the following method, with analogy to existing rescheduleJob
/**
* Unschedules an existing schedule
*
* Cancels the running job and all associated triggers and removes corresponding
* schedule entry from internal schedules map.
*
* @param name The name of the job, as defined in the schedule
* @return Success or Failure in a Boolean
*/
def unscheduleJob(name: String): Boolean = {
val isJobCancelled = cancelJob(name)
if (isJobCancelled) { removeSchedule(name) }
isJobCancelled
}
I briefly tested the above on a fork of your project and it works as expected.
What's your opinion ? Anything already available I overlooked ?