View Javadoc
1   package com.github.dexecutor.executor;
2   /**
3    * A Task Provider provides Tasks to be executed, when it comes to execution
4    * @author Nadeem Mohammad
5    *
6    * @param <T>
7    */
8   public interface TaskProvider <T extends Comparable<T>> {
9   	/**
10  	 * Given the node id, returns the task to be executed, while building graph only the node ids are required, when it comes to execution Task objects would be constructed
11  	 * 
12  	 * @param id
13  	 * @return @Task
14  	 */
15  	public Task provid(final T id);
16  	
17  	/**
18  	 * Represent a unit of execution in Dexecutor framework
19  	 * 
20  	 * @author Nadeem Mohammad
21  	 *
22  	 */
23  	public abstract class Task {
24  		/**
25  		 * Framework would call this method, when it comes for tasks to be executed.
26  		 */
27  		public abstract void execute();
28  		/**
29  		 * When using retry behavior, execution error should not be considered until the last retry, this would define when execution error should be considered
30  		 */
31  		private boolean considerExecutionError = true;
32  		/**
33  		 * 
34  		 * @return whether execution error should be considered or not
35  		 */
36  		public final boolean shouldConsiderExecutionError() {
37  			return this.considerExecutionError;
38  		}
39  		/**
40  		 * 
41  		 * @param considerExecutionError
42  		 */
43  		void setConsiderExecutionError(boolean considerExecutionError) {
44  			this.considerExecutionError = considerExecutionError;
45  		}
46  	}
47  }