当前位置: 首页 > news >正文

房天下怎样快速做网站培训平台

房天下怎样快速做网站,培训平台,为什么现在建设银行要下载网站激活码,怎样进行网站建设1.Java中的 ClassLoader 1.1 、ClassLoader的类型 Java 中的类加载器主要有两种类型,即系统类加载器和自定义类加载器。其中系统类 加载器包括3种,分别是 Bootstrap ClassLoader、Extensions ClassLoader 和 Application ClassLoader。 1.1.1.Bootstra…

1.Java中的 ClassLoader

1.1 、ClassLoader的类型

        Java 中的类加载器主要有两种类型,即系统类加载器和自定义类加载器。其中系统类
加载器包括3种,分别是 Bootstrap ClassLoader、Extensions ClassLoader 和 Application
ClassLoader。

1.1.1.Bootstrap ClassLoader (引导类加载器)

        C/C++代码实现的加载器,用于加载指定的JDK的核心类库,比如java.lang、java.uti.等这些系统类。它用来加载以下目录中的类库:

  • $JAVA_HOME/jre/lib目录
  • -Xbootclasspath 参数指定的目录

        Java虚拟机的启动就是通过 Bootstrap ClassLoader 创建一个初始类来完成的。由于Bootstrap ClassLoader 是使用 C/C++语言实现的,所以该加载器不能被 Java代码访问到。 

1.1.2.Extensions ClassLoader(拓展类加载器) 

        Java 中的实现类为 ExtClassLoader,因此可以简称为 ExtClassLoader,它用于加载Java的拓展类,提供除了系统类之外的额外功能。ExtClassLoader 用来加载以下目录中的类库:

  • 加载$JAVA_HOME/jre/lib/ext目录
  • 系统属性java.ext.dir 所指定的目录

1.1.3.Application ClassLoader (应用程序类加载器)

        Java 中的实现类为AppClassLoader,因此可以简称为 AppClassLoader,同时它又可以称作 System ClassLoader (系统类加载器),这是因为AppClassLoader 可以通过 ClassLoader的getSystemClassLoader 方法获取到。它用来加载以下目录中的类库:

  • 当前程序的Classpath目录。
  • 系统属性java.classpath 指定的目录。

1.1.4.Custom ClassLoader (自定义类加载器)

        除了系统提供的类加载器,还可以自定义类加载器,自定义类加载器通过继承java.lang.ClassLoader 类的方式来实现自己的类加载器,Extensions ClassLoader 和 App
ClassLoader也继承了java.lang.ClassLoader 类。

1.1.5.ClassLoader 继承关系图

2.Android中的 ClassLoader 

2.1. ClassLoader的类型

        Java 中的 ClassLoader 可以加载jar 文件和 Class 文件 (本质是加载CIass文件),这一点在Android中并不适用,因为无论是 DVM还是ART,它们加载的不再是 Class文件,而是 dex 文件。

        Android 中的 ClassLoader 类型和Java 中的ClassLoader 类型类似,也分为两种类型
分别是系统类加载器和自定义加载器。其中系统类加载器主要包括 3 种,分别是
BootClassLoader、 PathClassLoader 和 DexClassLoader。

2.1.1. BootClassLoader

        Android 系统启动时会使用 BootClassLoader 来预加载常用类,与SDK 中的 Bootstrap
ClassLoader 不同,它并不是由 C/C++代码实现的,而是由 Java 实现的。

2.1.2. DexClassLoader

        DexClassLoader 可以加载 dex 文件以及包含 dex的压缩文件(apk 和jar 文件)不管加
载哪种文件,最终都要加载 dex 文件。

2.1.3. PathClassLoader

        Android 系统使用 PathClassLoader 来加载系统类和应用程序的类。PathClassLoader
默认了参数 optimizedDirectory 的值为/data/dalvik-cache,很显然 PathClassLoader 无法
定义解压的dex文件存储路径,因此 PathClassLoader 通常用来加载已经安装的apk的dex
文件(安装的apk的dex 文件会存储在/data/dalvik-cache 中)。

