1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.giraph.worker; |
20 | |
|
21 | |
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration; |
22 | |
import org.apache.giraph.graph.VertexEdgeCount; |
23 | |
import org.apache.giraph.io.VertexInputFormat; |
24 | |
import org.apache.giraph.utils.CallableFactory; |
25 | |
import org.apache.hadoop.io.Writable; |
26 | |
import org.apache.hadoop.io.WritableComparable; |
27 | |
import org.apache.hadoop.mapreduce.Mapper; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class VertexInputSplitsCallableFactory<I extends WritableComparable, |
37 | |
V extends Writable, E extends Writable> |
38 | |
implements CallableFactory<VertexEdgeCount> { |
39 | |
|
40 | |
private final VertexInputFormat<I, V, E> vertexInputFormat; |
41 | |
|
42 | |
private final Mapper<?, ?, ?, ?>.Context context; |
43 | |
|
44 | |
private final ImmutableClassesGiraphConfiguration<I, V, E> configuration; |
45 | |
|
46 | |
private final BspServiceWorker<I, V, E> bspServiceWorker; |
47 | |
|
48 | |
private final WorkerInputSplitsHandler splitsHandler; |
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
public VertexInputSplitsCallableFactory( |
60 | |
VertexInputFormat<I, V, E> vertexInputFormat, |
61 | |
Mapper<?, ?, ?, ?>.Context context, |
62 | |
ImmutableClassesGiraphConfiguration<I, V, E> configuration, |
63 | |
BspServiceWorker<I, V, E> bspServiceWorker, |
64 | 0 | WorkerInputSplitsHandler splitsHandler) { |
65 | 0 | this.vertexInputFormat = vertexInputFormat; |
66 | 0 | this.context = context; |
67 | 0 | this.configuration = configuration; |
68 | 0 | this.bspServiceWorker = bspServiceWorker; |
69 | 0 | this.splitsHandler = splitsHandler; |
70 | 0 | } |
71 | |
|
72 | |
@Override |
73 | |
public InputSplitsCallable<I, V, E> newCallable(int threadId) { |
74 | 0 | return new VertexInputSplitsCallable<I, V, E>( |
75 | |
vertexInputFormat, |
76 | |
context, |
77 | |
configuration, |
78 | |
bspServiceWorker, |
79 | |
splitsHandler); |
80 | |
} |
81 | |
} |