io.vertx.core.logging.Logger.debug()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(269)

本文整理了Java中io.vertx.core.logging.Logger.debug()方法的一些代码示例,展示了Logger.debug()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.debug()方法的具体详情如下:
包路径:io.vertx.core.logging.Logger
类名称:Logger
方法名:debug

Logger.debug介绍

暂无

代码示例

代码示例来源:origin: eclipse-vertx/vert.x

private static void logInternal(final String perms) {
 if (perms != null && log.isDebugEnabled()) {
  log.debug("You are running on Windows and POSIX style file permissions are not supported");
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
 protected BlockingAction<Void> chownInternal(String path, String user, String group, Handler<AsyncResult<Void>> handler) {
  if (group != null && log.isDebugEnabled()) {
   log.debug("You are running on Windows and POSIX style file ownership is not supported");
  }
  return super.chownInternal(path, user, group, handler);
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
protected BlockingAction<Void> chmodInternal(String path, String perms, String dirPerms,
                       Handler<AsyncResult<Void>> handler) {
 Objects.requireNonNull(path);
 Objects.requireNonNull(perms);
 logInternal(perms);
 logInternal(dirPerms);
 if (log.isDebugEnabled()) {
  log.debug("You are running on Windows and POSIX style file permissions are not supported!");
 }
 return new BlockingAction<Void>(handler) {
  @Override
  public Void perform() {
   return null;
  }
 };
}

代码示例来源:origin: eclipse-vertx/vert.x

synchronized void writeMessage(ClusteredMessage message) {
 if (connected) {
  Buffer data = message.encodeToWire();
  if (metrics != null) {
   metrics.messageWritten(message.address(), data.length());
  }
  socket.write(data);
 } else {
  if (pending == null) {
   if (log.isDebugEnabled()) {
    log.debug("Not connected to server " + serverID + " - starting queuing");
   }
   pending = new ArrayDeque<>();
  }
  pending.add(message);
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

void close() {
 if (timeoutID != -1) {
  vertx.cancelTimer(timeoutID);
 }
 if (pingTimeoutID != -1) {
  vertx.cancelTimer(pingTimeoutID);
 }
 try {
  client.close();
 } catch (Exception ignore) {
 }
 // The holder can be null or different if the target server is restarted with same serverid
 // before the cleanup for the previous one has been processed
 if (eventBus.connections().remove(serverID, this)) {
  if (log.isDebugEnabled()) {
   log.debug("Cluster connection closed for server " + serverID);
  }
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

private void handshakeComplete(ChannelHandlerContext ctx, FullHttpResponse response) {
  handshaking = false;
  ChannelHandler handler = ctx.pipeline().get(HttpContentDecompressor.class);
  if (handler != null) {
   // remove decompressor as its not needed anymore once connection was upgraded to websockets
   ctx.pipeline().remove(handler);
  }
  WebSocketImpl webSocket = new WebSocketImpl(vertx, Http1xClientConnection.this, supportsContinuation,
                        options.getMaxWebsocketFrameSize(),
                        options.getMaxWebsocketMessageSize());
  ws = webSocket;
  handshaker.finishHandshake(chctx.channel(), response);
  ws.subProtocol(handshaker.actualSubprotocol());
  context.executeFromIO(v -> {
   log.debug("WebSocket handshake complete");
   if (metrics != null ) {
    webSocket.setMetric(metrics.connected(endpointMetric, metric(), webSocket));
   }
   webSocket.registerHandler(vertx.eventBus());
   wsConnect.handle(webSocket);
  });
 }
}

代码示例来源:origin: eclipse-vertx/vert.x

if (connectError && (remainingAttempts > 0 || remainingAttempts == -1)) {
 context.executeFromIO(v -> {
  log.debug("Failed to create connection. Will retry in " + options.getReconnectInterval() + " milliseconds");

代码示例来源:origin: eclipse-vertx/vert.x

log.debug("got request: " + toHex(buffer));
   log.debug("auth failed");
   log.debug("writing: " + toHex(errorResponse));
   socket.write(errorResponse);
   socket.close();
   log.debug("connect: " + host + ":" + port);
   socket.handler(null);
   lastUri = host + ":" + port;
   log.debug("connecting to " + host + ":" + port);
   NetClient netClient = vertx.createNetClient(new NetClientOptions());
   netClient.connect(port, host, result -> {
    if (result.succeeded()) {
     log.debug("writing: " + toHex(connectResponse));
     socket.write(connectResponse);
     log.debug("connected, starting pump");
     NetSocket clientSocket = result.result();
     socket.closeHandler(v -> clientSocket.close());
     log.error("exception", result.cause());
     socket.handler(null);
     log.debug("writing: " + toHex(errorResponse));
     socket.write(errorResponse);
     socket.close();
log.debug("socks4a server started");
return this;

代码示例来源:origin: eclipse-vertx/vert.x

log.debug("got request: " + toHex(buffer));
 } else if(addressType == 3) {
  int stringLen = buffer2.getUnsignedByte(4);
  log.debug("string len " + stringLen);
  if (buffer2.length() != 7 + stringLen) {
   throw new IllegalStateException("format error in client request (attribute type domain name), got " + toHex(buffer2));
 log.debug("got request: " + toHex(buffer2));
 log.debug("connect: " + host + ":" + port);
 socket.handler(null);
 lastUri = host + ":" + port;
 log.debug("connecting to " + host + ":" + port);
 NetClient netClient = vertx.createNetClient(new NetClientOptions());
 netClient.connect(port, host, result -> {
  if (result.succeeded()) {
   log.debug("writing: " + toHex(connectResponse));
   socket.write(connectResponse);
   log.debug("connected, starting pump");
   NetSocket clientSocket = result.result();
   socket.closeHandler(v -> clientSocket.close());
   log.error("exception", result.cause());
   socket.handler(null);
   log.debug("writing: " + toHex(errorResponse));
   socket.write(errorResponse);
   socket.close();

代码示例来源:origin: eclipse-vertx/vert.x

private synchronized void connected(NetSocket socket) {
 this.socket = socket;
 connected = true;
 socket.exceptionHandler(t -> close());
 socket.closeHandler(v -> close());
 socket.handler(data -> {
  // Got a pong back
  vertx.cancelTimer(timeoutID);
  schedulePing();
 });
 // Start a pinger
 schedulePing();
 if (pending != null) {
  if (log.isDebugEnabled()) {
   log.debug("Draining the queue for server " + serverID);
  }
  for (ClusteredMessage message : pending) {
   Buffer data = message.encodeToWire();
   if (metrics != null) {
    metrics.messageWritten(message.address(), data.length());
   }
   socket.write(data);
  }
 }
 pending = null;
}

代码示例来源:origin: eclipse-vertx/vert.x

} else {
 Throwable e = ar.cause();
 log.debug("exception", e);
 int status;
 if (e instanceof UnknownHostException) {

代码示例来源:origin: io.vertx/vertx-core

private static void logInternal(final String perms) {
 if (perms != null && log.isDebugEnabled()) {
  log.debug("You are running on Windows and POSIX style file permissions are not supported");
 }
}

代码示例来源:origin: io.vertx/vertx-core

@Override
 protected BlockingAction<Void> chownInternal(String path, String user, String group, Handler<AsyncResult<Void>> handler) {
  if (group != null && log.isDebugEnabled()) {
   log.debug("You are running on Windows and POSIX style file ownership is not supported");
  }
  return super.chownInternal(path, user, group, handler);
 }
}

代码示例来源:origin: io.vertx/vertx-core

@Override
protected BlockingAction<Void> chmodInternal(String path, String perms, String dirPerms,
                       Handler<AsyncResult<Void>> handler) {
 Objects.requireNonNull(path);
 Objects.requireNonNull(perms);
 logInternal(perms);
 logInternal(dirPerms);
 if (log.isDebugEnabled()) {
  log.debug("You are running on Windows and POSIX style file permissions are not supported!");
 }
 return new BlockingAction<Void>(handler) {
  @Override
  public Void perform() {
   return null;
  }
 };
}

代码示例来源:origin: vert-x3/vertx-web

private void echoRequest(SockJSSocket sock, Buffer requestBuffer) {
 log.debug("Server received " + requestBuffer);
 log.debug("Server sending " + requestBuffer);
 sock.write(requestBuffer);
 sock.close();
}

代码示例来源:origin: vert-x3/vertx-web

private void deliverMessage(SockJSSocket sock, String address, Message message) {
 JsonObject envelope = new JsonObject().put("type", "rec").put("address", address).put("body", message.body());
 if (message.replyAddress() != null) {
  envelope.put("replyAddress", message.replyAddress());
 }
 if (message.headers() != null && !message.headers().isEmpty()) {
  JsonObject headersCopy = new JsonObject();
  for (String name : message.headers().names()) {
   List<String> values = message.headers().getAll(name);
   if (values.size() == 1) {
    headersCopy.put(name, values.get(0));
   } else {
    headersCopy.put(name, values);
   }
  }
  envelope.put("headers", headersCopy);
 }
 checkCallHook(() -> new BridgeEventImpl(BridgeEventType.RECEIVE, envelope, sock),
  () -> sock.write(buffer(envelope.encode())),
  () -> log.debug("outbound message rejected by bridge event handler"));
}

代码示例来源:origin: io.vertx/vertx-core

synchronized void writeMessage(ClusteredMessage message) {
 if (connected) {
  Buffer data = message.encodeToWire();
  if (metrics != null) {
   metrics.messageWritten(message.address(), data.length());
  }
  socket.write(data);
 } else {
  if (pending == null) {
   if (log.isDebugEnabled()) {
    log.debug("Not connected to server " + serverID + " - starting queuing");
   }
   pending = new ArrayDeque<>();
  }
  pending.add(message);
 }
}

代码示例来源:origin: io.vertx/vertx-core

void close() {
 if (timeoutID != -1) {
  vertx.cancelTimer(timeoutID);
 }
 if (pingTimeoutID != -1) {
  vertx.cancelTimer(pingTimeoutID);
 }
 try {
  client.close();
 } catch (Exception ignore) {
 }
 // The holder can be null or different if the target server is restarted with same serverid
 // before the cleanup for the previous one has been processed
 if (eventBus.connections().remove(serverID, this)) {
  if (log.isDebugEnabled()) {
   log.debug("Cluster connection closed for server " + serverID);
  }
 }
}

代码示例来源:origin: io.vertx/vertx-core

private void handshakeComplete(ChannelHandlerContext ctx, FullHttpResponse response) {
  handshaking = false;
  ChannelHandler handler = ctx.pipeline().get(HttpContentDecompressor.class);
  if (handler != null) {
   // remove decompressor as its not needed anymore once connection was upgraded to websockets
   ctx.pipeline().remove(handler);
  }
  WebSocketImpl webSocket = new WebSocketImpl(vertx, Http1xClientConnection.this, supportsContinuation,
                        options.getMaxWebsocketFrameSize(),
                        options.getMaxWebsocketMessageSize());
  ws = webSocket;
  handshaker.finishHandshake(chctx.channel(), response);
  ws.subProtocol(handshaker.actualSubprotocol());
  context.executeFromIO(v -> {
   log.debug("WebSocket handshake complete");
   if (metrics != null ) {
    webSocket.setMetric(metrics.connected(endpointMetric, metric(), webSocket));
   }
   webSocket.registerHandler(vertx.eventBus());
   wsConnect.handle(webSocket);
  });
 }
}

代码示例来源:origin: vert-x3/vertx-web

@Test
public void testCombineTextFrameSockJs() throws InterruptedException {
 String serverPath = "/text-combine-sockjs";
 setupSockJsServer(serverPath, this::echoRequest);
 List<Buffer> receivedMessages = new ArrayList<>();
 WebSocket openedWebSocket = setupSockJsClient(serverPath, receivedMessages);
 Buffer largeMessage = Buffer.buffer("[\"" + TestUtils.randomAlphaString(30) + "\"]");
 WebSocketFrame frame1 = new WebSocketFrameImpl(FrameType.TEXT, largeMessage.slice(0, 10).getByteBuf(), false);
 WebSocketFrame frame2 = WebSocketFrame.continuationFrame(largeMessage.slice(10, 20), false);
 WebSocketFrame frame3 = WebSocketFrame.continuationFrame(largeMessage.slice(20, largeMessage.length()), true);
 log.debug("Client sending " + frame1.textData());
 openedWebSocket.writeFrame(frame1);
 log.debug("Client sending " + frame2.textData());
 openedWebSocket.writeFrame(frame2);
 log.debug("Client sending " + frame3.textData());
 openedWebSocket.writeFrame(frame3);
 await(5, TimeUnit.SECONDS);
 assertEquals("Client should have received 2 messages: the reply and the close.", 2, receivedMessages.size());
 Buffer expectedReply = Buffer.buffer("a" + largeMessage.toString());
 assertEquals("Client reply should have matched request", expectedReply, receivedMessages.get(0));
 assertEquals("Final message should have been a close", SOCKJS_CLOSE_REPLY, receivedMessages.get(1));
}

相关文章