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

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

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

Logger.isWarnEnabled介绍

[英]Is warn enabled boolean.
[中]已启用警告布尔值。

代码示例

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

  1. @Override
  2. public void run() {
  3. if (LOGGER.isWarnEnabled()) {
  4. LOGGER.warn("SOFA RPC Framework catch JVM shutdown event, Run shutdown hook now.");
  5. }
  6. destroy(false);
  7. }
  8. }, "SOFA-RPC-ShutdownHook"));

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

  1. @Override
  2. public boolean start() {
  3. if (namingService == null) {
  4. if (LOGGER.isWarnEnabled()) {
  5. LOGGER.warn("Nacos client should be initialized before starting.");
  6. }
  7. return false;
  8. }
  9. return true;
  10. }

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

  1. @Override
  2. public void run() {
  3. if (LOGGER.isWarnEnabled()) {
  4. LOGGER.warn("SOFA RPC Framework catch JVM shutdown event, Run shutdown hook now.");
  5. }
  6. destroy(false);
  7. }
  8. }, "SOFA-RPC-ShutdownHook"));

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

  1. @Override
  2. public boolean start() {
  3. if (namingService == null) {
  4. if (LOGGER.isWarnEnabled()) {
  5. LOGGER.warn("Nacos client should be initialized before starting.");
  6. }
  7. return false;
  8. }
  9. return true;
  10. }

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

  1. @Override
  2. public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
  3. if (LOGGER.isWarnEnabled()) {
  4. LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(),
  5. executor.getPoolSize(), executor.getLargestPoolSize(), executor
  6. .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue()
  7. .size(), executor.getQueue().remainingCapacity()));
  8. }
  9. throw new RejectedExecutionException();
  10. }
  11. }

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

  1. @Override
  2. public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
  3. if (LOGGER.isWarnEnabled()) {
  4. LOGGER.warn(LogCodes.getLog(LogCodes.ERROR_PROVIDER_TR_POOL_REJECTION, executor.getActiveCount(),
  5. executor.getPoolSize(), executor.getLargestPoolSize(), executor
  6. .getCorePoolSize(), executor.getMaximumPoolSize(), executor.getQueue()
  7. .size(), executor.getQueue().remainingCapacity()));
  8. }
  9. throw new RejectedExecutionException();
  10. }
  11. }

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

  1. @Override
  2. public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  3. super.exceptionCaught(ctx, cause);
  4. if (LOGGER.isWarnEnabled()) {
  5. LOGGER.warn("", cause);
  6. }
  7. ctx.close();
  8. }

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

  1. @Override
  2. public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  3. super.exceptionCaught(ctx, cause);
  4. if (LOGGER.isWarnEnabled()) {
  5. LOGGER.warn("", cause);
  6. }
  7. ctx.close();
  8. }

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

  1. private static void handleEvent(final Subscriber subscriber, final Event event) {
  2. try {
  3. subscriber.onEvent(event);
  4. } catch (Throwable e) {
  5. if (LOGGER.isWarnEnabled()) {
  6. LOGGER.warn("Handle " + event.getClass() + " error", e);
  7. }
  8. }
  9. }
  10. }

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

  1. private static void handleEvent(final Subscriber subscriber, final Event event) {
  2. try {
  3. subscriber.onEvent(event);
  4. } catch (Throwable e) {
  5. if (LOGGER.isWarnEnabled()) {
  6. LOGGER.warn("Handle " + event.getClass() + " error", e);
  7. }
  8. }
  9. }
  10. }

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

  1. /**
  2. * 4.3 客户端异步收到响应,做准备,例如设置到上下文
  3. */
  4. public static void clientAsyncReceivedPrepare() {
  5. if (openTrace) {
  6. try {
  7. tracer.clientAsyncReceivedPrepare();
  8. } catch (Exception e) {
  9. if (LOGGER.isWarnEnabled()) {
  10. LOGGER.warn(e.getMessage(), e);
  11. }
  12. }
  13. }
  14. }

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

  1. /**
  2. * 4.3 客户端异步收到响应,做准备,例如设置到上下文
  3. */
  4. public static void clientAsyncReceivedPrepare() {
  5. if (openTrace) {
  6. try {
  7. tracer.clientAsyncReceivedPrepare();
  8. } catch (Exception e) {
  9. if (LOGGER.isWarnEnabled()) {
  10. LOGGER.warn(e.getMessage(), e);
  11. }
  12. }
  13. }
  14. }

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

  1. /**
  2. * 检查状态,在结束调用的时候进行调用,防止资源泄露
  3. */
  4. public static void checkState() {
  5. if (openTrace) {
  6. try {
  7. tracer.checkState();
  8. } catch (Exception e) {
  9. if (LOGGER.isWarnEnabled()) {
  10. LOGGER.warn(e.getMessage(), e);
  11. }
  12. }
  13. }
  14. }

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

  1. @Override
  2. public void destroy() {
  3. // 销毁前备份一下
  4. // LocalRegistryHelper.backup(regFile, memoryCache);
  5. try {
  6. if (scheduledExecutorService != null) {
  7. scheduledExecutorService.shutdown();
  8. scheduledExecutorService = null;
  9. }
  10. } catch (Throwable t) {
  11. if (LOGGER.isWarnEnabled()) {
  12. LOGGER.warn(t.getMessage(), t);
  13. }
  14. }
  15. }

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

  1. /**
  2. * 检查状态,在结束调用的时候进行调用,防止资源泄露
  3. */
  4. public static void checkState() {
  5. if (openTrace) {
  6. try {
  7. tracer.checkState();
  8. } catch (Exception e) {
  9. if (LOGGER.isWarnEnabled()) {
  10. LOGGER.warn(e.getMessage(), e);
  11. }
  12. }
  13. }
  14. }

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

  1. @Override
  2. public void run() {
  3. try {
  4. ClientTransportFactory.releaseTransport(transport, 0);
  5. } catch (Exception e) {
  6. if (LOGGER.isWarnEnabled(consumerConfig.getAppName())) {
  7. LOGGER.warnWithApp(consumerConfig.getAppName(),
  8. "catch exception but ignore it when close alive client : {}", providerInfo);
  9. }
  10. } finally {
  11. latch.countDown();
  12. }
  13. }
  14. });

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

  1. @Override
  2. public void run() {
  3. try {
  4. ClientTransportFactory.releaseTransport(transport, 0);
  5. } catch (Exception e) {
  6. if (LOGGER.isWarnEnabled(consumerConfig.getAppName())) {
  7. LOGGER.warnWithApp(consumerConfig.getAppName(),
  8. "catch exception but ignore it when close alive client : {}", providerInfo);
  9. }
  10. } finally {
  11. latch.countDown();
  12. }
  13. }
  14. });

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

  1. @Override
  2. public SofaResponse invoke() {
  3. if (isCircuitBreakerOpen() && LOGGER.isWarnEnabled(invoker.getConfig().getAppName())) {
  4. LOGGER.warnWithApp(invoker.getConfig().getAppName(), "Circuit Breaker is opened, method: {}#{}",
  5. invoker.getConfig().getInterfaceId(), request.getMethodName());
  6. }
  7. return execute();
  8. }

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

  1. @Override
  2. public SofaResponse invoke() {
  3. if (isCircuitBreakerOpen() && LOGGER.isWarnEnabled(invoker.getConfig().getAppName())) {
  4. LOGGER.warnWithApp(invoker.getConfig().getAppName(), "Circuit Breaker is opened, method: {}#{}",
  5. invoker.getConfig().getInterfaceId(), request.getMethodName());
  6. }
  7. return execute();
  8. }

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

  1. @Override
  2. public SofaResponse invoke() {
  3. if (isCircuitBreakerOpen() && LOGGER.isWarnEnabled(invoker.getConfig().getAppName())) {
  4. LOGGER.warnWithApp(invoker.getConfig().getAppName(), "Circuit Breaker is opened, method: {}#{}",
  5. invoker.getConfig().getInterfaceId(), request.getMethodName());
  6. }
  7. Future delegate = this.toObservable().toBlocking().toFuture();
  8. RpcInternalContext.getContext().setFuture(new HystrixResponseFuture(delegate, this.responseFuture));
  9. if (this.sofaResponse == null && this.responseFuture == null) {
  10. // 没有执行 construct,熔断或是线程池拒绝
  11. return new SofaResponse();
  12. }
  13. return this.sofaResponse;
  14. }
  15. }

相关文章