Index: 3rdParty_sources/quartz/org/quartz/CronExpression.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/CronExpression.java (.../CronExpression.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/CronExpression.java (.../CronExpression.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -78,7 +78,7 @@ * * Month *   - * 1-12 or JAN-DEC + * 0-11 or JAN-DEC *   * , - * / * @@ -119,7 +119,7 @@ * the value to start with. Essentially, for each field in the expression, there * is a set of numbers that can be turned on or off. For seconds and minutes, * the numbers range from 0 to 59. For hours 0 to 23, for days of the month 0 to - * 31, and for months 1 to 12. The "/" character simply helps you turn + * 31, and for months 0 to 11 (JAN to DEC). The "/" character simply helps you turn * on every "nth" value in the given set. Thus "7/6" in the * month field only turns on month "7", it does NOT mean every 6th * month, please note that subtlety. Index: 3rdParty_sources/quartz/org/quartz/commonj/WorkManagerThreadExecutor.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/commonj/WorkManagerThreadExecutor.java (.../WorkManagerThreadExecutor.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/commonj/WorkManagerThreadExecutor.java (.../WorkManagerThreadExecutor.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -34,7 +34,7 @@ * details. * * @author matt.accola - * @version $Revision$ $Date$ + * @version $Revision: 2243 $ $Date: 2013-04-30 11:39:48 -0700 (Tue, 30 Apr 2013) $ */ public class WorkManagerThreadExecutor implements ThreadExecutor { private final Logger log = LoggerFactory.getLogger(getClass()); Index: 3rdParty_sources/quartz/org/quartz/core/QuartzSchedulerResources.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/core/QuartzSchedulerResources.java (.../QuartzSchedulerResources.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/core/QuartzSchedulerResources.java (.../QuartzSchedulerResources.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -89,7 +89,7 @@ private ThreadExecutor threadExecutor; - private boolean runUpdateCheck = true; + private boolean runUpdateCheck = false; private long batchTimeWindow = 0; Index: 3rdParty_sources/quartz/org/quartz/impl/JobDetailImpl.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/impl/JobDetailImpl.java (.../JobDetailImpl.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/impl/JobDetailImpl.java (.../JobDetailImpl.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -429,7 +429,8 @@ @Override public int hashCode() { - return getKey().hashCode(); + JobKey key = getKey(); + return key == null ? 0 : getKey().hashCode(); } @Override Index: 3rdParty_sources/quartz/org/quartz/impl/StdSchedulerFactory.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/impl/StdSchedulerFactory.java (.../StdSchedulerFactory.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/impl/StdSchedulerFactory.java (.../StdSchedulerFactory.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -17,28 +17,7 @@ package org.quartz.impl; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Method; -import java.security.AccessControlException; -import java.sql.SQLException; -import java.util.Collection; -import java.util.Locale; -import java.util.Properties; - -import org.quartz.JobListener; -import org.quartz.Scheduler; -import org.quartz.SchedulerConfigException; -import org.quartz.SchedulerException; -import org.quartz.SchedulerFactory; -import org.quartz.TriggerListener; +import org.quartz.*; import org.quartz.core.JobRunShellFactory; import org.quartz.core.QuartzScheduler; import org.quartz.core.QuartzSchedulerResources; @@ -52,21 +31,23 @@ import org.quartz.management.ManagementRESTServiceConfiguration; import org.quartz.simpl.RAMJobStore; import org.quartz.simpl.SimpleThreadPool; -import org.quartz.spi.ClassLoadHelper; -import org.quartz.spi.InstanceIdGenerator; -import org.quartz.spi.JobFactory; -import org.quartz.spi.JobStore; -import org.quartz.spi.SchedulerPlugin; -import org.quartz.spi.ThreadExecutor; -import org.quartz.spi.ThreadPool; -import org.quartz.utils.ConnectionProvider; -import org.quartz.utils.DBConnectionManager; -import org.quartz.utils.JNDIConnectionProvider; -import org.quartz.utils.PoolingConnectionProvider; -import org.quartz.utils.PropertiesParser; +import org.quartz.spi.*; +import org.quartz.utils.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.io.*; +import java.lang.reflect.Method; +import java.security.AccessControlException; +import java.sql.SQLException; +import java.util.Collection; +import java.util.Locale; +import java.util.Properties; + /** *

* An implementation of {@link org.quartz.SchedulerFactory} that @@ -678,7 +659,7 @@ boolean threadsInheritInitalizersClassLoader = cfg.getBooleanProperty(PROP_SCHED_SCHEDULER_THREADS_INHERIT_CONTEXT_CLASS_LOADER_OF_INITIALIZING_THREAD); - boolean skipUpdateCheck = cfg.getBooleanProperty(PROP_SCHED_SKIP_UPDATE_CHECK, false); + boolean skipUpdateCheck = cfg.getBooleanProperty(PROP_SCHED_SKIP_UPDATE_CHECK, true); long batchTimeWindow = cfg.getLongProperty(PROP_SCHED_BATCH_TIME_WINDOW, 0L); int maxBatchSize = cfg.getIntProperty(PROP_SCHED_MAX_BATCH_SIZE, 1); @@ -945,7 +926,11 @@ pp.getUnderlyingProperties().remove( PROP_CONNECTION_PROVIDER_CLASS); - setBeanProps(cp, pp.getUnderlyingProperties()); + if (cp instanceof PoolingConnectionProvider) { + populateProviderWithExtraProps((PoolingConnectionProvider)cp, pp.getUnderlyingProperties()); + } else { + setBeanProps(cp, pp.getUnderlyingProperties()); + } cp.initialize(); } catch (Exception e) { initException = new SchedulerException("ConnectionProvider class '" + cpClass @@ -1014,7 +999,10 @@ PoolingConnectionProvider cp = new PoolingConnectionProvider(pp.getUnderlyingProperties()); dbMgr = DBConnectionManager.getInstance(); dbMgr.addConnectionProvider(dsNames[i], cp); - } catch (SQLException sqle) { + + // Populate the underlying C3P0 data source pool properties + populateProviderWithExtraProps(cp, pp.getUnderlyingProperties()); + } catch (Exception sqle) { initException = new SchedulerException( "Could not initialize DataSource: " + dsNames[i], sqle); @@ -1366,6 +1354,24 @@ } } + private void populateProviderWithExtraProps(PoolingConnectionProvider cp, Properties props) throws Exception { + Properties copyProps = new Properties(); + copyProps.putAll(props); + + // Remove all the default properties first (they don't always match to setter name, and they are already + // been set!) + copyProps.remove(PoolingConnectionProvider.DB_DRIVER); + copyProps.remove(PoolingConnectionProvider.DB_URL); + copyProps.remove(PoolingConnectionProvider.DB_USER); + copyProps.remove(PoolingConnectionProvider.DB_PASSWORD); + copyProps.remove(PoolingConnectionProvider.DB_IDLE_VALIDATION_SECONDS); + copyProps.remove(PoolingConnectionProvider.DB_MAX_CONNECTIONS); + copyProps.remove(PoolingConnectionProvider.DB_MAX_CACHED_STATEMENTS_PER_CONNECTION); + copyProps.remove(PoolingConnectionProvider.DB_VALIDATE_ON_CHECKOUT); + copyProps.remove(PoolingConnectionProvider.DB_VALIDATION_QUERY); + setBeanProps(cp.getDataSource(), copyProps); + } + private void shutdownFromInstantiateException(ThreadPool tp, QuartzScheduler qs, boolean tpInited, boolean qsInited) { try { if(qsInited) Index: 3rdParty_sources/quartz/org/quartz/impl/jdbcjobstore/JobStoreSupport.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/impl/jdbcjobstore/JobStoreSupport.java (.../JobStoreSupport.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/impl/jdbcjobstore/JobStoreSupport.java (.../JobStoreSupport.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1202,7 +1202,7 @@ } if(job == null) { - job = getDelegate().selectJobDetail(conn, newTrigger.getJobKey(), getClassLoadHelper()); + job = retrieveJob(conn, newTrigger.getJobKey()); } if (job == null) { throw new JobPersistenceException("The job (" @@ -2792,8 +2792,6 @@ Set acquiredJobKeysForNoConcurrentExec = new HashSet(); final int MAX_DO_LOOP_RETRY = 3; int currentLoopCount = 0; - long firstAcquiredTriggerFireTime = 0; - do { currentLoopCount ++; try { @@ -2802,7 +2800,9 @@ // No trigger is ready to fire yet. if (keys == null || keys.size() == 0) return acquiredTriggers; - + + long batchEnd = noLaterThan; + for(TriggerKey triggerKey: keys) { // If our trigger is no longer available, try a new one. OperableTrigger nextTrigger = retrieveTrigger(conn, triggerKey); @@ -2813,7 +2813,19 @@ // If trigger's job is set as @DisallowConcurrentExecution, and it has already been added to result, then // put it back into the timeTriggers set and continue to search for next trigger. JobKey jobKey = nextTrigger.getJobKey(); - JobDetail job = getDelegate().selectJobDetail(conn, jobKey, getClassLoadHelper()); + JobDetail job; + try { + job = retrieveJob(conn, jobKey); + } catch (JobPersistenceException jpe) { + try { + getLog().error("Error retrieving job, setting trigger state to ERROR.", jpe); + getDelegate().updateTriggerState(conn, triggerKey, STATE_ERROR); + } catch (SQLException sqle) { + getLog().error("Unable to set trigger state to ERROR.", sqle); + } + continue; + } + if (job.isConcurrentExectionDisallowed()) { if (acquiredJobKeysForNoConcurrentExec.contains(jobKey)) { continue; // next trigger @@ -2822,6 +2834,9 @@ } } + if (nextTrigger.getNextFireTime().getTime() > batchEnd) { + break; + } // We now have a acquired trigger, let's add to return list. // If our trigger was no longer in the expected state, try a new one. int rowsUpdated = getDelegate().updateTriggerStateFromOtherState(conn, triggerKey, STATE_ACQUIRED, STATE_WAITING); @@ -2831,9 +2846,10 @@ nextTrigger.setFireInstanceId(getFiredTriggerRecordId()); getDelegate().insertFiredTrigger(conn, nextTrigger, STATE_ACQUIRED, null); + if(acquiredTriggers.isEmpty()) { + batchEnd = Math.max(nextTrigger.getNextFireTime().getTime(), System.currentTimeMillis()) + timeWindow; + } acquiredTriggers.add(nextTrigger); - if(firstAcquiredTriggerFireTime == 0) - firstAcquiredTriggerFireTime = nextTrigger.getNextFireTime().getTime(); } // if we didn't end up with any trigger to fire from that first Index: 3rdParty_sources/quartz/org/quartz/impl/triggers/DailyTimeIntervalTriggerImpl.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/impl/triggers/DailyTimeIntervalTriggerImpl.java (.../DailyTimeIntervalTriggerImpl.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/impl/triggers/DailyTimeIntervalTriggerImpl.java (.../DailyTimeIntervalTriggerImpl.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -557,19 +557,8 @@ */ @Override public Date computeFirstFireTime(org.quartz.Calendar calendar) { - Date sTime = getStartTime(); - Date startTimeOfDayDate = getStartTimeOfDay().getTimeOfDayForDate(sTime); - - if(DateBuilder.evenSecondDate(startTime).equals(startTimeOfDayDate)) { - return startTime; - } - else if (sTime.after(startTimeOfDayDate)) { - // If startTime is after the timeOfDay, then look for the next time - nextFireTime = getFireTimeAfter(sTime); - } else { - // If startTime is before the timeOfDay then advance to timeOfDay (and if necessary dayOfWeek) - nextFireTime = advanceToNextDayOfWeekIfNecessary(startTimeOfDayDate, false); - } + + nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000L)); // Check calendar for date-time exclusion while (nextFireTime != null && calendar != null Index: 3rdParty_sources/quartz/org/quartz/listeners/BroadcastJobListener.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/listeners/BroadcastJobListener.java (.../BroadcastJobListener.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/listeners/BroadcastJobListener.java (.../BroadcastJobListener.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1,128 +1,128 @@ -/* - * Copyright 2001-2009 Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package org.quartz.listeners; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.JobListener; - -/** - * Holds a List of references to JobListener instances and broadcasts all - * events to them (in order). - * - *

The broadcasting behavior of this listener to delegate listeners may be - * more convenient than registering all of the listeners directly with the - * Scheduler, and provides the flexibility of easily changing which listeners - * get notified.

- * - * - * @see #addListener(org.quartz.JobListener) - * @see #removeListener(org.quartz.JobListener) - * @see #removeListener(String) - * - * @author James House (jhouse AT revolition DOT net) - */ -public class BroadcastJobListener implements JobListener { - - private String name; - private List listeners; - - /** - * Construct an instance with the given name. - * - * (Remember to add some delegate listeners!) - * - * @param name the name of this instance - */ - public BroadcastJobListener(String name) { - if(name == null) { - throw new IllegalArgumentException("Listener name cannot be null!"); - } - this.name = name; - listeners = new LinkedList(); - } - - /** - * Construct an instance with the given name, and List of listeners. - * - * @param name the name of this instance - * @param listeners the initial List of JobListeners to broadcast to. - */ - public BroadcastJobListener(String name, List listeners) { - this(name); - this.listeners.addAll(listeners); - } - - public String getName() { - return name; - } - - public void addListener(JobListener listener) { - listeners.add(listener); - } - - public boolean removeListener(JobListener listener) { - return listeners.remove(listener); - } - - public boolean removeListener(String listenerName) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - JobListener jl = itr.next(); - if(jl.getName().equals(listenerName)) { - itr.remove(); - return true; - } - } - return false; - } - - public List getListeners() { - return java.util.Collections.unmodifiableList(listeners); - } - - public void jobToBeExecuted(JobExecutionContext context) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - JobListener jl = itr.next(); - jl.jobToBeExecuted(context); - } - } - - public void jobExecutionVetoed(JobExecutionContext context) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - JobListener jl = itr.next(); - jl.jobExecutionVetoed(context); - } - } - - public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - JobListener jl = itr.next(); - jl.jobWasExecuted(context, jobException); - } - } - -} +/* + * Copyright 2001-2009 Terracotta, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package org.quartz.listeners; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.JobListener; + +/** + * Holds a List of references to JobListener instances and broadcasts all + * events to them (in order). + * + *

The broadcasting behavior of this listener to delegate listeners may be + * more convenient than registering all of the listeners directly with the + * Scheduler, and provides the flexibility of easily changing which listeners + * get notified.

+ * + * + * @see #addListener(org.quartz.JobListener) + * @see #removeListener(org.quartz.JobListener) + * @see #removeListener(String) + * + * @author James House (jhouse AT revolition DOT net) + */ +public class BroadcastJobListener implements JobListener { + + private String name; + private List listeners; + + /** + * Construct an instance with the given name. + * + * (Remember to add some delegate listeners!) + * + * @param name the name of this instance + */ + public BroadcastJobListener(String name) { + if(name == null) { + throw new IllegalArgumentException("Listener name cannot be null!"); + } + this.name = name; + listeners = new LinkedList(); + } + + /** + * Construct an instance with the given name, and List of listeners. + * + * @param name the name of this instance + * @param listeners the initial List of JobListeners to broadcast to. + */ + public BroadcastJobListener(String name, List listeners) { + this(name); + this.listeners.addAll(listeners); + } + + public String getName() { + return name; + } + + public void addListener(JobListener listener) { + listeners.add(listener); + } + + public boolean removeListener(JobListener listener) { + return listeners.remove(listener); + } + + public boolean removeListener(String listenerName) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + JobListener jl = itr.next(); + if(jl.getName().equals(listenerName)) { + itr.remove(); + return true; + } + } + return false; + } + + public List getListeners() { + return java.util.Collections.unmodifiableList(listeners); + } + + public void jobToBeExecuted(JobExecutionContext context) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + JobListener jl = itr.next(); + jl.jobToBeExecuted(context); + } + } + + public void jobExecutionVetoed(JobExecutionContext context) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + JobListener jl = itr.next(); + jl.jobExecutionVetoed(context); + } + } + + public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + JobListener jl = itr.next(); + jl.jobWasExecuted(context, jobException); + } + } + +} Index: 3rdParty_sources/quartz/org/quartz/listeners/BroadcastSchedulerListener.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/listeners/BroadcastSchedulerListener.java (.../BroadcastSchedulerListener.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/listeners/BroadcastSchedulerListener.java (.../BroadcastSchedulerListener.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1,219 +1,219 @@ -package org.quartz.listeners; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.quartz.JobDetail; -import org.quartz.JobKey; -import org.quartz.SchedulerException; -import org.quartz.SchedulerListener; -import org.quartz.Trigger; -import org.quartz.TriggerKey; - -/** - * Holds a List of references to SchedulerListener instances and broadcasts all - * events to them (in order). - * - *

This may be more convenient than registering all of the listeners - * directly with the Scheduler, and provides the flexibility of easily changing - * which listeners get notified.

- * - * @see #addListener(org.quartz.SchedulerListener) - * @see #removeListener(org.quartz.SchedulerListener) - * - * @author James House (jhouse AT revolition DOT net) - */ -public class BroadcastSchedulerListener implements SchedulerListener { - - private List listeners; - - public BroadcastSchedulerListener() { - listeners = new LinkedList(); - } - - /** - * Construct an instance with the given List of listeners. - * - * @param listeners the initial List of SchedulerListeners to broadcast to. - */ - public BroadcastSchedulerListener(List listeners) { - this(); - this.listeners.addAll(listeners); - } - - - public void addListener(SchedulerListener listener) { - listeners.add(listener); - } - - public boolean removeListener(SchedulerListener listener) { - return listeners.remove(listener); - } - - public List getListeners() { - return java.util.Collections.unmodifiableList(listeners); - } - - public void jobAdded(JobDetail jobDetail) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobAdded(jobDetail); - } - } - - public void jobDeleted(JobKey jobKey) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobDeleted(jobKey); - } - } - - public void jobScheduled(Trigger trigger) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobScheduled(trigger); - } - } - - public void jobUnscheduled(TriggerKey triggerKey) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobUnscheduled(triggerKey); - } - } - - public void triggerFinalized(Trigger trigger) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.triggerFinalized(trigger); - } - } - - public void triggerPaused(TriggerKey key) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.triggerPaused(key); - } - } - - public void triggersPaused(String triggerGroup) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.triggersPaused(triggerGroup); - } - } - - public void triggerResumed(TriggerKey key) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.triggerResumed(key); - } - } - - public void triggersResumed(String triggerGroup) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.triggersResumed(triggerGroup); - } - } - - public void schedulingDataCleared() { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulingDataCleared(); - } - } - - - public void jobPaused(JobKey key) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobPaused(key); - } - } - - public void jobsPaused(String jobGroup) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobsPaused(jobGroup); - } - } - - public void jobResumed(JobKey key) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobResumed(key); - } - } - - public void jobsResumed(String jobGroup) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.jobsResumed(jobGroup); - } - } - - public void schedulerError(String msg, SchedulerException cause) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerError(msg, cause); - } - } - - public void schedulerStarted() { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerStarted(); - } - } - - public void schedulerStarting() { - Iterator itr = listeners.iterator(); - while (itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerStarting(); - } - } - - public void schedulerInStandbyMode() { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerInStandbyMode(); - } - } - - public void schedulerShutdown() { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerShutdown(); - } - } - - public void schedulerShuttingdown() { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - SchedulerListener l = itr.next(); - l.schedulerShuttingdown(); - } - } - -} +package org.quartz.listeners; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.quartz.JobDetail; +import org.quartz.JobKey; +import org.quartz.SchedulerException; +import org.quartz.SchedulerListener; +import org.quartz.Trigger; +import org.quartz.TriggerKey; + +/** + * Holds a List of references to SchedulerListener instances and broadcasts all + * events to them (in order). + * + *

This may be more convenient than registering all of the listeners + * directly with the Scheduler, and provides the flexibility of easily changing + * which listeners get notified.

+ * + * @see #addListener(org.quartz.SchedulerListener) + * @see #removeListener(org.quartz.SchedulerListener) + * + * @author James House (jhouse AT revolition DOT net) + */ +public class BroadcastSchedulerListener implements SchedulerListener { + + private List listeners; + + public BroadcastSchedulerListener() { + listeners = new LinkedList(); + } + + /** + * Construct an instance with the given List of listeners. + * + * @param listeners the initial List of SchedulerListeners to broadcast to. + */ + public BroadcastSchedulerListener(List listeners) { + this(); + this.listeners.addAll(listeners); + } + + + public void addListener(SchedulerListener listener) { + listeners.add(listener); + } + + public boolean removeListener(SchedulerListener listener) { + return listeners.remove(listener); + } + + public List getListeners() { + return java.util.Collections.unmodifiableList(listeners); + } + + public void jobAdded(JobDetail jobDetail) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobAdded(jobDetail); + } + } + + public void jobDeleted(JobKey jobKey) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobDeleted(jobKey); + } + } + + public void jobScheduled(Trigger trigger) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobScheduled(trigger); + } + } + + public void jobUnscheduled(TriggerKey triggerKey) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobUnscheduled(triggerKey); + } + } + + public void triggerFinalized(Trigger trigger) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.triggerFinalized(trigger); + } + } + + public void triggerPaused(TriggerKey key) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.triggerPaused(key); + } + } + + public void triggersPaused(String triggerGroup) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.triggersPaused(triggerGroup); + } + } + + public void triggerResumed(TriggerKey key) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.triggerResumed(key); + } + } + + public void triggersResumed(String triggerGroup) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.triggersResumed(triggerGroup); + } + } + + public void schedulingDataCleared() { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulingDataCleared(); + } + } + + + public void jobPaused(JobKey key) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobPaused(key); + } + } + + public void jobsPaused(String jobGroup) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobsPaused(jobGroup); + } + } + + public void jobResumed(JobKey key) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobResumed(key); + } + } + + public void jobsResumed(String jobGroup) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.jobsResumed(jobGroup); + } + } + + public void schedulerError(String msg, SchedulerException cause) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerError(msg, cause); + } + } + + public void schedulerStarted() { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerStarted(); + } + } + + public void schedulerStarting() { + Iterator itr = listeners.iterator(); + while (itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerStarting(); + } + } + + public void schedulerInStandbyMode() { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerInStandbyMode(); + } + } + + public void schedulerShutdown() { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerShutdown(); + } + } + + public void schedulerShuttingdown() { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + SchedulerListener l = itr.next(); + l.schedulerShuttingdown(); + } + } + +} Index: 3rdParty_sources/quartz/org/quartz/listeners/BroadcastTriggerListener.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/listeners/BroadcastTriggerListener.java (.../BroadcastTriggerListener.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/listeners/BroadcastTriggerListener.java (.../BroadcastTriggerListener.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1,140 +1,140 @@ -/* - * Copyright 2001-2009 Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package org.quartz.listeners; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import org.quartz.JobExecutionContext; -import org.quartz.Trigger; -import org.quartz.TriggerListener; -import org.quartz.Trigger.CompletedExecutionInstruction; - -/** - * Holds a List of references to TriggerListener instances and broadcasts all - * events to them (in order). - * - *

The broadcasting behavior of this listener to delegate listeners may be - * more convenient than registering all of the listeners directly with the - * Scheduler, and provides the flexibility of easily changing which listeners - * get notified.

- * - * @see #addListener(org.quartz.TriggerListener) - * @see #removeListener(org.quartz.TriggerListener) - * @see #removeListener(String) - * - * @author James House (jhouse AT revolition DOT net) - */ -public class BroadcastTriggerListener implements TriggerListener { - - private String name; - private List listeners; - - /** - * Construct an instance with the given name. - * - * (Remember to add some delegate listeners!) - * - * @param name the name of this instance - */ - public BroadcastTriggerListener(String name) { - if(name == null) { - throw new IllegalArgumentException("Listener name cannot be null!"); - } - this.name = name; - listeners = new LinkedList(); - } - - /** - * Construct an instance with the given name, and List of listeners. - * - * @param name the name of this instance - * @param listeners the initial List of TriggerListeners to broadcast to. - */ - public BroadcastTriggerListener(String name, List listeners) { - this(name); - this.listeners.addAll(listeners); - } - - public String getName() { - return name; - } - - public void addListener(TriggerListener listener) { - listeners.add(listener); - } - - public boolean removeListener(TriggerListener listener) { - return listeners.remove(listener); - } - - public boolean removeListener(String listenerName) { - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - TriggerListener l = itr.next(); - if(l.getName().equals(listenerName)) { - itr.remove(); - return true; - } - } - return false; - } - - public List getListeners() { - return java.util.Collections.unmodifiableList(listeners); - } - - public void triggerFired(Trigger trigger, JobExecutionContext context) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - TriggerListener l = itr.next(); - l.triggerFired(trigger, context); - } - } - - public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - TriggerListener l = itr.next(); - if(l.vetoJobExecution(trigger, context)) { - return true; - } - } - return false; - } - - public void triggerMisfired(Trigger trigger) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - TriggerListener l = itr.next(); - l.triggerMisfired(trigger); - } - } - - public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) { - - Iterator itr = listeners.iterator(); - while(itr.hasNext()) { - TriggerListener l = itr.next(); - l.triggerComplete(trigger, context, triggerInstructionCode); - } - } - -} +/* + * Copyright 2001-2009 Terracotta, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package org.quartz.listeners; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.quartz.JobExecutionContext; +import org.quartz.Trigger; +import org.quartz.TriggerListener; +import org.quartz.Trigger.CompletedExecutionInstruction; + +/** + * Holds a List of references to TriggerListener instances and broadcasts all + * events to them (in order). + * + *

The broadcasting behavior of this listener to delegate listeners may be + * more convenient than registering all of the listeners directly with the + * Scheduler, and provides the flexibility of easily changing which listeners + * get notified.

+ * + * @see #addListener(org.quartz.TriggerListener) + * @see #removeListener(org.quartz.TriggerListener) + * @see #removeListener(String) + * + * @author James House (jhouse AT revolition DOT net) + */ +public class BroadcastTriggerListener implements TriggerListener { + + private String name; + private List listeners; + + /** + * Construct an instance with the given name. + * + * (Remember to add some delegate listeners!) + * + * @param name the name of this instance + */ + public BroadcastTriggerListener(String name) { + if(name == null) { + throw new IllegalArgumentException("Listener name cannot be null!"); + } + this.name = name; + listeners = new LinkedList(); + } + + /** + * Construct an instance with the given name, and List of listeners. + * + * @param name the name of this instance + * @param listeners the initial List of TriggerListeners to broadcast to. + */ + public BroadcastTriggerListener(String name, List listeners) { + this(name); + this.listeners.addAll(listeners); + } + + public String getName() { + return name; + } + + public void addListener(TriggerListener listener) { + listeners.add(listener); + } + + public boolean removeListener(TriggerListener listener) { + return listeners.remove(listener); + } + + public boolean removeListener(String listenerName) { + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + TriggerListener l = itr.next(); + if(l.getName().equals(listenerName)) { + itr.remove(); + return true; + } + } + return false; + } + + public List getListeners() { + return java.util.Collections.unmodifiableList(listeners); + } + + public void triggerFired(Trigger trigger, JobExecutionContext context) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + TriggerListener l = itr.next(); + l.triggerFired(trigger, context); + } + } + + public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + TriggerListener l = itr.next(); + if(l.vetoJobExecution(trigger, context)) { + return true; + } + } + return false; + } + + public void triggerMisfired(Trigger trigger) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + TriggerListener l = itr.next(); + l.triggerMisfired(trigger); + } + } + + public void triggerComplete(Trigger trigger, JobExecutionContext context, CompletedExecutionInstruction triggerInstructionCode) { + + Iterator itr = listeners.iterator(); + while(itr.hasNext()) { + TriggerListener l = itr.next(); + l.triggerComplete(trigger, context, triggerInstructionCode); + } + } + +} Index: 3rdParty_sources/quartz/org/quartz/listeners/JobChainingJobListener.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/listeners/JobChainingJobListener.java (.../JobChainingJobListener.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/listeners/JobChainingJobListener.java (.../JobChainingJobListener.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1,105 +1,105 @@ -/* - * Copyright 2001-2009 Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package org.quartz.listeners; - -import java.util.HashMap; -import java.util.Map; - -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.JobKey; -import org.quartz.SchedulerException; - -/** - * Keeps a collection of mappings of which Job to trigger after the completion - * of a given job. If this listener is notified of a job completing that has a - * mapping, then it will then attempt to trigger the follow-up job. This - * achieves "job chaining", or a "poor man's workflow". - * - *

Generally an instance of this listener would be registered as a global - * job listener, rather than being registered directly to a given job.

- * - *

If for some reason there is a failure creating the trigger for the - * follow-up job (which would generally only be caused by a rare serious - * failure in the system, or the non-existence of the follow-up job), an error - * messsage is logged, but no other action is taken. If you need more rigorous - * handling of the error, consider scheduling the triggering of the flow-up - * job within your job itself.

- * - * @author James House (jhouse AT revolition DOT net) - */ -public class JobChainingJobListener extends JobListenerSupport { - - private String name; - private Map chainLinks; - - - /** - * Construct an instance with the given name. - * - * @param name the name of this instance - */ - public JobChainingJobListener(String name) { - if(name == null) { - throw new IllegalArgumentException("Listener name cannot be null!"); - } - this.name = name; - chainLinks = new HashMap(); - } - - public String getName() { - return name; - } - - /** - * Add a chain mapping - when the Job identified by the first key completes - * the job identified by the second key will be triggered. - * - * @param firstJob a JobKey with the name and group of the first job - * @param secondJob a JobKey with the name and group of the follow-up job - */ - public void addJobChainLink(JobKey firstJob, JobKey secondJob) { - - if(firstJob == null || secondJob == null) { - throw new IllegalArgumentException("Key cannot be null!"); - } - - if(firstJob.getName() == null || secondJob.getName() == null) { - throw new IllegalArgumentException("Key cannot have a null name!"); - } - - chainLinks.put(firstJob, secondJob); - } - - @Override - public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { - - JobKey sj = chainLinks.get(context.getJobDetail().getKey()); - - if(sj == null) { - return; - } - - getLog().info("Job '" + context.getJobDetail().getKey() + "' will now chain to Job '" + sj + "'"); - - try { - context.getScheduler().triggerJob(sj); - } catch(SchedulerException se) { - getLog().error("Error encountered during chaining to Job '" + sj + "'", se); - } - } -} - +/* + * Copyright 2001-2009 Terracotta, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ +package org.quartz.listeners; + +import java.util.HashMap; +import java.util.Map; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.quartz.JobKey; +import org.quartz.SchedulerException; + +/** + * Keeps a collection of mappings of which Job to trigger after the completion + * of a given job. If this listener is notified of a job completing that has a + * mapping, then it will then attempt to trigger the follow-up job. This + * achieves "job chaining", or a "poor man's workflow". + * + *

Generally an instance of this listener would be registered as a global + * job listener, rather than being registered directly to a given job.

+ * + *

If for some reason there is a failure creating the trigger for the + * follow-up job (which would generally only be caused by a rare serious + * failure in the system, or the non-existence of the follow-up job), an error + * messsage is logged, but no other action is taken. If you need more rigorous + * handling of the error, consider scheduling the triggering of the flow-up + * job within your job itself.

+ * + * @author James House (jhouse AT revolition DOT net) + */ +public class JobChainingJobListener extends JobListenerSupport { + + private String name; + private Map chainLinks; + + + /** + * Construct an instance with the given name. + * + * @param name the name of this instance + */ + public JobChainingJobListener(String name) { + if(name == null) { + throw new IllegalArgumentException("Listener name cannot be null!"); + } + this.name = name; + chainLinks = new HashMap(); + } + + public String getName() { + return name; + } + + /** + * Add a chain mapping - when the Job identified by the first key completes + * the job identified by the second key will be triggered. + * + * @param firstJob a JobKey with the name and group of the first job + * @param secondJob a JobKey with the name and group of the follow-up job + */ + public void addJobChainLink(JobKey firstJob, JobKey secondJob) { + + if(firstJob == null || secondJob == null) { + throw new IllegalArgumentException("Key cannot be null!"); + } + + if(firstJob.getName() == null || secondJob.getName() == null) { + throw new IllegalArgumentException("Key cannot have a null name!"); + } + + chainLinks.put(firstJob, secondJob); + } + + @Override + public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) { + + JobKey sj = chainLinks.get(context.getJobDetail().getKey()); + + if(sj == null) { + return; + } + + getLog().info("Job '" + context.getJobDetail().getKey() + "' will now chain to Job '" + sj + "'"); + + try { + context.getScheduler().triggerJob(sj); + } catch(SchedulerException se) { + getLog().error("Error encountered during chaining to Job '" + sj + "'", se); + } + } +} + Index: 3rdParty_sources/quartz/org/quartz/simpl/RAMJobStore.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/simpl/RAMJobStore.java (.../RAMJobStore.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/simpl/RAMJobStore.java (.../RAMJobStore.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1387,7 +1387,7 @@ List result = new ArrayList(); Set acquiredJobKeysForNoConcurrentExec = new HashSet(); Set excludedTriggers = new HashSet(); - long firstAcquiredTriggerFireTime = 0; + long batchEnd = noLaterThan; // return empty list if store has no triggers. if (timeTriggers.size() == 0) @@ -1416,7 +1416,7 @@ continue; } - if (tw.getTrigger().getNextFireTime().getTime() > noLaterThan + timeWindow) { + if (tw.getTrigger().getNextFireTime().getTime() > batchEnd) { timeTriggers.add(tw); break; } @@ -1437,14 +1437,14 @@ tw.state = TriggerWrapper.STATE_ACQUIRED; tw.trigger.setFireInstanceId(getFiredTriggerRecordId()); OperableTrigger trig = (OperableTrigger) tw.trigger.clone(); + if (result.isEmpty()) { + batchEnd = Math.max(tw.trigger.getNextFireTime().getTime(), System.currentTimeMillis()) + timeWindow; + } result.add(trig); - if(firstAcquiredTriggerFireTime == 0) - firstAcquiredTriggerFireTime = tw.trigger.getNextFireTime().getTime(); - if (result.size() == maxCount) break; } - + // If we did excluded triggers to prevent ACQUIRE state due to DisallowConcurrentExecution, we need to add them back to store. if (excludedTriggers.size() > 0) timeTriggers.addAll(excludedTriggers); Index: 3rdParty_sources/quartz/org/quartz/utils/DBConnectionManager.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/utils/DBConnectionManager.java (.../DBConnectionManager.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/utils/DBConnectionManager.java (.../DBConnectionManager.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -138,5 +138,9 @@ provider.shutdown(); - } + } + + ConnectionProvider getConnectionProvider(String key) { + return providers.get(key); + } } Index: 3rdParty_sources/quartz/org/quartz/utils/PoolingConnectionProvider.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/utils/PoolingConnectionProvider.java (.../PoolingConnectionProvider.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/utils/PoolingConnectionProvider.java (.../PoolingConnectionProvider.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -239,7 +239,7 @@ * subclass's constructor. *

*/ - protected ComboPooledDataSource getDataSource() { + public ComboPooledDataSource getDataSource() { return datasource; } Index: 3rdParty_sources/quartz/org/quartz/xml/XMLSchedulingDataProcessor.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/quartz/xml/XMLSchedulingDataProcessor.java (.../XMLSchedulingDataProcessor.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/quartz/xml/XMLSchedulingDataProcessor.java (.../XMLSchedulingDataProcessor.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -383,45 +383,26 @@ * @see #processFileAndScheduleJobs(String, org.quartz.Scheduler) */ protected String getSystemIdForFileName(String fileName) { - InputStream fileInputStream = null; - try { - String urlPath = null; - - File file = new File(fileName); // files in filesystem - if (!file.exists()) { - URL url = getURL(fileName); - if (url != null) { - try { - urlPath = URLDecoder.decode(url.getPath(), "UTF-8"); - } catch (UnsupportedEncodingException e) { - log.warn("Unable to decode file path URL", e); - } - try { - fileInputStream = url.openStream(); - } catch (IOException ignore) { - } - } - } else { - try { - fileInputStream = new FileInputStream(file); - }catch (FileNotFoundException ignore) { - } + File file = new File(fileName); // files in filesystem + if (file.exists()) { + try { + new FileInputStream(file).close(); + return file.toURI().toString(); + }catch (IOException ignore) { + return fileName; } - - if (fileInputStream == null) { - log.debug("Unable to resolve '" + fileName + "' to full path, so using it as is for system id."); + } else { + URL url = getURL(fileName); + if (url == null) { return fileName; } else { - return (urlPath != null) ? urlPath : file.getAbsolutePath(); - } - } finally { - try { - if (fileInputStream != null) { - fileInputStream.close(); + try { + url.openStream().close(); + return url.toString(); + } catch (IOException ignore) { + return fileName; } - } catch (IOException ioe) { - log.warn("Error closing jobs file: " + fileName, ioe); - } + } } } Index: 3rdParty_sources/quartz/org/terracotta/quartz/DefaultClusteredJobStore.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/terracotta/quartz/DefaultClusteredJobStore.java (.../DefaultClusteredJobStore.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/terracotta/quartz/DefaultClusteredJobStore.java (.../DefaultClusteredJobStore.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -1532,7 +1532,7 @@ Set acquiredJobKeysForNoConcurrentExec = new HashSet(); Set excludedTriggers = new HashSet(); JobPersistenceException caughtJpe = null; - long firstAcquiredTriggerFireTime = 0; + long batchEnd = noLaterThan; try { while (true) { @@ -1552,25 +1552,14 @@ continue; } - // it's possible that we've selected triggers way outside of the max fire ahead time for batches - // (up to idleWaitTime + fireAheadTime) so we need to make sure not to include such triggers. - // So we select from the first next trigger to fire up until the max fire ahead time after that... - // which will perfectly honor the fireAheadTime window because the no firing will occur until - // the first acquired trigger's fire time arrives. - if (firstAcquiredTriggerFireTime > 0 - && tw.getNextFireTime().getTime() > (firstAcquiredTriggerFireTime + timeWindow)) { - source.add(tw); - break; - } - if (applyMisfire(tw)) { if (tw.getNextFireTime() != null) { source.add(tw); } continue; } - if (tw.getNextFireTime().getTime() > noLaterThan + timeWindow) { + if (tw.getNextFireTime().getTime() > batchEnd) { source.add(tw); break; } @@ -1581,8 +1570,11 @@ } acquiredJobKeysForNoConcurrentExec.add(tw.getJobKey()); } + + if (wrappers.isEmpty()) { + batchEnd = Math.max(tw.getNextFireTime().getTime(), System.currentTimeMillis()) + timeWindow; + } wrappers.add(tw); - if (firstAcquiredTriggerFireTime == 0) firstAcquiredTriggerFireTime = tw.getNextFireTime().getTime(); if (wrappers.size() == maxCount) { break; } Index: 3rdParty_sources/quartz/org/terracotta/quartz/PlainTerracottaJobStore.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/terracotta/quartz/PlainTerracottaJobStore.java (.../PlainTerracottaJobStore.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/terracotta/quartz/PlainTerracottaJobStore.java (.../PlainTerracottaJobStore.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -32,7 +32,6 @@ import org.quartz.spi.OperableTrigger; import org.quartz.spi.SchedulerSignaler; import org.quartz.spi.TriggerFiredResult; -import org.terracotta.toolkit.cluster.ClusterInfo; import org.terracotta.toolkit.internal.ToolkitInternal; import java.util.Collection; @@ -53,12 +52,10 @@ private String schedInstanceId; private long tcRetryInterval; private int threadPoolSize; - private final ClusterInfo clusterInfo; protected final ToolkitInternal toolkit; public PlainTerracottaJobStore(ToolkitInternal toolkit) { this.toolkit = toolkit; - this.clusterInfo = toolkit.getClusterInfo(); } @Override @@ -385,7 +382,7 @@ @Override public String getUUID() { - return clusterInfo.getCurrentNode().getId(); + return toolkit.getClientUUID(); } protected T createNewJobStoreInstance(String schedulerName, final boolean useSynchWrite) { Index: 3rdParty_sources/quartz/org/terracotta/quartz/collections/SerializedToolkitStore.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/terracotta/quartz/collections/SerializedToolkitStore.java (.../SerializedToolkitStore.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/terracotta/quartz/collections/SerializedToolkitStore.java (.../SerializedToolkitStore.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -192,6 +192,26 @@ return this.toolkitStore.replace(serializeToString(key), value); } + @Override + public boolean isBulkLoadEnabled() { + return this.toolkitStore.isBulkLoadEnabled(); + } + + @Override + public boolean isNodeBulkLoadEnabled() { + return this.toolkitStore.isNodeBulkLoadEnabled(); + } + + @Override + public void setNodeBulkLoadEnabled(boolean enabledBulkLoad) { + this.toolkitStore.setNodeBulkLoadEnabled(enabledBulkLoad); + } + + @Override + public void waitUntilBulkLoadComplete() throws InterruptedException { + this.toolkitStore.waitUntilBulkLoadComplete(); + } + private static class ToolkitEntrySet implements Set> { private final Set> set; Index: 3rdParty_sources/quartz/org/terracotta/quartz/wrappers/FiredTrigger.java =================================================================== diff -u -rc208628989d52041b3765784f4c8cbfd6c80d47b -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/quartz/org/terracotta/quartz/wrappers/FiredTrigger.java (.../FiredTrigger.java) (revision c208628989d52041b3765784f4c8cbfd6c80d47b) +++ 3rdParty_sources/quartz/org/terracotta/quartz/wrappers/FiredTrigger.java (.../FiredTrigger.java) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -29,10 +29,14 @@ private final long fireTime; public FiredTrigger(String clientId, TriggerKey triggerKey, long scheduledFireTime) { + this(clientId, triggerKey, scheduledFireTime, System.currentTimeMillis()); + } + + public FiredTrigger(String clientId, TriggerKey triggerKey, long scheduledFireTime, long now) { this.clientId = clientId; this.triggerKey = triggerKey; this.scheduledFireTime = scheduledFireTime; - this.fireTime = System.currentTimeMillis(); + this.fireTime = now; } public String getClientId() { Index: 3rdParty_sources/versions.txt =================================================================== diff -u -r5a8831deff620b6d7419f54d9e45d3a54c76af18 -r3315d08a745ade8f35c8c80f1133bd12a49bc8b8 --- 3rdParty_sources/versions.txt (.../versions.txt) (revision 5a8831deff620b6d7419f54d9e45d3a54c76af18) +++ 3rdParty_sources/versions.txt (.../versions.txt) (revision 3315d08a745ade8f35c8c80f1133bd12a49bc8b8) @@ -40,7 +40,7 @@ openws 1.5.0 -Quartz 2.2.1 +Quartz 2.2.3 Servlet API 3.1