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

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

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

Logger.debug介绍

[英]Debug.
[中]调试。

代码示例

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

public SofaResteasyClientBuilder logProviders() {
    if (LOGGER.isDebugEnabled()) {
      Set pcs = getProviderFactory().getProviderClasses();
      StringBuilder sb = new StringBuilder();
      sb.append("\ndefault-providers:\n");

      for (Object provider : pcs) {
        sb.append("  ").append(provider).append("\n");
      }
      LOGGER.debug(sb.toString());
    }
    return this;
  }
}

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

public SofaResteasyClientBuilder logProviders() {
    if (LOGGER.isDebugEnabled()) {
      Set pcs = getProviderFactory().getProviderClasses();
      StringBuilder sb = new StringBuilder();
      sb.append("\ndefault-providers:\n");

      for (Object provider : pcs) {
        sb.append("  ").append(provider).append("\n");
      }
      LOGGER.debug(sb.toString());
    }
    return this;
  }
}

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

/**
 * 反注册一个订阅者
 *
 * @param eventClass 事件类型
 * @param subscriber 订阅者
 */
public static void unRegister(Class<? extends Event> eventClass, Subscriber subscriber) {
  CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  if (set != null) {
    set.remove(subscriber);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("UnRegister subscriber: {} of event: {}.", subscriber, eventClass);
    }
  }
}

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

/**
 * 注册一个订阅者
 *
 * @param eventClass 事件类型
 * @param subscriber 订阅者
 */
public static void register(Class<? extends Event> eventClass, Subscriber subscriber) {
  CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  if (set == null) {
    set = new CopyOnWriteArraySet<Subscriber>();
    CopyOnWriteArraySet<Subscriber> old = SUBSCRIBER_MAP.putIfAbsent(eventClass, set);
    if (old != null) {
      set = old;
    }
  }
  set.add(subscriber);
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Register subscriber: {} of event: {}.", subscriber, eventClass);
  }
}

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

/**
 * 注册一个订阅者
 *
 * @param eventClass 事件类型
 * @param subscriber 订阅者
 */
public static void register(Class<? extends Event> eventClass, Subscriber subscriber) {
  CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  if (set == null) {
    set = new CopyOnWriteArraySet<Subscriber>();
    CopyOnWriteArraySet<Subscriber> old = SUBSCRIBER_MAP.putIfAbsent(eventClass, set);
    if (old != null) {
      set = old;
    }
  }
  set.add(subscriber);
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Register subscriber: {} of event: {}.", subscriber, eventClass);
  }
}

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

/**
 * 反注册一个订阅者
 *
 * @param eventClass 事件类型
 * @param subscriber 订阅者
 */
public static void unRegister(Class<? extends Event> eventClass, Subscriber subscriber) {
  CopyOnWriteArraySet<Subscriber> set = SUBSCRIBER_MAP.get(eventClass);
  if (set != null) {
    set.remove(subscriber);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("UnRegister subscriber: {} of event: {}.", subscriber, eventClass);
    }
  }
}

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

/**
 * 关闭客户端IO线程池
 */
public synchronized static void closeClientIOEventGroup() {
  if (clientIOEventLoopGroup != null) {
    AtomicInteger ref = refCounter.get(clientIOEventLoopGroup);
    if (ref.decrementAndGet() <= 0) {
      if (!clientIOEventLoopGroup.isShutdown() && !clientIOEventLoopGroup.isShuttingDown()) {
        clientIOEventLoopGroup.shutdownGracefully();
      }
      refCounter.remove(clientIOEventLoopGroup);
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Closing Client EventLoopGroup, ref : 0");
      }
    } else {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Client EventLoopGroup still has ref : {}", ref.get());
      }
    }
  }
  clientIOEventLoopGroup = null;
}

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

/**
 * 关闭客户端IO线程池
 */
public synchronized static void closeClientIOEventGroup() {
  if (clientIOEventLoopGroup != null) {
    AtomicInteger ref = refCounter.get(clientIOEventLoopGroup);
    if (ref.decrementAndGet() <= 0) {
      if (!clientIOEventLoopGroup.isShutdown() && !clientIOEventLoopGroup.isShuttingDown()) {
        clientIOEventLoopGroup.shutdownGracefully();
      }
      refCounter.remove(clientIOEventLoopGroup);
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Closing Client EventLoopGroup, ref : 0");
      }
    } else {
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Client EventLoopGroup still has ref : {}", ref.get());
      }
    }
  }
  clientIOEventLoopGroup = null;
}

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

@Override
  public void onLoad(ExtensionClass<TelnetHandler> extensionClass) {
    // 自己维护支持列表,不托管给ExtensionLoaderFactory
    TelnetHandler handler = extensionClass.getExtInstance();
    supportedCmds.put(handler.getCommand(), handler);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Add telnet handler {}:{}.", handler.getCommand(), handler);
    }
  }
});

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

@Override
  public void onLoad(ExtensionClass<TelnetHandler> extensionClass) {
    // 自己维护支持列表,不托管给ExtensionLoaderFactory
    TelnetHandler handler = extensionClass.getExtInstance();
    supportedCmds.put(handler.getCommand(), handler);
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Add telnet handler {}:{}.", handler.getCommand(), handler);
    }
  }
});

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

@Override
  public void onLoad(ExtensionClass<Filter> extensionClass) {
    Class<? extends Filter> implClass = extensionClass.getClazz();
    // 读取自动加载的类列表。
    AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
    if (autoActive != null) {
      String alias = extensionClass.getAlias();
      if (autoActive.providerSide()) {
        PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (autoActive.consumerSide()) {
        CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Extension of interface " + Filter.class
          + ", " + implClass + "(" + alias + ") will auto active");
      }
    }
  }
});

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

