zoukankan      html  css  js  c++  java
  • jvm相关学习

    jvm相关学习

    1、类加载是一件什么事情,做了什么

    2、类加载执行的顺序

    3、类加载器

    ClassLoader classLoader = DateUtilTest.class.getClassLoader();
    System.out.println(classLoader);
    System.out.println(classLoader.getParent());
    System.out.println(classLoader.getParent().getParent());
    System.out.println(classLoader.getParent().getParent().getParent());
    

      

    获取了两个classLoader:

    appClassLoader

    extClassLoader

    4、双亲委派机制

    protected Class<?> loadClass(String name, boolean resolve)
            throws ClassNotFoundException
        {
            synchronized (getClassLoadingLock(name)) {
                // First, check if the class has already been loaded
                Class<?> c = findLoadedClass(name);
                if (c == null) {
                    long t0 = System.nanoTime();
                    try {
                        if (parent != null) {
                            c = parent.loadClass(name, false);
                        } else {
                            c = findBootstrapClassOrNull(name);
                        }
                    } catch (ClassNotFoundException e) {
                        // ClassNotFoundException thrown if class not found
                        // from the non-null parent class loader
                    }
    
                    if (c == null) {
                        // If still not found, then invoke findClass in order
                        // to find the class.
                        long t1 = System.nanoTime();
                        c = findClass(name);
    
                        // this is the defining class loader; record the stats
                        sun.misc.PerfCounter.getParentDelegationTime().addTime(t1 - t0);
                        sun.misc.PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
                        sun.misc.PerfCounter.getFindClasses().increment();
                    }
                }
                if (resolve) {
                    resolveClass(c);
                }
                return c;
            }
        }
    
  • 相关阅读:
    搭建Nginx反向代理做内网域名转发
    网站监测脚本
    Nginx启动脚本
    L2TP用户添加和删除、搜索脚本
    CentOS Linux 安装IPSec+L2TP
    Nginx认证
    Nginx配置HTTPS
    Nginx 如何处理一个请求
    HTTP协议原理
    DNS解析流程
  • 原文地址:https://www.cnblogs.com/zhangchiblog/p/11852830.html
Copyright © 2011-2022 走看看