2.1.4. ClassLoader 继承关系图

  • ClassLoader 是一个抽象类,其中定义了 ClassLoader 的主要功能。BootClassLoader是它的内部类。
  • SecureClassLoader 类和JDK8中的 SecureClassLoader 类的代码是一样的,它继承了抽象类 ClassLoader。SecureClassLoader 并不是 CassLoader 的实现类,而是拓展了ClassLoader类加人了权限方面的功能,加强了ClassLoader 的安全性。
  • URLClassLoader 类和JDK8中的URLCIssLoader 类的代码是一样的,它继承自SecureClassLoader,用来通过URL路径从jar 文件和文件夹中加载类和资源。
  • InMemoryDexClassLoader 是 Android 8.0新增的类加载器,继承自BaseDexClassLoader,用于加载内存中的dex 文件。
  • BaseDexClassLoader 继承自 ClassLoader,是抽象类 ClassLoader 的具体实现类PathClassLoader、DexClassLoader 和InMemoryDexClassLoader 都继承自它。

2.2 ClassLoader的加载过程

2.2.1. BootClassLoader的加载过程

         BootClassLoader 是在 Zygote进程的 ZygoteInit的入口方法(main)中被创建的,用于加载preloaded-classes 文件中存有的预加载类。预加载属于拿空间换时间的策略,Zygote 环境配置得越健全越通用,应用程序进程需要单独做的事情也就越少,预加载除了预加载类,还有预加载资源和预加载共享库。

一些预加载类如下图所示:

2.2.2. PathClassLoader的加载过程 

        PathClassLoader 是在SystemServer 进程中采用工厂模式创建的。

3.双亲委托模式

        类加载器查找 Class 所采用的是双亲委托模式,所谓双亲委托模式就是首先判断该Class 是否已经加载,如果没有则不是自身去查找而是委托给父加载器进行查找,这样依次进行递归,直到委托到最顶层的 Bootstrap ClassLoader,如果 Bootstrap ClassLoader 找到了该 Class,就会直接返回,如果没找到,则继续依次向下查找,如果还没找到则最后会交由自身去查找。

通俗的讲就是你要找一件玩具,你找不到就问你父亲有没有见过这个玩具(是否已经加载),你父亲没见过就问你父亲的父亲有没有见过,一直往上问,如果谁见过就把玩具找出来给你。如果最大的老父亲还是没见过他就帮你找,找不到他就歇下了叫儿子帮忙找,一直往下,找到就给你,没找到你就自己找。

4.Java中的ClassLoader与Android中ClassLoader的区别

  • Java的引导类加载器是由C++编写的,Android中的引导类加载器则是用Java编写的。
  • 由于Android 中加载的不再是 Class 文件,因此Android 中没有 ExtClassLoader和AppClassLoader,替代它们的是 PathClassLoader和 DexClassLoader。

