4장. Class Loader
Upcoming SlideShare
Loading in...5
×
 

4장. Class Loader

on

  • 8,360 views

Java Performance Fundamental 세미나 교재입니다. 4장은 Class Loader를 다루고 있습니다. Class Loader란 무엇이고 Class가 어떻게 JVM안으로 들어와 메모리의 일부로 ...

Java Performance Fundamental 세미나 교재입니다. 4장은 Class Loader를 다루고 있습니다. Class Loader란 무엇이고 Class가 어떻게 JVM안으로 들어와 메모리의 일부로 동작하는지에 대해 상세하게 설명하고 있습니다. 그리고 Java 5에서 새로 소개된 Class Sharing에 대해서도 다루고 있습니다.

* Class Loader
o Namespace
o Class Loader Delegation Model
o Class Sharing
* Class Loader Work
o Loading
o Linking
o Initialization

Statistics

Views

Total Views
8,360
Views on SlideShare
3,518
Embed Views
4,842

Actions

Likes
2
Downloads
103
Comments
0

12 Embeds 4,842

http://performeister.tistory.com 2136
http://novathin.kr 1876
http://creator1022.tistory.com 705
http://blog.kwfarm.kr 78
http://kwfarm.tistory.com 14
http://translate.googleusercontent.com 9
http://wiki.nhncorp.com 9
http://wikin.nhncorp.com 8
http://www.slideshare.net 2
http://webcache.googleusercontent.com 2
http://www.novathin.kr 2
http://www.health.medicbd.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

