warning

You are viewing an archived MuleSoft forum and the content you see here may be outdated. Please ask your question in our new forum for a quick response from our community

Take me to the new forum

Welcome, Guest
Guest Settings
Help

Home » MuleSoft Forum Archive » MuleSoft Products » Mule User

Thread: [mule-user] stop/restart a quartz job


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 5 - Last Post: Oct 27, 2010 7:02 AM Last Post By: hhuang
hal9k

Posts: 5
Registered: 09/25/09
[mule-user] stop/restart a quartz job
Posted: Oct 19, 2009 1:25 AM
   thread.click_reply Reply
Hi all,

i'm using Mule 2.2 for my project. I have a service that start a quartz job every minute.
this is the service in my mule configuration xml

<service name="TrafficLoader">
<inbound>
<quartz:inbound-endpoint name="trafficLoaderJobService"
repeatCount="0" cronExpression="00 * * * * ? * *" jobName="trafficLoaderJob">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
</inbound>
<component
class="it.***************************" />
</service>

I would that is possible stopping and restarting this job from a control panel.

For stopping a job i do

MuleClient client = new MuleClient();
client.getMuleContext().getRegistry().lookupConnector("connector.quartz.0").stop();

and this work perfectly, but for restarting i have a problem, infact the follow line throws an exception

client.getMuleContext().getRegistry().lookupConnector("connector.quartz.0").start();

org.mule.api.lifecycle.LifecycleException: Initialisation Failure: Initialisation Failure: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:379)
at it.sysmanagement.guttelesb.util.ExceptionHandler.handleMessagingException(ExceptionHandler.java:38)
at org.mule.AbstractExceptionListener.exceptionThrown(AbstractExceptionListener.java:145)
at org.mule.service.AbstractService.handleException(AbstractService.java:546)
at org.mule.model.seda.SedaService.access$300(SedaService.java:56)
at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:583)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mule.retry.RetryPolicyExhaustedException: Initialisation Failure: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:97)
at org.mule.transport.AbstractConnector.connect(AbstractConnector.java:1417)
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:375)
... 9 more
Caused by: org.mule.api.transport.ConnectorException: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.transport.quartz.QuartzConnector.doStart(QuartzConnector.java:110)
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:396)
at org.mule.transport.AbstractConnector$1.doWork(AbstractConnector.java:1485)
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:59)
... 11 more
Caused by: org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:443)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:146)
at org.mule.transport.quartz.QuartzConnector.doStart(QuartzConnector.java:106)
... 14 more

anyone can help me?

Thanks
Antoine Borg
Re: [mule-user] stop/restart a quartz job
Posted: Oct 19, 2009 2:20 AM    global.in_response_to.tooltip in response to: hal9k
   thread.click_reply Reply
Rather than start and stop the connector, why not start/stop the service
itself?

HTH

A

Giuseppe Pace wrote:
Hi all,

i'm using Mule 2.2 for my project. I have a service that start a quartz job every minute.
this is the service in my mule configuration xml

<service name="TrafficLoader">
<inbound>
<quartz:inbound-endpoint name="trafficLoaderJobService"
repeatCount="0" cronExpression="00 * * * * ? * *" jobName="trafficLoaderJob">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
</inbound>
<component
class="it.***************************" />
</service>

I would that is possible stopping and restarting this job from a control panel.

For stopping a job i do

MuleClient client = new MuleClient();
client.getMuleContext().getRegistry().lookupConnector("connector.quartz.0").stop();

and this work perfectly, but for restarting i have a problem, infact the follow line throws an exception

client.getMuleContext().getRegistry().lookupConnector("connector.quartz.0").start();

