com.alipay.sofa.rpc.log.Logger.isInfoEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(232)

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

Logger.isInfoEnabled介绍

[英]Is info enabled boolean.
[中]是启用信息的布尔值。

代码示例

代码示例来源:origin: alipay/sofa-rpc

public SnappyRpcCompressor() {
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("Init Snappy compressor");
  }
}

代码示例来源:origin: alipay/sofa-rpc

public SnappyRpcCompressor() {
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("Init Snappy compressor");
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void stop() {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("Shutdown the SOFA RPC HTTP/2 server transport now...");
    }
    NettyHelper.closeServerBossEventLoopGroup(transportConfig);
    if (bizGroup != null) {
      bizGroup.shutdownGracefully();
    }
    serverBootstrap = null;
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void stop() {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("Shutdown the SOFA RPC HTTP/2 server transport now...");
    }
    NettyHelper.closeServerBossEventLoopGroup(transportConfig);
    if (bizGroup != null) {
      bizGroup.shutdownGracefully();
    }
    serverBootstrap = null;
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("User Event Triggered: {}", evt);
    }
    ctx.fireUserEventTriggered(evt);
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("User Event Triggered: {}", evt);
    }
    ctx.fireUserEventTriggered(evt);
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void stateChanged(CuratorFramework client, ConnectionState newState) {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("reconnect to zookeeper,recover provider and consumer data");
    }
    if (newState == ConnectionState.RECONNECTED) {
      recoverRegistryData();
    }
  }
});

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void stateChanged(CuratorFramework client, ConnectionState newState) {
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("reconnect to zookeeper,recover provider and consumer data");
    }
    if (newState == ConnectionState.RECONNECTED) {
      recoverRegistryData();
    }
  }
});

代码示例来源:origin: alipay/sofa-rpc

/**
 * 关闭全部客户端连接
 */
public static void closeAll() {
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("Shutdown all client transport now!");
  }
  try {
    CLIENT_TRANSPORT_HOLDER.destroy();
  } catch (Exception e) {
    LOGGER.error(e.getMessage(), e);
  }
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * 关闭全部客户端连接
 */
public static void closeAll() {
  if (LOGGER.isInfoEnabled()) {
    LOGGER.info("Shutdown all client transport now!");
  }
  try {
    CLIENT_TRANSPORT_HOLDER.destroy();
  } catch (Exception e) {
    LOGGER.error(e.getMessage(), e);
  }
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * 打印连接失败日志
 *
 * @param interfaceId  接口名称
 * @param providerInfo 服务端
 * @param transport    连接
 */
protected void printFailure(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
    LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !", interfaceId,
      providerInfo);
  }
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * 打印连接失败日志
 *
 * @param interfaceId  接口名称
 * @param providerInfo 服务端
 * @param transport    连接
 */
protected void printFailure(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
    LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} failure !", interfaceId,
      providerInfo);
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (future.isSuccess()) {
      if (LOGGER.isInfoEnabled()) {
        LOGGER.info("HTTP/2 Server bind to {}:{} success!",
          transportConfig.getHost(), transportConfig.getPort());
      }
    } else {
      LOGGER.error("HTTP/2 Server bind to {}:{} failed!",
        transportConfig.getHost(), transportConfig.getPort());
      stop();
    }
  }
});

代码示例来源:origin: alipay/sofa-rpc

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (future.isSuccess()) {
      if (LOGGER.isInfoEnabled()) {
        LOGGER.info("HTTP/2 Server bind to {}:{} success!",
          transportConfig.getHost(), transportConfig.getPort());
      }
    } else {
      LOGGER.error("HTTP/2 Server bind to {}:{} failed!",
        transportConfig.getHost(), transportConfig.getPort());
      stop();
    }
  }
});

代码示例来源:origin: alipay/sofa-rpc

@Override
public void stop() {
  if (!started) {
    return;
  }
  try {
    // 关闭端口,不关闭线程池
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("Stop the http rest server at port {}", serverConfig.getPort());
    }
    httpServer.stop();
  } catch (Exception e) {
    LOGGER.error("Stop the http rest server at port " + serverConfig.getPort() + " error !", e);
  }
  started = false;
}

代码示例来源:origin: alipay/sofa-rpc

@Override
public void stop() {
  if (!started) {
    return;
  }
  try {
    // 关闭端口,不关闭线程池
    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("Stop the http rest server at port {}", serverConfig.getPort());
    }
    httpServer.stop();
  } catch (Exception e) {
    LOGGER.error("Stop the http rest server at port " + serverConfig.getPort() + " error !", e);
  }
  started = false;
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * 打印连接成功日志
 *
 * @param interfaceId  接口名称
 * @param providerInfo 服务端
 * @param transport    连接
 */
protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
    LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
      + NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
      , interfaceId, providerInfo);
  }
}

代码示例来源:origin: alipay/sofa-rpc

/**
 * 打印连接成功日志
 *
 * @param interfaceId  接口名称
 * @param providerInfo 服务端
 * @param transport    连接
 */
protected void printSuccess(String interfaceId, ProviderInfo providerInfo, ClientTransport transport) {
  if (LOGGER.isInfoEnabled(consumerConfig.getAppName())) {
    LOGGER.infoWithApp(consumerConfig.getAppName(), "Connect to {} provider:{} success ! The connection is "
      + NetUtils.connectToString(transport.remoteAddress(), transport.localAddress())
      , interfaceId, providerInfo);
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
public void disconnect() {
  try {
    if (connection != null) {
      if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Try disconnect client transport now. The connection is {}.",
          NetUtils.channelToString(localAddress(), remoteAddress()));
      }
      connectionManager.closeConnection(RPC_CLIENT, transportConfig, url);
      connection = null;
    }
  } catch (Exception e) {
    throw new SofaRpcRuntimeException("", e);
  }
}

代码示例来源:origin: alipay/sofa-rpc

@Override
public void disconnect() {
  try {
    if (connection != null) {
      if (LOGGER.isInfoEnabled()) {
        LOGGER.info("Try disconnect client transport now. The connection is {}.",
          NetUtils.channelToString(localAddress(), remoteAddress()));
      }
      connectionManager.closeConnection(RPC_CLIENT, transportConfig, url);
      connection = null;
    }
  } catch (Exception e) {
    throw new SofaRpcRuntimeException("", e);
  }
}

相关文章