4장. Class Loader 4장. Class Loader Presentation Transcript

  • Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Class Loader
  • Java Performance 2 artdb@ex-em.com | performeister.tistory.com | twitter @novathinker ClassLoader 1) Dynamic Linking 2) Namespace 3) Delegation Model 4) Classloader Tree in WAS ClassLoader Work 1) ClassLoader Work 2) Loading 3) Linking (1) Verification (2) Preparation (3) Resolution 4) Initialization
  • Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Class Loader
  • Java Performance 4 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Dynamic Linking – Runtime Class – Class Load Link – Link Classloader – JVM • Bootstrap Classloader • Java Runtime Library (rt.jar) • Object class
  • Java Performance 5 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Dynamic Linking – Loadtime dynamic loading • class public class Hello { public static void main(String[] args) { System.out.println(“Hello EXEM”); } } • Java.lang.String, java.lang.System Hello class loading loading
  • Java Performance 6 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Dynamic Linking – Runtime dynamic loading (reflection) • Code public class Hello { public static void main(String[] args) { Class cl = Class.forName(args[0]); } } • Class.forName(args[0]) args[0] Class
  • Java Performance 7 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – JVM Class Loading – Class ? 1. Full Qualified Name . Full Qualified Name = package name + class name 2. Classloader .
  • Java Performance 8 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Class Loader Namespace Classloader Classloader 1 2 Namespace Namespace exem.package.jvmclass exem.package.jvmclass exem.package.jvmclass
  • Java Performance 8 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Class Loader Namespace Classloader Classloader 1 2 Namespace Namespace exem.package.jvmclass exem.package.jvmclass exem.package.jvmclass
  • Java Performance 8 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Class Loader Namespace Classloader Classloader 1 2 Namespace Namespace exem.package.jvmclass exem.package.jvmclass exem.package.jvmclass
  • Java Performance 9 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Symbolic Reference – Class Load classloader class loading Class exemHello { Class cl = Class.forName(exem.package.jvmclass); } Classloader Classloader 1 2 Namespace exemHello exem.package.jvmclass
  • Java Performance 9 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Symbolic Reference – Class Load classloader class loading Class exemHello { Class cl = Class.forName(exem.package.jvmclass); } Classloader Classloader 1 2 Namespace exemHello exem.package.jvmclass
  • Java Performance 9 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com ClassLoader • Namespace – Symbolic Reference – Class Load classloader class loading Class exemHello { Class cl = Class.forName(exem.package.jvmclass); } Classloader Classloader 1 2 Namespace exemHello exem.package.jvmclass
  • Java Performance 10 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Delegation Model – Classloder
  • Java Performance 11 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Delegation Model – Classloader • Bootstrap classloader : classloader (no Parent) : native implementation : $JAVA_HOME/jre/lib/rt.jar • Extension classloader : class : $JAVA_HOME/jre/lib/ext jar file • System classloader : Application classloader : $CLASSPATH, java.class.path
  • Java Performance 12 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Delegation Model – Delegation Model • classloader bootstrap parent • Class CacheParentSelf • Class loading (delegation) • classloader default system classloader • Parent system classloader child •
  • Java Performance 13 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Delegation Model – Class Loading • Classloader loadClass() (1) Class (2) Load parent (3) Parent findClass() call • Classloader findClass() – Current Classloader Class • Delegation Class – bootstrapextensionsystemuser-defined – Class bootstap extension class path
  • Java Performance 14 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Delegation Model – Class Loading • Classloader loadClass() (1) Class (2) Load parent (3) Parent findClass() call • Classloader findClass() – Current Classloader Class • Delegation Class – bootstrapextensionsystemuser-defined – Class bootstap extension class path
  • Java Performance 15 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Classloader Tree in WAS – EJB, WAR deploy classloader • Isolating the Application from other Applications • Sharing Class between deployed modules • Implementing multiple classloaders
  • Java Performance 16 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Classloader Tree in WAS
  • Java Performance 17 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Classloader Tree in WAS
  • Java Performance 18 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Class Sharing – Jvm Load Class – ClassLoader CacheParentShared Class File System Shared Class Class JVM1 JVM2 JVM3 Sharing JVM1 JVM2 JVM3
  • Java Performance 19 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Class Sharing – Hotspot JVM • Shared Archive • Jar Class JVM Memory Mapped File • Shared Library • Client VM, Default Garbage Collector
  • Java Performance 20 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Class Sharing – IBM JVM • Class Cache • Class Cache JVM – JVM Cache • JVM Cache • Cache • Cache OS
  • Java Performance 21 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader • Classloader Tree in WAS – Path Parameter • -Xbootclasspath:<path(s) or file(s)> : Bootstrap classloader • -Xbootclasspath/a:<path(s) or file(s)> : boot classpath • -Xbootclasspath/p:<path(s) or file(s)> : boot classpath • -Djava.ext.dirs=<path(s) or file(s)> : Extension classloader • -cp, -classpath <path(s) or file(s)> -Djava.class.path=<path(s) or file(s)> : System classloader
  • Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Class Loader Work
  • Java Performance 23 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Classloader Work Link Load Verify Prepare Resolve Initialize
  • Java Performance 24 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Classloader Work – JVM class file loading, linking, Initializing Runtime Memory Type • Loading : binary type JVM • Linking : JVM Runtime Binary type data – Verification : JVM – Preparation: Type Memory – Resolution : constant pool symbolic reference
  • Java Performance 25 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Loading – Loading Process • Acquistion : java class file format file, network • Parse : method area parse • java.lang.class instance : class instance application jvm internal data interface
  • Java Performance 26 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Verification • Java language (semantic) • Verification Vendor • JVM Verification • Exception • Parse verification – File size – Superclass • Verification Linking
  • Java Performance 27 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Verification • – Final class subclass – Final class override – Abstract method – Type superclass method ,
  • Java Performance 28 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Verification • Superclass, superinterface load – constant pool – Constant pool Class, Method ,Method descriptor String – Bytecode (integrity) » »
  • Java Performance 29 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Preparation • , , • Class default • Method table data – Method table : Superclass method superclass
  • Java Performance 30 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Preparation Variable Type Default Value int 0 long 0L short (short)0 char ‘u0000’ byte (byte)0 reference null float 0.0f double 0.0d Boolean
  • Java Performance 30 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Preparation Variable Type Default Value int 0 long 0L short (short)0 char ‘u0000’ byte (byte)0 reference null float 0.0f double 0.0d Boolean Boolean primitive type int (false default)
  • Java Performance 31 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Resolution • Type constant pool class, interface, method, field symbolic reference direct reference • Eager lazy – Loading Linking JVM – , vendor
  • Java Performance 32 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Resolution • Eager lazy – Eager : JVM Application Class Loading, Linking – Lazy : First Actual Use Loading, Linking – Vendor Lazy – 1.4 Eager » Hotspot : -XX:+eagerinitializtion (1.4.1) » IBM : -Dibm.cl.eagerresolution (1.4.2)
  • Java Performance 33 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Resolution • Actual Use – Explicit loading – Actual Use of class » Class new instance » Element type class array » Class method » Final static class
  • Java Performance 34 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Linking – Resolution • Actual Use – Actual Use of interface » Interface • compile Passive Use implicit loading
  • Java Performance 35 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Initialization – initial value class • Value – Class Initialization Step • superclass initialized superclass initializing • Class class initialization method <clinit()
  • Java Performance 36 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Initialization – Interface Initialization Step • Interface superinterface initialization initialization method – Loading, Linking Initialization time • First Active Use Initialization • Loading, Linking Initialization
  • Java Performance 37 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Classloader Work • Initialization – Synchronization • Thread initialization Thread Thread Wait • Initialization Thread notify
  • Java Performance 38 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com