org.apache.log4j.helpers.Loader.getTCL()方法的使用及代码示例

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

本文整理了Java中org.apache.log4j.helpers.Loader.getTCL()方法的一些代码示例,展示了Loader.getTCL()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.getTCL()方法的具体详情如下:
包路径:org.apache.log4j.helpers.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[[$0$]]
[中]获取线程上下文加载器,它是JDK1.2的一个特性。如果我们在JDK1.1下运行,或者出现任何其他错误,那么该方法将返回null[[$0$]]

代码示例

代码示例来源:origin: log4j/log4j

/**
  * 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.
  *
  */
 static public 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(java1 || ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   }
   // 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
   catch(InvocationTargetException e) {
     if (e.getTargetException() instanceof InterruptedException
         || e.getTargetException() instanceof InterruptedIOException) {
       Thread.currentThread().interrupt();
     }
   } catch(Throwable t) {
   }
  }
  return Class.forName(clazz);
 }
}

代码示例来源:origin: log4j/log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源: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.
  *
  */
 static public 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(java1 || 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: apache/log4j

/**
  * 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.
  *
  */
 static public 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(java1 || ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   }
   // 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
   catch(InvocationTargetException e) {
     if (e.getTargetException() instanceof InterruptedException
         || e.getTargetException() instanceof InterruptedIOException) {
       Thread.currentThread().interrupt();
     }
   } catch(Throwable t) {
   }
  }
  return Class.forName(clazz);
 }
}

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

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: apache/log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j

/**
  * 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.
  *
  */
 static public 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(java1 || 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: apache-log4j/log4j

/**
  * 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.
  *
  */
 static public 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(java1 || 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: org.apache/log4j

/**
  * 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.
  *
  */
 static public 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(java1 || 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: org.apache.activemq/activemq-all

/**
  * 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.
  *
  */
 static public 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(java1 || ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   }
   // 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
   catch(InvocationTargetException e) {
     if (e.getTargetException() instanceof InterruptedException
         || e.getTargetException() instanceof InterruptedIOException) {
       Thread.currentThread().interrupt();
     }
   } catch(Throwable t) {
   }
  }
  return Class.forName(clazz);
 }
}

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

/**
   * 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.
   */
  static public 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 (java1 || ignoreTCL) {
      return Class.forName(clazz);
    } else {
      try {
        return getTCL().loadClass(clazz);
      }
      // 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
      catch (InvocationTargetException e) {
        if (e.getTargetException() instanceof InterruptedException
            || e.getTargetException() instanceof InterruptedIOException) {
          Thread.currentThread().interrupt();
        }
      } catch (Throwable t) {
      }
    }
    return Class.forName(clazz);
  }
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

/**
  * 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.
  *
  */
 static public 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(java1 || ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   }
   // 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
   catch(InvocationTargetException e) {
     if (e.getTargetException() instanceof InterruptedException
         || e.getTargetException() instanceof InterruptedIOException) {
       Thread.currentThread().interrupt();
     }
   } catch(Throwable t) {
   }
  }
  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.
  *
  */
 static public 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(java1 || ignoreTCL) {
   return Class.forName(clazz);
  } else {
   try {
    return getTCL().loadClass(clazz);
   }
   // 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
   catch(InvocationTargetException e) {
     if (e.getTargetException() instanceof InterruptedException
         || e.getTargetException() instanceof InterruptedIOException) {
       Thread.currentThread().interrupt();
     }
   } catch(Throwable t) {
   }
  }
  return Class.forName(clazz);
 }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: apache-log4j/log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: org.apache/log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: org.apache.activemq/activemq-all

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

classLoader = getTCL();
if (classLoader != null) {
  LogLog.debug("Trying to find [" + resource + "] using context classloader "

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

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

classLoader = getTCL();
if(classLoader != null) {
 LogLog.debug("Trying to find ["+resource+"] using context classloader "

相关文章