Skip to content

Commit

Permalink
Reverting previous work on execution capabilities before applying new…
Browse files Browse the repository at this point in the history
… work on issue quartz-scheduler#175

This reverts commits 5b078fd, 78a569d, 20f1fa8
  • Loading branch information
mederly committed Aug 22, 2017
1 parent 9cfabec commit 15f7d08
Show file tree
Hide file tree
Showing 58 changed files with 207 additions and 623 deletions.
15 changes: 4 additions & 11 deletions quartz-core/src/main/java/org/quartz/Scheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

package org.quartz;

import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.quartz.Trigger.TriggerState;
import org.quartz.impl.matchers.GroupMatcher;
Expand Down Expand Up @@ -963,15 +966,5 @@ void addCalendar(String calName, Calendar calendar, boolean replace, boolean upd
*/
void clear() throws SchedulerException;

/**
* Gets execution capabilities for this scheduler (if supported by the job store).
* (Not implemented for JMX scheduler access yet.)
*/
Collection<String> getExecutionCapabilities() throws SchedulerException;

/**
* Sets execution capabilities for this scheduler (if supported by the job store).
* (Not implemented for JMX scheduler access yet.)
*/
void setExecutionCapabilities(Collection<String> executionCapabilities) throws SchedulerException;
}
6 changes: 0 additions & 6 deletions quartz-core/src/main/java/org/quartz/Trigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,4 @@ public int compare(Trigger t1, Trigger t2) {
return compare(t1.getNextFireTime(), t1.getPriority(), t1.getKey(), t2.getNextFireTime(), t2.getPriority(), t2.getKey());
}
}

/**
* Execution capability that must be possessed by a node in order to be able to acquire this trigger.
* If null, any node can do that.
*/
String getRequiredCapability();
}
16 changes: 1 addition & 15 deletions quartz-core/src/main/java/org/quartz/TriggerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class TriggerBuilder<T extends Trigger> {
private String calendarName;
private JobKey jobKey;
private JobDataMap jobDataMap = new JobDataMap();
private String requiredCapability;

private ScheduleBuilder<?> scheduleBuilder = null;

Expand Down Expand Up @@ -114,8 +113,7 @@ public T build() {

if(!jobDataMap.isEmpty())
trig.setJobDataMap(jobDataMap);

trig.setRequiredCapability(requiredCapability);

return (T) trig;
}

Expand Down Expand Up @@ -414,17 +412,5 @@ public TriggerBuilder<T> usingJobData(JobDataMap newJobDataMap) {
jobDataMap = newJobDataMap; // set new map as the map to use
return this;
}

/**
* Set the node's execution capability that is required for the Trigger to be acquired
* at a given node.
* @param requiredCapability the required capability
* @return the updated TriggerBuilder
*/

public TriggerBuilder<T> requiredCapability(String requiredCapability) {
this.requiredCapability = requiredCapability;
return this;
}

}
10 changes: 1 addition & 9 deletions quartz-core/src/main/java/org/quartz/core/QuartzScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ public boolean unscheduleJobs(List<TriggerKey> triggerKeys) throws SchedulerExce
notifySchedulerListenersUnscheduled(key);
return result;
}

