5.3.3 class loader subsystem

And all other objects, and a class loader instance of class Class User-defined regions are placed in the heap memory, and the type information of the loaded method area are located.


ClassLoader中的四个方法是通往Java虚拟机的通道:
// Four of the methods declared in class java.lang.ClassLoader: protected final Class defineClass(String nane, byte data[]r,int offset, int length);
protected final Class defineClass(String name, byte data[],
int offset, int length, ProtectionDomain protectionDomain);
protected final Class findSystemClass(String name);
protected final void resolveClass(Class c);

Any Java virtual machine implementation must be attached to the inside of these methods class loader subsystem.

Two overloaded the defineClass () method called Data must undergo a [] as a byte array input parameter, and data [offset] to data [offset + length] between the binary data must conform to Java class file format - it represents a new type available. The name parameter is the string, it is noted that the fully qualified name of the type. When using the first defineClass (), the type will be assigned a default protection domain. When a second defineClass (), the type of protection domain by specifying its protectionDomain parameters. Each Java virtual machine implementation must ensure defineClass ClassLoader class () method can lead people to the new type of method area.

the resolveClass () method takes a reference Class instance as a parameter, it performs the connection operation type indicated by the Class instance. And the defineClass aforementioned () method is responsible for loading only. When the defineClass () method returns a Class instance, it indicates that the specified class file has been found and the method of loading zone, but not necessarily be connected and initialized. java virtual machine implementation must ensure resolveClass ClassLoader class () method enables the class loader subsystem performs the connection operation.

 

 

Guess you like

Origin www.cnblogs.com/mongotea/p/11979307.html