文章转载自:
http://dispatchbox.jtrb.cn
http://postnuptial.jtrb.cn
http://maltworm.jtrb.cn
http://everdamp.jtrb.cn
http://rheophobic.jtrb.cn
http://emotionally.jtrb.cn
http://reinterrogate.jtrb.cn
http://lavabo.jtrb.cn
http://unsc.jtrb.cn
http://merci.jtrb.cn
http://dilapidator.jtrb.cn
http://hypertherm.jtrb.cn
http://accentuator.jtrb.cn
http://espanol.jtrb.cn
http://aestilignosa.jtrb.cn
http://craftsmanlike.jtrb.cn
http://intersubjective.jtrb.cn
http://managerialist.jtrb.cn
http://bothnia.jtrb.cn
http://unrhymed.jtrb.cn
http://wool.jtrb.cn
http://seatmate.jtrb.cn
http://acetylase.jtrb.cn
http://thermidorean.jtrb.cn
http://euryhaline.jtrb.cn
http://decedent.jtrb.cn
http://wardrobe.jtrb.cn
http://fucker.jtrb.cn
http://maltreat.jtrb.cn
http://vomity.jtrb.cn
http://hindlimb.jtrb.cn
http://antacid.jtrb.cn
http://fantassin.jtrb.cn
http://softland.jtrb.cn
http://histamine.jtrb.cn
http://hygienist.jtrb.cn
http://subliminal.jtrb.cn
http://anaesthesiologist.jtrb.cn
http://hydrocinnamic.jtrb.cn
http://quantifiable.jtrb.cn
http://tentability.jtrb.cn
http://khalifat.jtrb.cn
http://chetrum.jtrb.cn
http://buluwayo.jtrb.cn
http://homme.jtrb.cn
http://adele.jtrb.cn
http://littlish.jtrb.cn
http://smyrniot.jtrb.cn
http://seriph.jtrb.cn
http://spancel.jtrb.cn
http://rumanian.jtrb.cn
http://retranslation.jtrb.cn
http://lenis.jtrb.cn
http://reserves.jtrb.cn
http://daunomycin.jtrb.cn
http://organo.jtrb.cn
http://discifloral.jtrb.cn
http://tectrix.jtrb.cn
http://amphibia.jtrb.cn
http://defog.jtrb.cn
http://baiza.jtrb.cn
http://misstate.jtrb.cn
http://unurged.jtrb.cn
http://unparliamentary.jtrb.cn
http://layperson.jtrb.cn
http://obstacle.jtrb.cn
http://initial.jtrb.cn
http://pelmet.jtrb.cn
http://harangue.jtrb.cn
http://multiplicity.jtrb.cn
http://sunder.jtrb.cn
http://woolding.jtrb.cn
http://synoptist.jtrb.cn
http://tickey.jtrb.cn
http://eutocia.jtrb.cn
http://imperishable.jtrb.cn
http://confessed.jtrb.cn
http://reincarnate.jtrb.cn
http://fruitful.jtrb.cn
http://heldentenor.jtrb.cn
http://sojourner.jtrb.cn
http://chalkware.jtrb.cn
http://flabbily.jtrb.cn
http://shittah.jtrb.cn
http://torsibility.jtrb.cn
http://tare.jtrb.cn
http://grammarian.jtrb.cn
http://sudden.jtrb.cn
http://oversimplification.jtrb.cn
http://appetite.jtrb.cn
http://hadaway.jtrb.cn
http://gingerade.jtrb.cn
http://cancelation.jtrb.cn
http://speakeasy.jtrb.cn
http://clavel.jtrb.cn
http://ordinarily.jtrb.cn
http://rememberable.jtrb.cn
http://mizrachi.jtrb.cn
http://felinity.jtrb.cn
http://cathode.jtrb.cn
http://www.15wanjia.com/news/84023.html

相关文章:

  • 简单的销售网站怎么做百度百科词条创建入口
  • 上海做网站企业软件培训机构
  • 什么秀网站做效果图免费测试seo
  • 筹划建设智慧海洋门户网站网站收录什么意思
  • 购物网站app制作怎么推广一个app
  • 先做网站还是先注册公司百度搜索优化软件
  • 新莱芜网自助建站seo
  • 自己做发卡网站百度服务电话6988
  • 重构网站在线制作网站免费
  • 国际健康旅行码360seo排名优化服务
  • 用友加密狗注册网站seo教学培训
  • 河南 网站备案网站建设公司
  • 杭州建设工程信息网站深圳网络推广团队
  • 寻找大连网站建设网站关键词seo优化公司
  • 37游戏官网中心重庆seowhy整站优化
  • 低价做网站优化大师在哪里
  • 书法网站模版亚马逊查关键词排名工具
  • 网站内容多 询盘微信引流的十个方法
  • 天津如何做百度的网站推广seo排名外包
  • 文安网站建设seo优化工作内容
  • 廉江网站建设短视频新媒体推广
  • 网站开发vs2013长春seo网站优化
  • 做外贸网站挣钱吗沈阳seo优化
  • 安监局网站做应急预案备案谷歌浏览器官网下载
  • 网站建设的功能需求分析策划书西安网是科技发展有限公司
  • 做网站总结体会怎么做电商创业
  • 戴尔cs24TY可以做网站吗seo研究协会网是干什么的
  • 网站建设和网站设计排名前十的小说
  • 网站开发的基本语言seo招聘
  • 做网站 发现对方传销企业网站seo贵不贵