Java Code Examples for org.quartz.JobDetail#requestsRecovery()

The following examples show how to use org.quartz.JobDetail#requestsRecovery() . 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: JobDetailSupport.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param jobDetail
 * @return CompositeData
 */
public static CompositeData toCompositeData(JobDetail jobDetail) {
    try {
        return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
                new Object[] {
                        jobDetail.getKey().getName(),
                        jobDetail.getKey().getGroup(),
                        jobDetail.getDescription(),
                        jobDetail.getJobClass().getName(),
                        JobDataMapSupport.toTabularData(jobDetail
                                .getJobDataMap()), 
                        jobDetail.isDurable(),
                        jobDetail.requestsRecovery(), });
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
Example 2
Source File: SchedulerServiceSupplier.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Builds the job list xml string.
 * 
 * @param toReturn the to return
 * 
 * @return the string
 * 
 * @throws SourceBeanException the source bean exception
 */
public  String buildJobListXmlString(List toReturn) throws SourceBeanException {
	StringBuffer buffer = new StringBuffer("<ROWS>");
	Iterator it = toReturn.iterator();
	while (it.hasNext()) {
		JobDetail job = (JobDetail) it.next();
		String jobName = job.getName();
		String jobGroupName = job.getGroup();
		String jobDescription = job.getDescription();
		String jobClassName = job.getJobClass().getName();
		String jobDurability = job.isDurable() ? "true" : "false";
		String jobRequestRecovery = job.requestsRecovery() ? "true" : "false";
		String jobVolatility = job.isVolatile() ? "true" : "false";
		buffer.append("<ROW ");
		buffer.append(" jobName=\"" + (jobName != null ? jobName : "") + "\"");
		buffer.append(" jobGroupName=\"" + (jobGroupName != null ? jobGroupName : "") + "\"");
		buffer.append(" jobDescription=\"" + (jobDescription != null ? jobDescription : "") + "\"");
		buffer.append(" jobClass=\"" + (jobClassName != null ? jobClassName : "") + "\"");
		buffer.append(" jobDurability=\"" + jobDurability + "\"");
		buffer.append(" jobRequestRecovery=\"" + jobRequestRecovery + "\"");
		buffer.append(" jobVolatility=\"" + jobVolatility + "\"");
		buffer.append(" />");
	}
	buffer.append("</ROWS>");
	return buffer.toString();
}
 
Example 3
Source File: JobDetailSupport.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
/**
 * @param jobDetail
 * @return CompositeData
 */
public static CompositeData toCompositeData(JobDetail jobDetail) {
	try {
		return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES,
				new Object[] {
						jobDetail.getName(),
						jobDetail.getGroup(),
						jobDetail.getDescription(),
						jobDetail.getJobClass().getName(),
						JobDataMapSupport.toTabularData(jobDetail
								.getJobDataMap()), jobDetail.isVolatile(),
						jobDetail.isDurable(),
						jobDetail.requestsRecovery(), });
	} catch (OpenDataException e) {
		throw new RuntimeException(e);
	}
}
 
Example 4
Source File: SchedulerServiceSupplier.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Serialize job detail.
 * 
 * @param job the job
 * 
 * @return the string
 * 
 * @throws SourceBeanException the source bean exception
 */
public  String serializeJobDetail(JobDetail job) throws SourceBeanException {
	StringBuffer buffer = new StringBuffer("<JOB_DETAIL ");
	String jobName = job.getName();
	String jobGroupName = job.getGroup();
	String jobDescription = job.getDescription();
	String jobClassName = job.getJobClass().getName();
	String jobDurability = job.isDurable() ? "true" : "false";
	String jobRequestRecovery = job.requestsRecovery() ? "true" : "false";
	String jobVolatility = job.isVolatile() ? "true" : "false";
	JobDataMap jobDataMap = job.getJobDataMap();
	buffer.append(" jobName=\"" + (jobName != null ? jobName : "") + "\"");
	buffer.append(" jobGroupName=\"" + (jobGroupName != null ? jobGroupName : "") + "\"");
	buffer.append(" jobDescription=\"" + (jobDescription != null ? jobDescription : "") + "\"");
	buffer.append(" jobClass=\"" + (jobClassName != null ? jobClassName : "") + "\"");
	buffer.append(" jobDurability=\"" + jobDurability + "\"");
	buffer.append(" jobRequestRecovery=\"" + jobRequestRecovery + "\"");
	buffer.append(" jobVolatility=\"" + jobVolatility + "\"");
	buffer.append(" >");
	buffer.append("<JOB_PARAMETERS>");
	if (jobDataMap != null && !jobDataMap.isEmpty()) {
		String[] keys = jobDataMap.getKeys();
		if (keys != null && keys.length > 0) {
			for (int i = 0; i < keys.length; i++) {
				buffer.append("<JOB_PARAMETER ");
				String key = keys[i];
				String value = jobDataMap.getString(key);
				if (value == null) {
					SpagoBITracer.warning("SCHEDULER", this.getClass().getName(), "loadJobDetailIntoResponse", 
					"Job parameter '" + key + "' has no String value!!");	
				}
				buffer.append(" name=\"" + key + "\"");
				buffer.append(" value=\"" + value + "\"");
				buffer.append(" />");
			}
		}
	}
	buffer.append("</JOB_PARAMETERS>");
	buffer.append("</JOB_DETAIL>");
	return buffer.toString();
}
 
Example 5
Source File: QuartzSchedulerSPI.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
private static Boolean shouldRecoverJob(final Trigger trigger, final JobDetail jobDetail) {
  return (jobDetail.requestsRecovery() && isInterruptedJob(jobDetail)) || isRunNow(trigger);
}