1 | package felix.task; |
2 | |
3 | import java.io.FileInputStream; |
4 | import java.util.concurrent.ExecutorService; |
5 | |
6 | import org.postgresql.PGConnection; |
7 | |
8 | import tuffy.util.Timer; |
9 | import tuffy.util.UIMan; |
10 | |
11 | import felix.dstruct.DataMovementOperator; |
12 | import felix.dstruct.StatOperator; |
13 | import felix.optimizer.DMOOptimizer; |
14 | import felix.society.Task; |
15 | import felix.society.Worker; |
16 | import felix.society.Task.TaskType; |
17 | |
18 | /** |
19 | * {@link Task} Object for executing an operator. |
20 | * @author czhang |
21 | * |
22 | */ |
23 | public class ExecuteOperatorTask extends Task{ |
24 | |
25 | /** |
26 | * Operator. |
27 | */ |
28 | public StatOperator sop; |
29 | |
30 | /** |
31 | * Constructor. |
32 | * @param _sop |
33 | */ |
34 | public ExecuteOperatorTask(StatOperator _sop){ |
35 | super(TaskType.TASK); |
36 | sop = _sop; |
37 | } |
38 | |
39 | @Override |
40 | public Worker generateWorker() { |
41 | return new ExecuteOperatorWorker(sop); |
42 | } |
43 | |
44 | /** |
45 | * A worker that simply calls the run() function |
46 | * of the operator object. |
47 | * @author czhang |
48 | * |
49 | */ |
50 | public class ExecuteOperatorWorker extends Worker{ |
51 | |
52 | public StatOperator sop; |
53 | public DMOOptimizer dmoo; |
54 | |
55 | public ExecuteOperatorWorker(StatOperator _sop){ |
56 | super(); |
57 | sop = _sop; |
58 | } |
59 | |
60 | @Override |
61 | public void run() { |
62 | try{ |
63 | |
64 | sop.run(); |
65 | |
66 | }catch(Exception e){ |
67 | submitException(e); |
68 | } |
69 | } |
70 | } |
71 | |
72 | @Override |
73 | public Worker generateWorker(ExecutorService pool) { |
74 | return null; |
75 | } |
76 | |
77 | |
78 | } |