org.mule.api.lifecycle.LifecycleException: Initialisation Failure: Initialisation Failure: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:379)
at it.sysmanagement.guttelesb.util.ExceptionHandler.handleMessagingException(ExceptionHandler.java:38)
at org.mule.AbstractExceptionListener.exceptionThrown(AbstractExceptionListener.java:145)
at org.mule.service.AbstractService.handleException(AbstractService.java:546)
at org.mule.model.seda.SedaService.access$300(SedaService.java:56)
at org.mule.model.seda.SedaService$ComponentStageWorker.run(SedaService.java:583)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mule.retry.RetryPolicyExhaustedException: Initialisation Failure: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:97)
at org.mule.transport.AbstractConnector.connect(AbstractConnector.java:1417)
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:375)
... 9 more
Caused by: org.mule.api.transport.ConnectorException: Failed to start Quartz provider. Connector that caused exception is: QuartzConnector{this=5d855f, started=false, initialised=true, name='connector.quartz.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=quartz, serviceOverrides=null}
at org.mule.transport.quartz.QuartzConnector.doStart(QuartzConnector.java:110)
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:396)
at org.mule.transport.AbstractConnector$1.doWork(AbstractConnector.java:1485)
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:59)
... 11 more
Caused by: org.quartz.SchedulerException: The Scheduler cannot be restarted after shutdown() has been called.
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:443)
at org.quartz.impl.StdScheduler.start(StdScheduler.java:146)
at org.mule.transport.quartz.QuartzConnector.doStart(QuartzConnector.java:106)
... 14 more

anyone can help me?

Thanks


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Antoine Borg, Director of Services | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM

See our full schedule of Mule and Android courses:
http://www.ricston.com/courses/schedules/

email: _antoine dot borg_ at ricston dot com <mailto:antoine dot borg at ricston dot com> |
blog: blog.ricston.com <http://blog.ricston.com> | web: ricston.com
<http://www.ricston.com/>
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
hal9k

Posts: 5
Registered: 09/25/09
Re: [mule-user] stop/restart a quartz job
Posted: Oct 19, 2009 3:06 AM    global.in_response_to.tooltip in response to: Antoine Borg
   thread.click_reply Reply
Hi Antoine, thanks for your reply. I have tried to start and stop the service, but the job is not removed from the quartz scheduler and keep to run every hour.

I've solved by extendig the QuartzConnector and overiding the doStop() method. Now this method don't shutdown the scheduler, but do a call to QuartzScheduler.standby() method.
Andrew Perepely...
Re: [mule-user] stop/restart a quartz job
Posted: Oct 19, 2009 8:11 AM    global.in_response_to.tooltip in response to: hal9k
   thread.click_reply Reply
 global.attachment att1.html (1.1 KB )
Giuseppe,

Could you please file a JIRA so this can be changed in the codebase?

Thanks,
Andrew

On Mon, Oct 19, 2009 at 6:07 AM, Giuseppe Pace <
mule dot user dot relay at mulesource dot com> wrote:

Hi Antoine, thanks for your reply. I have tried to start and stop the
service, but the job is not removed from the quartz scheduler and keep to
run every hour.

I've solved by extendig the QuartzConnector and overiding the doStop()
method. Now this method don't shutdown the scheduler, but do a call to
QuartzScheduler.standby() method.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

hal9k

Posts: 5
Registered: 09/25/09
Re: [mule-user] stop/restart a quartz job
Posted: Oct 20, 2009 12:27 AM    global.in_response_to.tooltip in response to: Andrew Perepely...
   thread.click_reply Reply
Hi, there is already a jira issue http://www.mulesoft.org/jira/browse/MULE-1683
hhuang

Posts: 1
Registered: 03/21/09
Re: [mule-user] stop/restart a quartz job
Posted: Oct 27, 2010 7:02 AM    global.in_response_to.tooltip in response to: hal9k
   thread.click_reply Reply
Hi Giuseppe,
I have to do the same thing. I have a Quartz job configured as following. I need to stop and restart the job in a java class. Would you share your solution? Thanks!
<quartz:endpoint name="scheduledTask"
cronExpression="0 0/1 * * * ?"
jobName="retrySchedule">
<property key="payload" value="test"/>
<quartz:event-generator-job/>
</quartz:endpoint>

<service name="OutboundRequestRetryAgent">

<inbound>
<inbound-endpoint ref="scheduledTask"/>
</inbound>
....

Legend
Helpful Answer
Correct Answer