本文整理了Java中io.vertx.core.logging.Logger.error()
方法的一些代码示例,展示了Logger.error()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.error()
方法的具体详情如下:
包路径:io.vertx.core.logging.Logger
类名称:Logger
方法名:error
暂无
代码示例来源:origin: eclipse-vertx/vert.x
private void handleException(Throwable t) {
if (exceptionHandler != null && t instanceof Exception) {
exceptionHandler.handle(t);
} else {
log.error("Unhandled exception", t);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private <T> void reportResult(Context context, Handler<AsyncResult<T>> completionHandler, AsyncResult<T> result) {
context.runOnContext(v -> {
try {
completionHandler.handle(result);
} catch (Throwable t) {
log.error("Failure in calling handler", t);
throw t;
}
});
}
代码示例来源:origin: eclipse-vertx/vert.x
private void handleException(Exception e) {
handshaking = false;
buffered.clear();
Handler<Throwable> handler = exceptionHandler();
if (handler != null) {
context.executeFromIO(v -> {
handler.handle(e);
});
} else {
log.error("Error in websocket handshake", e);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private <T> void reportFailure(Throwable t, Context context, Handler<AsyncResult<T>> completionHandler) {
if (completionHandler != null) {
reportResult(context, completionHandler, Future.failedFuture(t));
} else {
log.error(t.getMessage(), t);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
public void reportException(Throwable t) {
Handler<Throwable> handler = this.exceptionHandler;
if (handler == null) {
handler = owner.exceptionHandler();
}
if (handler != null) {
handler.handle(t);
} else {
log.error("Unhandled exception", t);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private void deployHADeployments() {
int size = toDeployOnQuorum.size();
if (size != 0) {
log.info("There are " + size + " HA deploymentIDs waiting on a quorum. These will now be deployed");
Runnable task;
while ((task = toDeployOnQuorum.poll()) != null) {
try {
task.run();
} catch (Throwable t) {
log.error("Failed to run redeployment task", t);
}
}
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private void startEventBus(Handler<AsyncResult<Vertx>> resultHandler) {
eventBus.start(ar -> {
if (ar.succeeded()) {
initializeHaManager(resultHandler);
} else {
log.error("Failed to start event bus", ar.cause());
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Creates a new instance of {@link VertxIsolatedDeployer}.
*
* @return the new instance.
*/
protected synchronized Object newInstance() {
try {
classloader = (classpath == null || classpath.isEmpty()) ?
ClasspathHandler.class.getClassLoader() : createClassloader();
Class<?> clazz = classloader.loadClass("io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer");
return clazz.newInstance();
} catch (Exception e) {
log.error("Failed to load or instantiate the isolated deployer", e);
throw new IllegalStateException(e);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private void joinCluster(VertxOptions options, Handler<AsyncResult<Vertx>> resultHandler) {
clusterManager.setVertx(this);
clusterManager.join(ar -> {
if (ar.succeeded()) {
createHaManager(options, resultHandler);
} else {
log.error("Failed to join cluster", ar.cause());
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: eclipse-vertx/vert.x
private void closeClusterManager(Handler<AsyncResult<Void>> completionHandler) {
if (clusterManager != null) {
clusterManager.leave(ar -> {
if (ar.failed()) {
log.error("Failed to leave cluster", ar.cause());
}
if (completionHandler != null) {
runOnContext(v -> completionHandler.handle(Future.succeededFuture()));
}
});
} else if (completionHandler != null) {
runOnContext(v -> completionHandler.handle(Future.succeededFuture()));
}
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Undeploys the previously deployed verticle.
*
* @param completionHandler the completion handler
*/
public void undeploy(Handler<AsyncResult<Void>> completionHandler) {
vertx.undeploy(deploymentId, res -> {
if (res.failed()) {
log.error("Failed in undeploying " + deploymentId, res.cause());
} else {
log.info("Succeeded in undeploying " + deploymentId);
}
deploymentId = null;
completionHandler.handle(res);
});
}
代码示例来源:origin: eclipse-vertx/vert.x
protected synchronized void handleException(Throwable t) {
NetworkMetrics metrics = metrics();
if (metrics != null) {
metrics.exceptionOccurred(metric, remoteAddress(), t);
}
if (exceptionHandler != null) {
exceptionHandler.handle(t);
} else {
if (log.isDebugEnabled()) {
log.error(t.getMessage(), t);
} else {
log.error(t.getMessage());
}
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public String absoluteURI() {
if (absoluteURI == null) {
try {
absoluteURI = HttpUtils.absoluteURI(conn.getServerOrigin(), this);
} catch (URISyntaxException e) {
log.error("Failed to create abs uri", e);
}
}
return absoluteURI;
}
代码示例来源:origin: eclipse-vertx/vert.x
private void checkHADeployments() {
try {
if (attainedQuorum) {
deployHADeployments();
} else {
undeployHADeployments();
}
} catch (Throwable t) {
log.error("Failed when checking HA deploymentIDs", t);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
public synchronized void setResult(AsyncResult<Void> result) {
this.result = result;
if (completionHandler != null) {
if (metrics != null && result.succeeded()) {
metric = metrics.handlerRegistered(address, repliedAddress);
}
Handler<AsyncResult<Void>> callback = completionHandler;
vertx.runOnContext(v -> callback.handle(result));
} else if (result.failed()) {
log.error("Failed to propagate registration for handler " + handler + " and address " + address);
} else if (metrics != null) {
metric = metrics.handlerRegistered(address, repliedAddress);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void next() {
if (iter.hasNext()) {
try {
Handler<DeliveryContext> handler = iter.next();
if (handler != null) {
handler.handle(this);
} else {
next();
}
} catch (Throwable t) {
log.error("Failure in interceptor", t);
}
} else {
holder.getHandler().handle(message);
}
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public String absoluteURI() {
if (method() == HttpMethod.CONNECT) {
return null;
}
synchronized (conn) {
if (absoluteURI == null) {
try {
absoluteURI = HttpUtils.absoluteURI(serverOrigin, this);
} catch (URISyntaxException e) {
log.error("Failed to create abs uri", e);
}
}
return absoluteURI;
}
}
代码示例来源:origin: eclipse-vertx/vert.x
private void createHaManager(VertxOptions options, Handler<AsyncResult<Vertx>> resultHandler) {
this.<Map<String, String>>executeBlocking(fut -> {
fut.complete(clusterManager.getSyncMap(CLUSTER_MAP_NAME));
}, false, ar -> {
if (ar.succeeded()) {
Map<String, String> clusterMap = ar.result();
haManager = new HAManager(this, deploymentManager, clusterManager, clusterMap, options.getQuorumSize(), options.getHAGroup(), options.isHAEnabled());
startEventBus(resultHandler);
} else {
log.error("Failed to start HAManager", ar.cause());
resultHandler.handle(Future.failedFuture(ar.cause()));
}
});
}
代码示例来源:origin: eclipse-vertx/vert.x
protected void closeClustered(List<Vertx> clustered) throws Exception {
CountDownLatch latch = new CountDownLatch(clustered.size());
for (Vertx clusteredVertx : clustered) {
clusteredVertx.close(ar -> {
if (ar.failed()) {
log.error("Failed to shutdown vert.x", ar.cause());
}
latch.countDown();
});
}
assertTrue(latch.await(180, TimeUnit.SECONDS));
}
代码示例来源:origin: eclipse-vertx/vert.x
private <T> void onSubsReceived(AsyncResult<ChoosableIterable<ClusterNodeInfo>> asyncResult, OutboundDeliveryContext<T> sendContext) {
if (asyncResult.succeeded()) {
ChoosableIterable<ClusterNodeInfo> serverIDs = asyncResult.result();
if (serverIDs != null && !serverIDs.isEmpty()) {
sendToSubs(serverIDs, sendContext);
} else {
if (metrics != null) {
metrics.messageSent(sendContext.message.address(), !sendContext.message.isSend(), true, false);
}
deliverMessageLocally(sendContext);
}
} else {
log.error("Failed to send message", asyncResult.cause());
}
}
内容来源于网络,如有侵权,请联系作者删除!