1. timemachine
  2. scheduler

Commits

Zemian Deng  committed 1899ac0

Fixed few FindBug warnings.

  • Participants
  • Parent commits a6e45e4
  • Branches default

Comments (0)

Files changed (3)

File timemachine-scheduler/src/main/java/timemachine/scheduler/service/MemoryDataStore.java

View file
  */
 package timemachine.scheduler.service;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 		// this job def, then remove it.
 		List<Schedule> schedulesToDel = new ArrayList<Schedule>();
 		for (Schedule schedule : nodeStore.getSchedules().values()) {
-			if (schedule.getJobDefId() == jobDef.getId() && !jobDefScheduleKeys.contains(schedule.getId()))
+			if (schedule.getJobDefId().equals(jobDef.getId()) && !jobDefScheduleKeys.contains(schedule.getId()))
 				schedulesToDel.add(schedule);
 		}
 		if (schedulesToDel.size() > 0) {
 	}
 
 	/** Comparator for sorting EventHistory in descending order by createTime then id. */
-	public static class EventHistoryComparator implements Comparator<EventHistory> {
+	public static class EventHistoryComparator implements Comparator<EventHistory>, Serializable {
+		private static final long serialVersionUID = 1L;
 
 		@Override
 		public int compare(EventHistory o1, EventHistory o2) {

File timemachine-scheduler/src/main/java/timemachine/scheduler/support/ProcessUtils.java

View file
 				public void run() {
 					InputStream inStream = process.getInputStream();
 					try {
-						BufferedReader reader = new BufferedReader(new InputStreamReader(inStream));
+						InputStreamReader isReader = new InputStreamReader(inStream);
+						BufferedReader reader = new BufferedReader(isReader);
 						String line = null;
 						while ((line = reader.readLine()) != null) {
 							lineAction.onLine(line);

File timemachine-scheduler/src/main/java/timemachine/scheduler/support/ScheduleComparator.java

View file
  */
 package timemachine.scheduler.support;
 
+import java.io.Serializable;
 import java.util.Comparator;
 import java.util.Date;
 
  * </ul>
  * @author Zemian Deng
  */
-public class ScheduleComparator implements Comparator<Schedule> {
+public class ScheduleComparator implements Comparator<Schedule>, Serializable {
+	private static final long serialVersionUID = 1L;
 	private static final int EQUAL = 0; // Do not move
 	private static final int LEFT = -1; // Move to top (first)
 	private static final int RIGHT = 1; // Move to bottom (last)
 		// Compare by default using hashCode
 		return this.hashCode() == obj.hashCode();
 	}
+	
+	/** Call super.hashCode() just to satisfy Java contract when overriding equals(). */
+	@Override
+	public int hashCode() {
+		return super.hashCode();
+	}
 }