本文整理了Java中io.vertx.core.Context.deploymentID()
方法的一些代码示例,展示了Context.deploymentID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.deploymentID()
方法的具体详情如下:
包路径:io.vertx.core.Context
类名称:Context
方法名:deploymentID
[英]If the context is associated with a Verticle deployment, this returns the deployment ID of that deployment.
[中]如果上下文与垂直部署关联,则返回该部署的部署ID。
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Get the deployment ID of the verticle deployment
* @return the deployment ID
*/
public String deploymentID() {
return context.deploymentID();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void start() throws Exception {
processArgs = context.processArgs();
conf = context.config();
// if (Thread.currentThread().getContextClassLoader() != getClass().getClassLoader()) {
// throw new IllegalStateException("Wrong tccl!");
// }
vertx.eventBus().send("testcounts",
new JsonObject().put("deploymentID", context.deploymentID()).put("count", instanceCount.incrementAndGet()));
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void start() throws Exception {
thread.set(Thread.currentThread());
assertTrue(Context.isOnVertxThread());
assertTrue(Context.isOnWorkerThread());
assertFalse(Context.isOnEventLoopThread());
assertTrue(Thread.currentThread().getName().startsWith(poolName + "-"));
context.runOnContext(v -> {
vertx.undeploy(context.deploymentID());
});
}
}, new DeploymentOptions().setWorker(true).setWorkerPoolName(poolName), onSuccess(deployment::set));
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void start() throws Exception {
vertx.executeBlocking(fut -> {
thread.set(Thread.currentThread());
assertTrue(Context.isOnVertxThread());
assertTrue(Context.isOnWorkerThread());
assertFalse(Context.isOnEventLoopThread());
assertTrue(Thread.currentThread().getName().startsWith(poolName + "-"));
fut.complete();
}, onSuccess(v -> {
vertx.undeploy(context.deploymentID());
}));
}
}, new DeploymentOptions().setWorkerPoolName(poolName), onSuccess(v -> {}));
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void start() throws Exception {
switch (startAction) {
case THROW_EXCEPTION:
throw new Exception("FooBar!");
case THROW_ERROR:
throw new Error("FooBar!");
default:
startCalled = true;
startContext = Vertx.currentContext();
}
deploymentID = Vertx.currentContext().deploymentID();
config = context.config();
}
代码示例来源:origin: io.vertx/vertx-core
/**
* Get the deployment ID of the verticle deployment
* @return the deployment ID
*/
public String deploymentID() {
return context.deploymentID();
}
代码示例来源:origin: io.vertx/vertx-core
@Override
public void start() throws Exception {
processArgs = context.processArgs();
conf = context.config();
// if (Thread.currentThread().getContextClassLoader() != getClass().getClassLoader()) {
// throw new IllegalStateException("Wrong tccl!");
// }
vertx.eventBus().send("testcounts",
new JsonObject().put("deploymentID", context.deploymentID()).put("count", instanceCount.incrementAndGet()));
}
代码示例来源:origin: io.vertx/vertx-core
@Override
public void start() throws Exception {
vertx.executeBlocking(fut -> {
thread.set(Thread.currentThread());
assertTrue(Context.isOnVertxThread());
assertTrue(Context.isOnWorkerThread());
assertFalse(Context.isOnEventLoopThread());
assertTrue(Thread.currentThread().getName().startsWith(poolName + "-"));
fut.complete();
}, onSuccess(v -> {
vertx.undeploy(context.deploymentID());
}));
}
}, new DeploymentOptions().setWorkerPoolName(poolName), onSuccess(v -> {}));
代码示例来源:origin: io.vertx/vertx-core
@Override
public void start() throws Exception {
thread.set(Thread.currentThread());
assertTrue(Context.isOnVertxThread());
assertTrue(Context.isOnWorkerThread());
assertFalse(Context.isOnEventLoopThread());
assertTrue(Thread.currentThread().getName().startsWith(poolName + "-"));
context.runOnContext(v -> {
vertx.undeploy(context.deploymentID());
});
}
}, new DeploymentOptions().setWorker(true).setWorkerPoolName(poolName), onSuccess(deployment::set));
代码示例来源:origin: io.vertx/vertx-core
@Override
public void start() throws Exception {
switch (startAction) {
case THROW_EXCEPTION:
throw new Exception("FooBar!");
case THROW_ERROR:
throw new Error("FooBar!");
default:
startCalled = true;
startContext = Vertx.currentContext();
}
deploymentID = Vertx.currentContext().deploymentID();
config = context.config();
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* If the context is associated with a Verticle deployment, this returns the deployment ID of that deployment.
* @return the deployment ID of the deployment or null if not a Verticle deployment
*/
public String deploymentID() {
String ret = delegate.deploymentID();
return ret;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* If the context is associated with a Verticle deployment, this returns the deployment ID of that deployment.
* @return the deployment ID of the deployment or null if not a Verticle deployment
*/
public String deploymentID() {
String ret = delegate.deploymentID();
return ret;
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeployWithOptionsAsEmptyString(TestContext context) {
String cmd = "verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle ''";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(1, ctx.get().getInstanceCount());
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeploy(TestContext context) {
String cmd = "verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(1, ctx.get().getInstanceCount());
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeployWithOptionsAsJsonInstance(TestContext context) {
String cmd =
"verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle '{\"instances\" : 8}'";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(8, ctx.get().getInstanceCount());
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeployWithOptionsAsEmptyJsonString(TestContext context) {
String cmd = "verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle '{}'";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(1, ctx.get().getInstanceCount());
}
代码示例来源:origin: io.vertx/vertx-shell
@Test
public void testDeployWithOptionsAsJsonConfig(TestContext context) {
String cmd =
"verticle-deploy io.vertx.ext.shell.command.base.DeployVerticleTest$SomeVerticle '{\"config\":{\"ok\":true}}'";
String result = testDeployCmd(context, cmd);
context.assertNotNull(ctx.get());
context.assertEquals(result, "Deployed " + ctx.get().deploymentID());
context.assertEquals(1, ctx.get().getInstanceCount());
context.assertNotNull(ctx.get().config());
context.assertTrue(ctx.get().config().containsKey("ok"));
context.assertEquals(true, ctx.get().config().getBoolean("ok"));
}
代码示例来源:origin: io.vertx/vertx-service-factory
@Override
public void start() throws Exception {
vertx.runOnContext(v -> {
List<String> extraCP = Arrays.asList("blah", "wibble");
DeploymentOptions expected = new DeploymentOptions().setConfig(new JsonObject().put("foo", "bar"))
.setWorker(true).setIsolationGroup("mygroup").setExtraClasspath(extraCP);
Deployment dep = ((VertxInternal) vertx).getDeployment(Vertx.currentContext().deploymentID());
vertx.eventBus().publish("moduleStarted", expected.equals(dep.deploymentOptions()));
});
}
代码示例来源:origin: io.vertx/vertx-kafka-client
@Override
public void start(Future<Void> fut) {
KafkaConsumer<String, String> consumer = KafkaConsumer.create(vertx, config);
deployed = true;
consumer.handler(record -> {
if (deployed) {
deployed = false;
vertx.undeploy(context.deploymentID(), ctx.asyncAssertSuccess(v2 -> async.countDown()));
}
});
consumer.assign(new TopicPartition(topicName, 0), fut);
}
}, ctx.asyncAssertSuccess(v -> produceLatch.complete()));
代码示例来源:origin: weld/weld-vertx
public void consumerWithDependencies(@Observes @VertxConsumer(TEST_DEP) VertxEvent event, CoolService coolService) {
assertEquals(TEST_DEP, event.getAddress());
assertNotNull(event.getReplyAddress());
assertNotNull(coolService);
assertNotNull(coolService.getCacheService());
assertNotNull(coolService.getVertx().eventBus());
assertNotNull(coolService.getContext().deploymentID());
event.setReply(coolService.getId() + "_" + coolService.getCacheService().getId());
assertTrue(event.isReplied());
}
内容来源于网络,如有侵权,请联系作者删除!