本文整理汇总了Java中io.vertx.core.impl.VertxInternal类的典型用法代码示例。如果您正苦于以下问题:Java VertxInternal类的具体用法?Java VertxInternal怎么用?Java VertxInternal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VertxInternal类属于io.vertx.core.impl包,在下文中一共展示了VertxInternal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("ID");
table.column("Identifier");
table.column("Options");
getVertxService().deploymentIDs().forEach(id -> {
Deployment deployment = ((VertxInternal)getVertxService()).getDeployment(id);
Row row = table.addRow();
row.addContent(id, deployment.verticleIdentifier(), deployment.deploymentOptions().toJson());
}
);
try {
table.print(System.out);
} catch (Throwable t) {
System.err.println("FAILED to write table");
}
return null;
}
示例2: lookupHolder
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
private EmfProvidereHolder lookupHolder() {
synchronized (vertx) {
LocalMap<String, EmfProvidereHolder> map = vertx.sharedData().getLocalMap(DS_LOCAL_MAP_NAME);
EmfProvidereHolder theHolder = map.get(datasourceName);
if (theHolder == null) {
theHolder = new EmfProvidereHolder((VertxInternal) vertx, config, map, datasourceName);
} else {
theHolder.incRefCount();
}
return theHolder;
}
}
示例3: EmfProvidereHolder
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
public EmfProvidereHolder(VertxInternal vertx, JsonObject config, LocalMap<String, EmfProvidereHolder> map, String name) {
this.name = name;
this.config = config;
this.vertx = vertx;
this.map = map;
this.emfProvider = initializeProvider().setConfig(config).setVertx(vertx);
}
示例4: CircuitBreakerMetrics
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
CircuitBreakerMetrics(Vertx vertx, CircuitBreakerImpl circuitBreaker, CircuitBreakerOptions options) {
this.circuitBreaker = circuitBreaker;
this.circuitBreakerTimeout = circuitBreaker.options().getTimeout();
this.circuitBreakerResetTimeout = circuitBreaker.options().getResetTimeout();
this.node = vertx.isClustered() ? ((VertxInternal) vertx).getClusterManager().getNodeID() : "local";
this.rollingWindow = new RollingWindow(options.getMetricsRollingWindow(), options.getMetricsRollingBuckets());
}
示例5: getNodeId
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
private String getNodeId(Vertx vertx) {
if (vertx.isClustered()) {
return ((VertxInternal) vertx).getNodeID();
} else {
return "localhost";
}
}
示例6: setUp
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
@Before
public void setUp() {
Vertx.clusteredVertx(new VertxOptions(), ar -> {
((VertxInternal) ar.result()).getClusterManager().<String, String>getAsyncMap("some-name", x -> {
map = x.result();
vertx = ar.result();
});
});
await().until(() -> vertx != null);
}
示例7: registerReadinessChecks
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
/**
* Registers a check which succeeds if a connection with the configured <em>Authentication</em> service can be established.
*
* @param readinessHandler The health check handler to register the checks with.
*/
@Override
public void registerReadinessChecks(final HealthCheckHandler readinessHandler) {
if (dnsClient != null) {
log.info("registering readiness check using DNS Client");
readinessHandler.register("authentication-service-availability", status -> {
log.trace("checking availability of Authentication service");
dnsClient.lookup(getConfig().getHost(), lookupAttempt -> {
if (lookupAttempt.succeeded()) {
status.tryComplete(Status.OK());
} else {
log.debug("readiness check failed to resolve Authentication service address [{}]: ",
getConfig().getHost(), lookupAttempt.cause().getMessage());
status.tryComplete(Status.KO());
}
});
});
} else if (VertxInternal.class.isInstance(vertx)) {
log.info("registering readiness check using vert.x Address Resolver");
readinessHandler.register("authentication-service-availability", status -> {
log.trace("checking availability of Authentication service");
((VertxInternal) vertx).resolveAddress(getConfig().getHost(), lookupAttempt -> {
if (lookupAttempt.succeeded()) {
status.tryComplete(Status.OK());
} else {
log.debug("readiness check failed to resolve Authentication service address [{}]: ",
getConfig().getHost(), lookupAttempt.cause().getMessage());
status.tryComplete(Status.KO());
};
});
});
} else {
log.warn("cannot register readiness check, no DNS resolver available");
}
}
示例8: getNodeId
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
private static String getNodeId(Vertx vertx) {
if (vertx.isClustered()) {
return ((VertxInternal) vertx).getNodeID();
} else {
return "localhost";
}
}
示例9: AsyncMultiMapImpl
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
/**
* Constructor.
*
* @param cache {@link IgniteCache} instance.
* @param vertx {@link Vertx} instance.
*/
public AsyncMultiMapImpl(IgniteCache<K, Set<V>> cache, Vertx vertx) {
cache.unwrap(Ignite.class).events().localListen((IgnitePredicate<Event>)event -> {
if (!(event instanceof CacheEvent)) {
throw new IllegalArgumentException("Unknown event received: " + event);
}
CacheEvent cacheEvent = (CacheEvent)event;
if (Objects.equals(cacheEvent.cacheName(), cache.getName()) &&
((IgniteCacheProxy)cache).context().localNodeId().equals(cacheEvent.eventNode().id())) {
K key = unmarshal(cacheEvent.key());
switch (cacheEvent.type()) {
case EVT_CACHE_OBJECT_REMOVED:
subs.remove(key);
break;
default:
throw new IllegalArgumentException("Unknown event received: " + event);
}
}
return true;
}, EVT_CACHE_OBJECT_REMOVED);
this.cache = cache;
this.vertx = (VertxInternal) vertx;
}
示例10: InfinispanAsyncMultiMap
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
public InfinispanAsyncMultiMap(Vertx vertx, Cache<MultiMapKey, Object> cache) {
this.vertx = (VertxInternal) vertx;
this.cache = cache;
nearCache = new ConcurrentHashMap<>();
cache.addListener(new EntryListener());
taskQueue = new TaskQueue();
}
示例11: sendUpdateOnEventBus
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
private void sendUpdateOnEventBus() {
vertx.eventBus().publish("circuit-breaker[" + name + "]", new JsonObject()
.put("name", name)
.put("state", state)
.put("failures", failures)
.put("node", vertx.isClustered() ? ((VertxInternal) vertx).getClusterManager().getNodeID() : "local"));
}
示例12: ExtendedAsyncMapImpl
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
public ExtendedAsyncMapImpl(Vertx vertx, String name) {
this.vertx = vertx;
ClusterManager clusterManager = ((VertxInternal) vertx).getClusterManager();
if (clusterManager == null) {
syncMap = new ConcurrentHashMap<>();
} else {
syncMap = clusterManager.getSyncMap(name);
}
}
示例13: getCounter
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
/**
* Get a local counter. The counter will be passed to the handler.
*
* @param name the name of the counter.
* @param resultHandler the handler
*/
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(resultHandler, "resultHandler");
Counter counter = this.localCounters
.computeIfAbsent(name, (n) -> new AsynchronousCounter((VertxInternal) this.vertx));
Context context = this.vertx.getOrCreateContext();
context.runOnContext((v) -> resultHandler.handle(Future.succeededFuture(counter)));
}
示例14: CommandRegistryImpl
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
public CommandRegistryImpl(VertxInternal vertx) {
this.vertx = vertx;
hook = completionHandler -> {
try {
doClose();
registries.remove(vertx);
} catch (Exception e) {
completionHandler.handle(Future.failedFuture(e));
return;
}
completionHandler.handle(Future.succeededFuture());
};
vertx.addCloseHook(hook);
}
示例15: kill
import io.vertx.core.impl.VertxInternal; //导入依赖的package包/类
protected void kill(int pos) {
VertxInternal v = (VertxInternal) vertices[pos];
v.executeBlocking(fut -> {
v.simulateKill();
fut.complete();
}, ar -> {
assertTrue(ar.succeeded());
});
}