MCPcopy Create free account
hub / github.com/apache/mesos / main

Method main

src/examples/java/TestExceptionFramework.java:77–128  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

75 }
76
77 public static void main(String[] args) throws Exception {
78 if (args.length != 1) {
79 usage();
80 System.exit(1);
81 }
82
83 FrameworkInfo.Builder frameworkBuilder = FrameworkInfo.newBuilder()
84 .setUser("") // Have Mesos fill in the current user.
85 .setName("Exception Framework (Java)");
86
87 MesosSchedulerDriver driver = null;
88 if (System.getenv("MESOS_EXAMPLE_AUTHENTICATE") != null) {
89 System.out.println("Enabling authentication for the framework");
90
91 if (System.getenv("MESOS_EXAMPLE_PRINCIPAL") == null) {
92 System.err.println("Expecting authentication principal in the environment");
93 System.exit(1);
94 }
95
96 if (System.getenv("MESOS_EXAMPLE_SECRET") == null) {
97 System.err.println("Expecting authentication secret in the environment");
98 System.exit(1);
99 }
100
101 Credential credential = Credential.newBuilder()
102 .setPrincipal(System.getenv("MESOS_EXAMPLE_PRINCIPAL"))
103 .setSecret(System.getenv("MESOS_EXAMPLE_SECRET"))
104 .build();
105
106 frameworkBuilder.setPrincipal(System.getenv("MESOS_EXAMPLE_PRINCIPAL"));
107
108 driver = new MesosSchedulerDriver(
109 new TestExceptionScheduler(),
110 frameworkBuilder.build(),
111 args[0],
112 credential);
113 } else {
114 frameworkBuilder.setPrincipal("exception-framework-java");
115
116 driver = new MesosSchedulerDriver(
117 new TestExceptionScheduler(),
118 frameworkBuilder.build(),
119 args[0]);
120 }
121
122 int status = driver.run() == Status.DRIVER_STOPPED ? 0 : 1;
123
124 // Ensure that the driver process terminates.
125 driver.stop();
126
127 System.exit(status);
128 }
129}

Callers

nothing calls this directly

Calls 4

usageMethod · 0.95
runMethod · 0.95
stopMethod · 0.95
exitMethod · 0.80

Tested by

no test coverage detected