stop/restart a quartz job

View: New views
5 Messages — Rating Filter:   Alert me  

stop/restart a quartz job

by Omar slim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



Re: stop/restart a quartz job

by antoine.borg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.borg_@... <mailto:antoine.borg@...> |
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



Re: stop/restart a quartz job

by Omar slim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



Re: stop/restart a quartz job

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.user.relay@...> 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




Re: stop/restart a quartz job

by Omar slim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, there is already a jira issue http://www.mulesoft.org/jira/browse/MULE-1683

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email