Java Code Examples for org.quartz.JobDetail#isVolatile()
The following examples show how to use
org.quartz.JobDetail#isVolatile() .
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: SchedulerServiceSupplier.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
/** * 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 2
Source File: JobDetailSupport.java From AsuraFramework with Apache License 2.0 | 6 votes |
/** * @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 3
Source File: SchedulerServiceSupplier.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
/** * 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 4
Source File: JobStoreSupport.java From AsuraFramework with Apache License 2.0 | 4 votes |
/** * <p> * Insert or update a trigger. * </p> */ protected void storeTrigger(Connection conn, SchedulingContext ctxt, Trigger newTrigger, JobDetail job, boolean replaceExisting, String state, boolean forceState, boolean recovering) throws ObjectAlreadyExistsException, JobPersistenceException { if (newTrigger.isVolatile() && isClustered()) { getLog().info( "note: volatile triggers are effectively non-volatile in a clustered environment."); } boolean existingTrigger = triggerExists(conn, newTrigger.getName(), newTrigger.getGroup()); if ((existingTrigger) && (!replaceExisting)) { throw new ObjectAlreadyExistsException(newTrigger); } try { boolean shouldBepaused = false; if (!forceState) { shouldBepaused = getDelegate().isTriggerGroupPaused( conn, newTrigger.getGroup()); if(!shouldBepaused) { shouldBepaused = getDelegate().isTriggerGroupPaused(conn, ALL_GROUPS_PAUSED); if (shouldBepaused) { getDelegate().insertPausedTriggerGroup(conn, newTrigger.getGroup()); } } if (shouldBepaused && (state.equals(STATE_WAITING) || state.equals(STATE_ACQUIRED))) { state = STATE_PAUSED; } } if(job == null) { job = getDelegate().selectJobDetail(conn, newTrigger.getJobName(), newTrigger.getJobGroup(), getClassLoadHelper()); } if (job == null) { throw new JobPersistenceException("The job (" + newTrigger.getFullJobName() + ") referenced by the trigger does not exist."); } if (job.isVolatile() && !newTrigger.isVolatile()) { throw new JobPersistenceException( "It does not make sense to " + "associate a non-volatile Trigger with a volatile Job!"); } if (job.isStateful() && !recovering) { state = checkBlockedState(conn, ctxt, job.getName(), job.getGroup(), state); } if (existingTrigger) { if (newTrigger instanceof SimpleTrigger && ((SimpleTrigger)newTrigger).hasAdditionalProperties() == false ) { getDelegate().updateSimpleTrigger(conn, (SimpleTrigger) newTrigger); } else if (newTrigger instanceof CronTrigger && ((CronTrigger)newTrigger).hasAdditionalProperties() == false ) { getDelegate().updateCronTrigger(conn, (CronTrigger) newTrigger); } else { getDelegate().updateBlobTrigger(conn, newTrigger); } getDelegate().updateTrigger(conn, newTrigger, state, job); } else { getDelegate().insertTrigger(conn, newTrigger, state, job); if (newTrigger instanceof SimpleTrigger && ((SimpleTrigger)newTrigger).hasAdditionalProperties() == false ) { getDelegate().insertSimpleTrigger(conn, (SimpleTrigger) newTrigger); } else if (newTrigger instanceof CronTrigger && ((CronTrigger)newTrigger).hasAdditionalProperties() == false ) { getDelegate().insertCronTrigger(conn, (CronTrigger) newTrigger); } else { getDelegate().insertBlobTrigger(conn, newTrigger); } } } catch (Exception e) { throw new JobPersistenceException("Couldn't store trigger '" + newTrigger.getName() + "' for '" + newTrigger.getJobName() + "' job:" + e.getMessage(), e); } }