@Override
  public void onLoad(ExtensionClass<Router> extensionClass) {
    Class<? extends Router> implClass = extensionClass.getClazz();
    // 读取自动加载的类列表。
    AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
    if (autoActive != null) {
      String alias = extensionClass.getAlias();
      if (autoActive.providerSide()) {
        PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (autoActive.consumerSide()) {
        CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Extension of interface " + Router.class + ", " + implClass + "(" + alias +
          ") will auto active");
      }
    }
  }
});

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

@Override
  public void onLoad(ExtensionClass<Router> extensionClass) {
    Class<? extends Router> implClass = extensionClass.getClazz();
    // 读取自动加载的类列表。
    AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
    if (autoActive != null) {
      String alias = extensionClass.getAlias();
      if (autoActive.providerSide()) {
        PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (autoActive.consumerSide()) {
        CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Extension of interface " + Router.class + ", " + implClass + "(" + alias +
          ") will auto active");
      }
    }
  }
});

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

@Override
  public void onLoad(ExtensionClass<Filter> extensionClass) {
    Class<? extends Filter> implClass = extensionClass.getClazz();
    // 读取自动加载的类列表。
    AutoActive autoActive = implClass.getAnnotation(AutoActive.class);
    if (autoActive != null) {
      String alias = extensionClass.getAlias();
      if (autoActive.providerSide()) {
        PROVIDER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (autoActive.consumerSide()) {
        CONSUMER_AUTO_ACTIVES.put(alias, extensionClass);
      }
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Extension of interface " + Filter.class
          + ", " + implClass + "(" + alias + ") will auto active");
      }
    }
  }
});

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

/**
 * @param path path必须以/结尾
 */
protected synchronized void loadFromFile(String path) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Loading extension of extensible {} from path: {}", interfaceName, path);
  }
  // 默认如果不指定文件名字,就是接口名
  String file = StringUtils.isBlank(extensible.file()) ? interfaceName : extensible.file().trim();
  String fullFileName = path + file;
  try {
    ClassLoader classLoader = ClassLoaderUtils.getClassLoader(getClass());
    loadFromClassLoader(classLoader, fullFileName);
  } catch (Throwable t) {
    if (LOGGER.isErrorEnabled()) {
      LOGGER.error("Failed to load extension of extensible " + interfaceName + " from path:" + fullFileName,
        t);
    }
  }
}

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

/**
 * @param path path必须以/结尾
 */
protected synchronized void loadFromFile(String path) {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Loading extension of extensible {} from path: {}", interfaceName, path);
  }
  // 默认如果不指定文件名字,就是接口名
  String file = StringUtils.isBlank(extensible.file()) ? interfaceName : extensible.file().trim();
  String fullFileName = path + file;
  try {
    ClassLoader classLoader = ClassLoaderUtils.getClassLoader(getClass());
    loadFromClassLoader(classLoader, fullFileName);
  } catch (Throwable t) {
    if (LOGGER.isErrorEnabled()) {
      LOGGER.error("Failed to load extension of extensible " + interfaceName + " from path:" + fullFileName,
        t);
    }
  }
}

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

@Override
  public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
    if (LOGGER.isDebugEnabled(config.getAppName())) {
      LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
    }
    switch (event.getType()) {
      case CHILD_ADDED: //新增接口级配置
        configObserver.addConfig(config, configPath, event.getData());
        break;
      case CHILD_REMOVED: //删除接口级配置
        configObserver.removeConfig(config, configPath, event.getData());
        break;
      case CHILD_UPDATED:// 更新接口级配置
        configObserver.updateConfig(config, configPath, event.getData());
        break;
      default:
        break;
    }
  }
});

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

@Override
  public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
    if (LOGGER.isDebugEnabled(config.getAppName())) {
      LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
    }
    switch (event.getType()) {
      case CHILD_ADDED: //新增IP级配置
        overrideObserver.addConfig(config, overridePath, event.getData());
        break;
      case CHILD_REMOVED: //删除IP级配置
        overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig);
        break;
      case CHILD_UPDATED:// 更新IP级配置
        overrideObserver.updateConfig(config, overridePath, event.getData());
        break;
      default:
        break;
    }
  }
});

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

@Override
  public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
    if (LOGGER.isDebugEnabled(config.getAppName())) {
      LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
    }
    switch (event.getType()) {
      case CHILD_ADDED: //新增IP级配置
        overrideObserver.addConfig(config, overridePath, event.getData());
        break;
      case CHILD_REMOVED: //删除IP级配置
        overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig);
        break;
      case CHILD_UPDATED:// 更新IP级配置
        overrideObserver.updateConfig(config, overridePath, event.getData());
        break;
      default:
        break;
    }
  }
});

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

@Override
  public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception {
    if (LOGGER.isDebugEnabled(config.getAppName())) {
      LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]");
    }
    switch (event.getType()) {
      case CHILD_ADDED: //新增接口级配置
        configObserver.addConfig(config, configPath, event.getData());
        break;
      case CHILD_REMOVED: //删除接口级配置
        configObserver.removeConfig(config, configPath, event.getData());
        break;
      case CHILD_UPDATED:// 更新接口级配置
        configObserver.updateConfig(config, configPath, event.getData());
        break;
      default:
        break;
    }
  }
});

相关文章