/
ActorCreationOptions.java
55 lines (42 loc) · 1.43 KB
/
ActorCreationOptions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package org.ray.api.options;
import java.util.HashMap;
import java.util.Map;
/**
* The options for creating actor.
*/
public class ActorCreationOptions extends BaseTaskOptions {
public static final int NO_RECONSTRUCTION = 0;
public static final int INFINITE_RECONSTRUCTIONS = (int) Math.pow(2, 30);
public final int maxReconstructions;
public final String jvmOptions;
private ActorCreationOptions(Map<String, Double> resources,
int maxReconstructions,
String jvmOptions) {
super(resources);
this.maxReconstructions = maxReconstructions;
this.jvmOptions = jvmOptions;
}
/**
* The inner class for building ActorCreationOptions.
*/
public static class Builder {
private Map<String, Double> resources = new HashMap<>();
private int maxReconstructions = NO_RECONSTRUCTION;
private String jvmOptions = "";
public Builder setResources(Map<String, Double> resources) {
this.resources = resources;
return this;
}
public Builder setMaxReconstructions(int maxReconstructions) {
this.maxReconstructions = maxReconstructions;
return this;
}
public Builder setJvmOptions(String jvmOptions) {
this.jvmOptions = jvmOptions;
return this;
}
public ActorCreationOptions createActorCreationOptions() {
return new ActorCreationOptions(resources, maxReconstructions, jvmOptions);
}
}
}