Package org.mule.modules.schedulers.cron

Source Code of org.mule.modules.schedulers.cron.CronJob

/*
* Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
* The software in this package is published under the terms of the CPAL v1.0
* license, a copy of which has been included with this distribution in the
* LICENSE.txt file.
*/
package org.mule.modules.schedulers.cron;

import org.mule.transport.PollingReceiverWorker;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.StatefulJob;

/**
* <p>
* {@link StatefulJob} for polling. This is always stateful as the synchronous processing strategy is defined by
* the flow of the poll.
* </p>
*
* @since 3.5.0
*/
public class CronJob implements StatefulJob
{

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException
    {

        PollingReceiverWorker work = (PollingReceiverWorker) getSchedulerWork(context);
        if (work != null)
        {
            work.run();
        }

    }

    private Object getSchedulerWork(JobExecutionContext context)
    {
        return context.getJobDetail().getJobDataMap().get(CronScheduler.POLL_CRON_SCHEDULER_JOB);
    }
}
TOP

Related Classes of org.mule.modules.schedulers.cron.CronJob

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.