ch.qos.logback.core.util.Loader.getTCL()方法的使用及代码示例

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

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

Loader.getTCL介绍

[英]Get the Thread Context Loader which is a JDK 1.2 feature. If we are running under JDK 1.1 or anything else goes wrong the method returns null.
[中]获取线程上下文加载器,它是JDK1.2的一个特性。如果我们在JDK1.1下运行,或者其他任何地方出错,那么该方法将返回null

代码示例

代码示例来源:origin: ch.qos.logback/logback-classic

private URL urlByResourceName(StatusManager sm, String resourceName) {
  sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
  URL url = Loader.getResource(resourceName, Loader.getTCL());
  if (url != null) {
    return url;
  }
  return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  */
 public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

private URL urlByResourceName(StatusManager sm, String resourceName) {
 sm.add(new InfoStatus("Searching for [" + resourceName + "]",
     this));
 URL url = Loader.getResource(resourceName, Loader.getTCL());
 if (url != null) {
  return url;
 }
 return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: qos-ch/logback-audit

public static void autoConfig(Auditor auditor) throws AuditException {
 ClassLoader tccl = Loader.getTCL();
 autoConfig(auditor, tccl);
}

代码示例来源:origin: ch.qos.logback/core

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  */
 public static Class loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
   * If running under JDK 1.2 load the specified class using the
   * <code>Thread</code> <code>contextClassLoader</code> if that fails try
   * Class.forname. Under JDK 1.1 only Class.forName is used.
   */
  public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
    // Just call Class.forName(clazz) if we are running under JDK 1.1
    // or if we are instructed to ignore the TCL.
    if (ignoreTCL) {
      return Class.forName(clazz);
    } else {
      try {
        return getTCL().loadClass(clazz);
      } catch (Throwable e) {
        // we reached here because tcl was null or because of a
        // security exception, or because clazz could not be loaded...
        // In any case we now try one more time
        return Class.forName(clazz);
      }
    }
  }
}

代码示例来源:origin: Nextdoor/bender

/**
   * If running under JDK 1.2 load the specified class using the
   * <code>Thread</code> <code>contextClassLoader</code> if that fails try
   * Class.forname. Under JDK 1.1 only Class.forName is used.
   */
  public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
    // Just call Class.forName(clazz) if we are running under JDK 1.1
    // or if we are instructed to ignore the TCL.
    if (ignoreTCL) {
      return Class.forName(clazz);
    } else {
      try {
        return getTCL().loadClass(clazz);
      } catch (Throwable e) {
        // we reached here because tcl was null or because of a
        // security exception, or because clazz could not be loaded...
        // In any case we now try one more time
        return Class.forName(clazz);
      }
    }
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  */
 public static Class loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: com.hynnet/logback-core

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  */
 public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
   * If running under JDK 1.2 load the specified class using the
   * <code>Thread</code> <code>contextClassLoader</code> if that fails try
   * Class.forname. Under JDK 1.1 only Class.forName is used.
   */
  public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
    // Just call Class.forName(clazz) if we are running under JDK 1.1
    // or if we are instructed to ignore the TCL.
    if (ignoreTCL) {
      return Class.forName(clazz);
    } else {
      try {
        return getTCL().loadClass(clazz);
      } catch (Throwable e) {
        // we reached here because tcl was null or because of a
        // security exception, or because clazz could not be loaded...
        // In any case we now try one more time
        return Class.forName(clazz);
      }
    }
  }
}

代码示例来源:origin: tony19/logback-android

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  *
  * @param clazz the name of the class to find
  * @return the class
  */
 public static Class<?> loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
  * If running under JDK 1.2 load the specified class using the
  * <code>Thread</code> <code>contextClassLoader</code> if that fails try
  * Class.forname. Under JDK 1.1 only Class.forName is used.
  * 
  */
 public static Class loadClass(String clazz) throws ClassNotFoundException {
  // Just call Class.forName(clazz) if we are running under JDK 1.1
  // or if we are instructed to ignore the TCL.
  if (ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   } catch (Throwable e) {
    // we reached here because tcl was null or because of a
    // security exception, or because clazz could not be loaded...
    // In any case we now try one more time
    return Class.forName(clazz);
   }
  }
 }
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

private URL urlByResourceName(StatusManager sm, String resourceName) {
 sm.add(new InfoStatus("Searching for [" + resourceName + "]",
   this));
 URL url = Loader.getResource(resourceName, Loader.getTCL());
 if (url != null) {
  return url;
 }
 return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private URL urlByResourceName(StatusManager sm, String resourceName) {
  sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
  URL url = Loader.getResource(resourceName, Loader.getTCL());
  if (url != null) {
    return url;
  }
  return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: Nextdoor/bender

private URL urlByResourceName(StatusManager sm, String resourceName) {
  sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
  URL url = Loader.getResource(resourceName, Loader.getTCL());
  if (url != null) {
    return url;
  }
  return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.classic

private URL urlByResourceName(StatusManager sm, String resourceName) {
 sm.add(new InfoStatus("Searching for [" + resourceName + "]",
   this));
 URL url = Loader.getResource(resourceName, Loader.getTCL());
 if (url != null) {
  return url;
 }
 return Loader.getResourceBySelfClassLoader(resourceName);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

private URL urlByResourceName(StatusManager sm, String resourceName) {
  sm.add(new InfoStatus("Searching for [" + resourceName + "]", this));
  URL url = Loader.getResource(resourceName, Loader.getTCL());
  if (url != null) {
    return url;
  }
  return Loader.getResourceBySelfClassLoader(resourceName);
}

相关文章