1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
package org.apache.giraph.block_app.framework.api; |
19 | |
|
20 | |
import static com.google.common.base.Preconditions.checkNotNull; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | 0 | public class BlockApiHandle { |
45 | |
private transient BlockMasterApi masterApi; |
46 | |
private transient BlockWorkerReceiveApi workerReceiveApi; |
47 | |
private transient BlockWorkerSendApi workerSendApi; |
48 | |
private transient BlockWorkerContextReceiveApi workerContextReceiveApi; |
49 | |
private transient BlockWorkerContextSendApi workerContextSendApi; |
50 | |
|
51 | |
public void setMasterApi(BlockMasterApi api) { |
52 | 0 | this.masterApi = api; |
53 | 0 | } |
54 | |
|
55 | |
public void setWorkerReceiveApi(BlockWorkerReceiveApi api) { |
56 | 0 | this.workerReceiveApi = api; |
57 | 0 | } |
58 | |
|
59 | |
public void setWorkerSendApi(BlockWorkerSendApi api) { |
60 | 0 | this.workerSendApi = api; |
61 | 0 | } |
62 | |
|
63 | |
public void setWorkerContextReceiveApi(BlockWorkerContextReceiveApi api) { |
64 | 0 | this.workerContextReceiveApi = api; |
65 | 0 | } |
66 | |
|
67 | |
public void setWorkerContextSendApi(BlockWorkerContextSendApi api) { |
68 | 0 | this.workerContextSendApi = api; |
69 | 0 | } |
70 | |
|
71 | |
public boolean isMasterApiSet() { |
72 | 0 | return masterApi != null; |
73 | |
} |
74 | |
|
75 | |
public boolean isWorkerReceiveApiSet() { |
76 | 0 | return workerReceiveApi != null; |
77 | |
} |
78 | |
|
79 | |
public boolean isWorkerSendApiSet() { |
80 | 0 | return workerSendApi != null; |
81 | |
} |
82 | |
|
83 | |
public boolean isWorkerContextReceiveApiSet() { |
84 | 0 | return workerContextReceiveApi != null; |
85 | |
} |
86 | |
|
87 | |
public boolean isWorkerContextSendApiSet() { |
88 | 0 | return workerContextSendApi != null; |
89 | |
} |
90 | |
|
91 | |
public BlockMasterApi getMasterApi() { |
92 | 0 | checkNotNull(masterApi, |
93 | |
"BlockMasterApi not valid in this context."); |
94 | 0 | return masterApi; |
95 | |
} |
96 | |
|
97 | |
public BlockWorkerReceiveApi getWorkerReceiveApi() { |
98 | 0 | checkNotNull(workerReceiveApi, |
99 | |
"BlockWorkerReceiveApi not valid in this context."); |
100 | 0 | return workerReceiveApi; |
101 | |
} |
102 | |
|
103 | |
public BlockWorkerSendApi getWorkerSendApi() { |
104 | 0 | checkNotNull(workerSendApi, |
105 | |
"BlockWorkerSendApi not valid in this context."); |
106 | 0 | return workerSendApi; |
107 | |
} |
108 | |
|
109 | |
public BlockWorkerContextReceiveApi getWorkerContextReceiveApi() { |
110 | 0 | checkNotNull(workerContextReceiveApi, |
111 | |
"BlockWorkerContextReceiveApi not valid in this context"); |
112 | 0 | return workerContextReceiveApi; |
113 | |
} |
114 | |
|
115 | |
public BlockWorkerContextSendApi getWorkerContextSendApi() { |
116 | 0 | checkNotNull(workerContextSendApi, |
117 | |
"BlockWorkerContextSendApi not valid in this context"); |
118 | 0 | return workerContextSendApi; |
119 | |
} |
120 | |
} |