1 package com.github.dexecutor.executor;
2
3 import java.util.concurrent.ExecutorService;
4
5 import com.github.dexecutor.executor.graph.CyclicValidator;
6 import com.github.dexecutor.executor.graph.LevelOrderTraversar;
7 import com.github.dexecutor.executor.graph.Traversar;
8 import com.github.dexecutor.executor.graph.Validator;
9 import static com.github.dexecutor.executor.support.Preconditions.*;
10
11
12
13
14
15
16
17
18
19 public class DependentTasksExecutorConfig<T extends Comparable<T>> {
20
21
22
23 private ExecutorService executorService;
24
25
26
27 private TaskProvider<T> taskProvider;
28
29
30
31 private Validator<T> validator = new CyclicValidator<T>();
32
33
34
35 private Traversar<T> traversar = new LevelOrderTraversar<T>();
36
37
38
39
40
41 public DependentTasksExecutorConfig(final ExecutorService executorService, final TaskProvider<T> taskProvider) {
42 this.executorService = executorService;
43 this.taskProvider = taskProvider;
44 }
45
46 void validate() {
47 checkNotNull(this.executorService, "Executer Service should not be null");
48 checkNotNull(this.taskProvider, "Task Provider should not be null");
49 checkNotNull(this.validator, "Validator should not be null");
50 checkNotNull(this.traversar, "Traversar should not be null");
51 }
52
53 ExecutorService getExecutorService() {
54 return executorService;
55 }
56
57 TaskProvider<T> getTaskProvider() {
58 return taskProvider;
59 }
60
61 Validator<T> getValidator() {
62 return validator;
63 }
64
65
66
67
68 public void setValidator(final Validator<T> validator) {
69 this.validator = validator;
70 }
71 Traversar<T> getTraversar() {
72 return traversar;
73 }
74
75
76
77
78 public void setTraversar(final Traversar<T> traversar) {
79 this.traversar = traversar;
80 }
81 }