/**
* <p>
* Remove the indicated <code>{@link org.quartz.Trigger}</code> from the
Expand Down Expand Up @@ -2384,14 +2384,6 @@ private void startPlugins() {
}
}

public Collection<String> getExecutionCapabilities() {
return resources.getJobStore().getExecutionCapabilitiesCollection();
}

public void setExecutionCapabilities(Collection<String> executionCapabilities) {
resources.getJobStore().setExecutionCapabilitiesCollection(executionCapabilities);
}

}

/////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.quartz.Calendar;
import org.quartz.JobDataMap;
Expand Down Expand Up @@ -170,8 +173,5 @@ public interface RemotableQuartzScheduler extends Remote {
public void scheduleJob(JobDetail jobDetail, Set<? extends Trigger> triggersForJob, boolean replace) throws SchedulerException,RemoteException;

public boolean unscheduleJobs(List<TriggerKey> triggerKeys) throws SchedulerException,RemoteException;

Collection<String> getExecutionCapabilities();

void setExecutionCapabilities(Collection<String> executionCapabilities);

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
package org.quartz.impl;

import java.text.ParseException;
import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.management.Attribute;
import javax.management.AttributeList;
Expand Down Expand Up @@ -954,12 +959,5 @@ public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobExcep
public void setJobFactory(JobFactory factory) throws SchedulerException {
throw new SchedulerException("Operation not supported for remote schedulers.");
}

public Collection<String> getExecutionCapabilities() throws SchedulerException {
throw new SchedulerException("Operation not supported for remote schedulers.");
}

public void setExecutionCapabilities(Collection<String> executionCapabilities) throws SchedulerException {
throw new SchedulerException("Operation not supported for remote schedulers.");
}

}
13 changes: 4 additions & 9 deletions quartz-core/src/main/java/org/quartz/impl/RemoteScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.quartz.Calendar;
import org.quartz.JobDataMap;
Expand Down Expand Up @@ -944,12 +947,4 @@ public void setJobFactory(JobFactory factory) throws SchedulerException {
"Operation not supported for remote schedulers.");
}

public Collection<String> getExecutionCapabilities() throws SchedulerException {
return getRemoteScheduler().getExecutionCapabilities();
}

public void setExecutionCapabilities(Collection<String> executionCapabilities) throws SchedulerException {
getRemoteScheduler().setExecutionCapabilities(executionCapabilities);
}

}
14 changes: 5 additions & 9 deletions quartz-core/src/main/java/org/quartz/impl/StdScheduler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

package org.quartz.impl;

import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.quartz.Calendar;
import org.quartz.JobDataMap;
Expand Down Expand Up @@ -620,12 +623,5 @@ public boolean interrupt(String fireInstanceId) throws UnableToInterruptJobExcep
return sched.interrupt(fireInstanceId);
}

public Collection<String> getExecutionCapabilities() {
return sched.getExecutionCapabilities();
}

public void setExecutionCapabilities(Collection<String> executionCapabilities) {
sched.setExecutionCapabilities(executionCapabilities);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ public interface Constants {

String COL_MISFIRE_INSTRUCTION = "MISFIRE_INSTR";

String COL_REQUIRED_CAP = "REQUIRED_CAP";

String ALIAS_COL_NEXT_FIRE_TIME = "ALIAS_NXT_FR_TM";

// TABLE_SIMPLE_TRIGGERS columns names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -135,29 +134,25 @@ List<TriggerKey> selectMisfiredTriggersInState(Connection conn, String state,
*
* @param conn the DB Connection
* @param count the most misfired triggers to return, negative for all
* @param resultList Output parameter. A List of
* <code>{@link Key}</code> objects. Must not be null.
* @param executionCapabilities Capabilities of current node. Will skip triggers that require capabilities
* other than present here.
* @param resultList Output parameter. A List of
* <code>{@link org.quartz.utils.Key}</code> objects. Must not be null.
*
* @return Whether there are more misfired triggers left to find beyond
* the given count.
*/
boolean hasMisfiredTriggersInState(Connection conn, String state1,
long ts, int count, List<TriggerKey> resultList,
Collection<String> executionCapabilities) throws SQLException;
boolean hasMisfiredTriggersInState(Connection conn, String state1,
long ts, int count, List<TriggerKey> resultList) throws SQLException;

/**
* <p>
* Get the number of triggers in the given state that have
* misfired - according to the given timestamp.
* </p>
*
*
* @param conn the DB Connection
* @param executionCapabilities Capabilities of current node. Will skip triggers that require capabilities
* other than present here.
*/
int countMisfiredTriggersInState(
Connection conn, String state1, long ts, Collection<String> executionCapabilities) throws SQLException;
Connection conn, String state1, long ts) throws SQLException;

/**
* <p>
Expand Down Expand Up @@ -940,13 +935,13 @@ Key<?> selectTriggerForFireTime(Connection conn, long fireTime)
* @param conn
* the DB Connection
* @param noLaterThan
* highest value of <code>getNextFireTime()</code> of the triggers (exclusive) TODO doesn't match the SQL code
* highest value of <code>getNextFireTime()</code> of the triggers (exclusive)
* @param noEarlierThan
* lowest value of <code>getNextFireTime()</code> of the triggers (inclusive)
* highest value of <code>getNextFireTime()</code> of the triggers (inclusive)
*
* @return A (never null, possibly empty) list of the identifiers (Key objects) of the next triggers to be fired.
*
* @deprecated - This remained for compatibility reason. Use {@link #selectTriggerToAcquire(Connection, long, long, int, Collection)} instead.
* @deprecated - This remained for compatibility reason. Use {@link #selectTriggerToAcquire(Connection, long, long, int)} instead.
*/
public List<TriggerKey> selectTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan)
throws SQLException;
Expand All @@ -960,18 +955,15 @@ public List<TriggerKey> selectTriggerToAcquire(Connection conn, long noLaterThan
* @param conn
* the DB Connection
* @param noLaterThan
* highest value of <code>getNextFireTime()</code> of the triggers (exclusive) TODO doesn't match the SQL code
* @param noEarlierThan
* lowest value of <code>getNextFireTime()</code> of the triggers (inclusive)
* @param maxCount
* highest value of <code>getNextFireTime()</code> of the triggers (exclusive)
* @param noEarlierThan
* highest value of <code>getNextFireTime()</code> of the triggers (inclusive)
* @param maxCount
* maximum number of trigger keys allow to acquired in the returning list.
* @param executionCapabilities
* capabilities of the current node: we select only triggers that have requiredCapability either null or
* matching some of the executionCapabilities
*
* @return A (never null, possibly empty) list of the identifiers (Key objects) of the next triggers to be fired.
*/
public List<TriggerKey> selectTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan, int maxCount,
Collection<String> executionCapabilities)
public List<TriggerKey> selectTriggerToAcquire(Connection conn, long noLaterThan, long noEarlierThan, int maxCount)
throws SQLException;

/**
Expand Down

0 comments on commit 15f7d08

Please sign in to comment.