• <legend id='16vV9'><style id='16vV9'><dir id='16vV9'><q id='16vV9'></q></dir></style></legend>
      <i id='16vV9'><tr id='16vV9'><dt id='16vV9'><q id='16vV9'><span id='16vV9'><b id='16vV9'><form id='16vV9'><ins id='16vV9'></ins><ul id='16vV9'></ul><sub id='16vV9'></sub></form><legend id='16vV9'></legend><bdo id='16vV9'><pre id='16vV9'><center id='16vV9'></center></pre></bdo></b><th id='16vV9'></th></span></q></dt></tr></i><div id='16vV9'><tfoot id='16vV9'></tfoot><dl id='16vV9'><fieldset id='16vV9'></fieldset></dl></div>
      <tfoot id='16vV9'></tfoot>

    1. <small id='16vV9'></small><noframes id='16vV9'>

      • <bdo id='16vV9'></bdo><ul id='16vV9'></ul>

      1. 线程的上下文类加载器和普通类加载器的区别

        Difference between thread#39;s context class loader and normal classloader(线程的上下文类加载器和普通类加载器的区别)

        <legend id='Kao2l'><style id='Kao2l'><dir id='Kao2l'><q id='Kao2l'></q></dir></style></legend>

          <i id='Kao2l'><tr id='Kao2l'><dt id='Kao2l'><q id='Kao2l'><span id='Kao2l'><b id='Kao2l'><form id='Kao2l'><ins id='Kao2l'></ins><ul id='Kao2l'></ul><sub id='Kao2l'></sub></form><legend id='Kao2l'></legend><bdo id='Kao2l'><pre id='Kao2l'><center id='Kao2l'></center></pre></bdo></b><th id='Kao2l'></th></span></q></dt></tr></i><div id='Kao2l'><tfoot id='Kao2l'></tfoot><dl id='Kao2l'><fieldset id='Kao2l'></fieldset></dl></div>
            <tbody id='Kao2l'></tbody>
          • <tfoot id='Kao2l'></tfoot>

          • <small id='Kao2l'></small><noframes id='Kao2l'>

            • <bdo id='Kao2l'></bdo><ul id='Kao2l'></ul>
                • 本文介绍了线程的上下文类加载器和普通类加载器的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  线程的上下文类加载器和普通的类加载器有什么区别?

                  What is the difference between a thread's context class loader and a normal class loader?

                  即如果Thread.currentThread().getContextClassLoader()getClass().getClassLoader()返回不同的类加载器对象,会使用哪一个呢?

                  That is, if Thread.currentThread().getContextClassLoader() and getClass().getClassLoader() return different class loader objects, which one will be used?

                  推荐答案

                  每个类都会使用自己的类加载器来加载其他类.所以如果 ClassA.class 引用 ClassB.class 那么 ClassB 需要在 ClassA 的类加载器的类路径上,或其父母.

                  Each class will use its own classloader to load other classes. So if ClassA.class references ClassB.class then ClassB needs to be on the classpath of the classloader of ClassA, or its parents.

                  线程上下文类加载器是当前线程的当前类加载器.可以从 ClassLoaderC 中的类创建对象,然后将其传递给 ClassLoaderD 拥有的线程.在这种情况下,对象需要直接使用 Thread.currentThread().getContextClassLoader() 如果它想要加载在它自己的类加载器上不可用的资源.

                  The thread context classloader is the current classloader for the current thread. An object can be created from a class in ClassLoaderC and then passed to a thread owned by ClassLoaderD. In this case the object needs to use Thread.currentThread().getContextClassLoader() directly if it wants to load resources that are not available on its own classloader.

                  这篇关于线程的上下文类加载器和普通类加载器的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                  ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                  How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                  Why a sawtooth shaped graph?(为什么是锯齿形图形?)

                    <tbody id='Jgtxy'></tbody>
                  <legend id='Jgtxy'><style id='Jgtxy'><dir id='Jgtxy'><q id='Jgtxy'></q></dir></style></legend>

                      • <bdo id='Jgtxy'></bdo><ul id='Jgtxy'></ul>

                          <i id='Jgtxy'><tr id='Jgtxy'><dt id='Jgtxy'><q id='Jgtxy'><span id='Jgtxy'><b id='Jgtxy'><form id='Jgtxy'><ins id='Jgtxy'></ins><ul id='Jgtxy'></ul><sub id='Jgtxy'></sub></form><legend id='Jgtxy'></legend><bdo id='Jgtxy'><pre id='Jgtxy'><center id='Jgtxy'></center></pre></bdo></b><th id='Jgtxy'></th></span></q></dt></tr></i><div id='Jgtxy'><tfoot id='Jgtxy'></tfoot><dl id='Jgtxy'><fieldset id='Jgtxy'></fieldset></dl></div>

                          <small id='Jgtxy'></small><noframes id='Jgtxy'>

                          <tfoot id='Jgtxy'></tfoot>