forked from vert-x3/vertx-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeployExample.java
43 lines (32 loc) · 1.11 KB
/
DeployExample.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
package io.vertx.example.core.verticle.asyncstart;
import io.vertx.core.AbstractVerticle;
import io.vertx.example.util.Runner;
/*
* @author <a href="http://tfox.org">Tim Fox</a>
*/
public class DeployExample extends AbstractVerticle {
// Convenience method so you can run it in your IDE
public static void main(String[] args) {
Runner.runExample(DeployExample.class);
}
@Override
public void start() throws Exception {
System.out.println("Main verticle has started, let's deploy some others...");
// Deploy another instance and want for it to start
vertx.deployVerticle("io.vertx.example.core.verticle.asyncstart.OtherVerticle", res -> {
if (res.succeeded()) {
String deploymentID = res.result();
System.out.println("Other verticle deployed ok, deploymentID = " + deploymentID);
vertx.undeploy(deploymentID, res2 -> {
if (res2.succeeded()) {
System.out.println("Undeployed ok!");
} else {
res2.cause().printStackTrace();
}
});
} else {
res.cause().printStackTrace();
}
});
}
}