Java Code Examples for org.quartz.Scheduler#resumeJob()

The following examples show how to use org.quartz.Scheduler#resumeJob() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScheduleUtils.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 恢复任务
 */
public static void resumeJob(Scheduler scheduler, Long jobId)
{
    try
    {
        scheduler.resumeJob(getJobKey(jobId));
    }
    catch (SchedulerException e)
    {
        log.error("resumeJob 异常:", e);
    }
}
 
Example 2
Source File: ScheduleUtils.java    From LuckyFrameWeb with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 恢复任务
 */
public static void resumeJob(Scheduler scheduler, Long jobId)
{
    try
    {
        scheduler.resumeJob(getJobKey(jobId));
    }
    catch (SchedulerException e)
    {
        log.error("resumeJob 异常:", e);
    }
}
 
Example 3
Source File: ScheduleServiceImpl.java    From fixflow with Apache License 2.0 5 votes vote down vote up
public void continueJob(String name, String group) {
	if(!getIsEnabled()){
		throw new FixFlowScheduleException(ExceptionCode.QUARZTEXCEPTION_ISENABLE);
	}
	Scheduler scheduler = getScheduler();
	try {
		scheduler.resumeJob(new JobKey(name,group));
	} catch (SchedulerException e) {
		throw new FixFlowException(e.getMessage(),e);
	}
}
 
Example 4
Source File: QuartzUtils.java    From quartz-web with Apache License 2.0 4 votes vote down vote up
public static void resumeJob(String jobName, String jobGroup, Scheduler scheduler) throws SchedulerException {
    scheduler.resumeJob(getJobKey(jobName, jobGroup));
}
 
Example 5
Source File: QuartzAdapter.java    From javamelody with Apache License 2.0 4 votes vote down vote up
void resumeJob(JobDetail jobDetail, Scheduler scheduler) throws SchedulerException {
	scheduler.resumeJob(jobDetail.getName(), jobDetail.getGroup());
}
 
Example 6
Source File: Quartz2Adapter.java    From javamelody with Apache License 2.0 4 votes vote down vote up
@Override
void resumeJob(JobDetail jobDetail, Scheduler scheduler) throws SchedulerException {
	scheduler.resumeJob(jobDetail.getKey());
}
 
Example 7
Source File: ShowScheduler.java    From iaf with Apache License 2.0 4 votes vote down vote up
@PUT
@RolesAllowed({"IbisDataAdmin", "IbisAdmin", "IbisTester"})
@Path("/schedules/{groupName}/job/{jobName}")
@Relation("schedules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response trigger(@PathParam("jobName") String jobName, @PathParam("groupName") String groupName, LinkedHashMap<String, Object> json) throws ApiException {
	Scheduler scheduler = getScheduler();

	String commandIssuedBy = servletConfig.getInitParameter("remoteHost");
	commandIssuedBy += servletConfig.getInitParameter("remoteAddress");
	commandIssuedBy += servletConfig.getInitParameter("remoteUser");

	if(log.isInfoEnabled()) log.info("trigger job jobName [" + jobName + "] groupName [" + groupName + "] " + commandIssuedBy);
	JobKey jobKey = JobKey.jobKey(jobName, groupName);

	String action = ""; //PAUSE,RESUME,TRIGGER

	for (Entry<String, Object> entry : json.entrySet()) {
		String key = entry.getKey();
		if(key.equalsIgnoreCase("action")) {//Start or stop an adapter!
			action = (String) entry.getValue();
		}
	}

	try {
		if("pause".equals(action)) {
			scheduler.pauseJob(jobKey);
		}
		else if("resume".equals(action)) {
			scheduler.resumeJob(jobKey);
		}
		else if("trigger".equals(action)) {
			scheduler.triggerJob(jobKey);
		}
		else {
			throw new ApiException("no (valid) action provided! Expected one of PAUSE,RESUME,TRIGGER");
		}
	} catch (SchedulerException e) {
		throw new ApiException("Failed to "+action+" job", e); 
	}

	return Response.status(Response.Status.OK).build();
}
 
Example 8
Source File: JobTrigger.java    From spring-cloud-shop with MIT License 3 votes vote down vote up
/**
 * 恢复任务
 *
 * @param scheduler scheduler
 * @param jobName   jobName
 * @param jobGroup  jobGroup
 */
public static void resumeJob(Scheduler scheduler, String jobName, String jobGroup) throws SchedulerException {

    log.info("恢复定时任务 jobName = {}, jobGroup = {}", jobName, jobGroup);
    JobKey jobKey = JobKey.jobKey(jobName, jobGroup);
    scheduler.resumeJob(jobKey);
}
 
Example 9
Source File: QuartzUtils.java    From quartz-web with Apache License 2.0 2 votes vote down vote up
/**
 * 重启job
 * @param jobDetail
 * @param scheduler
 * @throws SchedulerException
 */
public static void resumeJob(JobDetail jobDetail, Scheduler scheduler) throws SchedulerException {
    scheduler.resumeJob(jobDetail.getKey());
}