Foren
How to stop Scheduled Job LF6.1
Pablo MMartin, geändert vor 8 Jahren.
How to stop Scheduled Job LF6.1
New Member Beiträge: 3 Beitrittsdatum: 06.11.14 Neueste Beiträge
Hi, my problem is that I have a Scheduled job programmatically created in a function and when I want to stop it in other function I can't. I try using SchedulerEngineUtil, MessageBusListener etc and the scheduled job continues working. Only stops when I shutdown the server.
Here is my code:
- Creation of the shceduled job:
- Stop function:
Thanks for help.
Regards.
Here is my code:
- Creation of the shceduled job:
String cron = "0 0/1 * 1/1 * ? *";
CronTrigger trigger = null;
trigger = new CronTrigger("work1", "grupo1", cron);
SimpleJob job = new SimpleJob();
Message message = new Message();
try {
log.info("Arranca el Job");
//MessageBusUtil.sendMessage(DestinationNames.SCHEDULER_DISPATCH, message);
MessageBusUtil.registerMessageListener(DestinationNames.SCHEDULER_DISPATCH, job);
SchedulerEngineUtil.schedule(trigger, StorageType.PERSISTED, "Scheduled Job", DestinationNames.SCHEDULER_DISPATCH, message, 0);
} catch (SchedulerException e) {
e.printStackTrace();
}
- Stop function:
SimpleJob job = new SimpleJob();
MessageBusUtil.unregisterMessageListener(DestinationNames.SCHEDULER_DISPATCH, job);
SchedulerEngineUtil.pause("work1", "grupo1", StorageType.PERSISTED);
SchedulerEngineUtil.delete("work1", "grupo1", StorageType.PERSISTED);
SchedulerEngineUtil.unschedule("work1", "grupo1", StorageType.PERSISTED);
Thanks for help.
Regards.
David H Nebinger, geändert vor 8 Jahren.
RE: How to stop Scheduled Job LF6.1
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Instead of trying to stop the trigger, try stopping the scheduled job "Scheduled Job".
Pablo MMartin, geändert vor 8 Jahren.
RE: How to stop Scheduled Job LF6.1
New Member Beiträge: 3 Beitrittsdatum: 06.11.14 Neueste BeiträgeDavid H Nebinger:
Instead of trying to stop the trigger, try stopping the scheduled job "Scheduled Job".
How can I do that?
David H Nebinger, geändert vor 8 Jahren.
RE: How to stop Scheduled Job LF6.1
Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Okay, my bad I should have reviewed the code first.
So technically your code looks correct. The job would be found by group name and unscheduled.
Are you using the latest GA or do you have something earlier? Have you checked issues.liferay.com?
So technically your code looks correct. The job would be found by group name and unscheduled.
Are you using the latest GA or do you have something earlier? Have you checked issues.liferay.com?
Pablo MMartin, geändert vor 8 Jahren.
RE: How to stop Scheduled Job LF6.1
New Member Beiträge: 3 Beitrittsdatum: 06.11.14 Neueste BeiträgeDavid H Nebinger:
Okay, my bad I should have reviewed the code first.
So technically your code looks correct. The job would be found by group name and unscheduled.
Are you using the latest GA or do you have something earlier? Have you checked issues.liferay.com?
Hi,
I'm using liferay-portal-6.1.1-ce-ga2
No, I have not checked if are issues, I will check.
Regards.