Repository navigation
Expand file tree
/
Copy pathApp.java
More file actions
63 lines (53 loc) · 1.76 KB
/
Copy pathApp.java
File metadata and controls
63 lines (53 loc) · 1.76 KB
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
56
57
58
59
60
61
62
63
package jsheets.runtime;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import com.google.common.flogger.FluentLogger;
import com.google.inject.Guice;
import com.google.inject.Injector;
import jdk.jshell.JShell;
import jsheets.evaluation.sandbox.access.AccessGraph;
import jsheets.evaluation.sandbox.validation.ForbiddenMemberFilter;
import jsheets.evaluation.shell.environment.fork.ForkingExecutionControlProvider;
import jsheets.evaluation.shell.environment.sandbox.SandboxClassFileCheck;
import jsheets.runtime.evaluation.EvaluationModule;
import jsheets.runtime.monitoring.MonitoringModule;
public final class App {
private static final FluentLogger log = FluentLogger.forEnclosingClass();
private App() {}
public static void main(String[] options) {
configureLogging();
var injector = configureInjector();
launch(injector);
}
private static void launch(Injector injector) {
var setup = injector.getInstance(ServerSetup.class);
try {
setup.start();
} catch (IOException failure) {
log.atSevere()
.withCause(failure)
.log("encountered error while serving");
} catch (InterruptedException interruption) {
log.atSevere()
.withCause(interruption)
.log("interrupted while serving");
}
}
private static Injector configureInjector() {
return Guice.createInjector(
ServerSetupModule.create(),
ConfigModule.create(),
ZookeeperModule.create(),
EvaluationModule.create(),
MonitoringModule.create()
);
}
private static void configureLogging() {
System.setProperty(
"flogger.backend_factory",
"com.google.common.flogger.backend.slf4j.Slf4jBackendFactory#getInstance"
);
}
}