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

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

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

Logger.warn介绍

[英]Warn.
[中]警告

代码示例

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

@Override
  public void run() {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("SOFA RPC Framework catch JVM shutdown event, Run shutdown hook now.");
    }
    destroy(false);
  }
}, "SOFA-RPC-ShutdownHook"));

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

@Override
public boolean start() {
  if (namingService == null) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("Nacos client should be initialized before starting.");
    }
    return false;
  }
  return true;
}

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

@Override
  public void run() {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("SOFA RPC Framework catch JVM shutdown event, Run shutdown hook now.");
    }
    destroy(false);
  }
}, "SOFA-RPC-ShutdownHook"));

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

@Override
public boolean start() {
  if (namingService == null) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("Nacos client should be initialized before starting.");
    }
    return false;
  }
  return true;
}

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

@Override
  public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(),
        executor.getPoolSize(), executor.getLargestPoolSize(), executor
          .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue()
          .size(), executor.getQueue().remainingCapacity()));
    }
    throw new RejectedExecutionException();
  }
}

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

@Override
  public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(),
        executor.getPoolSize(), executor.getLargestPoolSize(), executor
          .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue()
          .size(), executor.getQueue().remainingCapacity()));
    }
    throw new RejectedExecutionException();
  }
}

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

@Override
  public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
    if (i++ % 7 == 0) {
      i = 1;
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn("Task:{} has been reject because of threadPool exhausted!" +
          " pool:{}, active:{}, queue:{}, taskcnt: {}", r,
          executor.getPoolSize(),
          executor.getActiveCount(),
          executor.getQueue().size(),
          executor.getTaskCount());
      }
    }
    throw new RejectedExecutionException("Callback handler thread pool has bean exhausted");
  }
};

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

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  super.exceptionCaught(ctx, cause);
  if (LOGGER.isWarnEnabled()) {
    LOGGER.warn("", cause);
  }
  ctx.close();
}

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

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  super.exceptionCaught(ctx, cause);
  if (LOGGER.isWarnEnabled()) {
    LOGGER.warn("", cause);
  }
  ctx.close();
}

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

private static void handleEvent(final Subscriber subscriber, final Event event) {
    try {
      subscriber.onEvent(event);
    } catch (Throwable e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn("Handle " + event.getClass() + " error", e);
      }
    }
  }
}

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

private static void handleEvent(final Subscriber subscriber, final Event event) {
    try {
      subscriber.onEvent(event);
    } catch (Throwable e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn("Handle " + event.getClass() + " error", e);
      }
    }
  }
}

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

@Override
public void destroy() {
  // 销毁前备份一下
  // LocalRegistryHelper.backup(regFile, memoryCache);
  try {
    if (scheduledExecutorService != null) {
      scheduledExecutorService.shutdown();
      scheduledExecutorService = null;
    }
  } catch (Throwable t) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn(t.getMessage(), t);
    }
  }
}

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

/**
 * 4.3 客户端异步收到响应,做准备,例如设置到上下文
 */
public static void clientAsyncReceivedPrepare() {
  if (openTrace) {
    try {
      tracer.clientAsyncReceivedPrepare();
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn(e.getMessage(), e);
      }
    }
  }
}

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

/**
 * 4.3 客户端异步收到响应,做准备,例如设置到上下文
 */
public static void clientAsyncReceivedPrepare() {
  if (openTrace) {
    try {
      tracer.clientAsyncReceivedPrepare();
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn(e.getMessage(), e);
      }
    }
  }
}

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

/**
 * 检查状态,在结束调用的时候进行调用,防止资源泄露
 */
public static void checkState() {
  if (openTrace) {
    try {
      tracer.checkState();
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn(e.getMessage(), e);
      }
    }
  }
}

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

/**
 * 检查状态,在结束调用的时候进行调用,防止资源泄露
 */
public static void checkState() {
  if (openTrace) {
    try {
      tracer.checkState();
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn(e.getMessage(), e);
      }
    }
  }
}

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

/**
 * 1:客户端发送请求前
 *
 * @param request 调用请求
 */
public static void clientBeforeSend(SofaRequest request) {
  if (openTrace) {
    try {
      tracer.clientBeforeSend(request);
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn(e.getMessage(), e);
      }
    }
  }
}

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

@Override
public void destroy() {
  // 销毁前备份一下
  // LocalRegistryHelper.backup(regFile, memoryCache);
  try {
    if (scheduledExecutorService != null) {
      scheduledExecutorService.shutdown();
      scheduledExecutorService = null;
    }
  } catch (Throwable t) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn(t.getMessage(), t);
    }
  }
}

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

/**
 * 检查是否有没回收
 */
protected void checkLeak() {
  if (CommonUtils.isNotEmpty(urlConnectionMap)) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("Bolt client transport maybe leak. {}", urlConnectionMap);
    }
    urlConnectionMap.clear();
  }
  if (CommonUtils.isNotEmpty(connectionRefCounter)) {
    if (LOGGER.isWarnEnabled()) {
      LOGGER.warn("Bolt client transport maybe leak. {}", connectionRefCounter);
    }
    connectionRefCounter.clear();
  }
}

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

/**
 * 0:开始
 *
 * @param request 调用请求
 */
public static void startRpc(SofaRequest request) {
  if (openTrace) {
    try {
      tracer.startRpc(request);
    } catch (Exception e) {
      if (LOGGER.isWarnEnabled()) {
        LOGGER.warn("", e);
      }
    }
  }
}

相关文章