This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jvm lazy loading ?

 
James Clarke
Ranch Hand
Posts: 148
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Does anyone know what lazy loading is in the jvm sense ?

thanks in advance,

J.C
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Clarke:
Hi all,

Does anyone know what lazy loading is in the jvm sense ?

thanks in advance,

J.C


Dear James,

The JVM must be able to load JVM class files. The JVM class loader loads referenced JVM classes that have not already been linked to the runtime system. Classes are loaded implicitly because:

The initial class file - the class file containing the public static void main(String args[]) method - must be loaded at startup.
Depending on the class policy adopted by the JVM, classes referenced by this initial class can be loaded in either a lazy or eager manner.
An eager class loader loads all the classes comprising the application code at startup. Lazy class loaders wait until the first active use of a class before loading and linking its class file.

The first active use of a class occurs when one of the following occurs:

*An instance of that class is created

*An instance of one of its subclasses is initialized

*One of its static fields is initialized


Certain classes, such as ClassNotFoundException, are loaded implicitly by the JVM to support execution. You may also load classes explicitly using the java.lang.Class.forName() method in the Java API, or through the creation of a user class loader.

The IBM JVM's class resolution is lazy by default. Specifying the -Dibm.cl.eagerresolution command-line option turns on eager class resolution. Lazy class resolution improves startup time of JVMs. For example, the number of classes loaded in a basic Java test reduces from approximately 1500 to approximately 300 with lazy loading.


I hope it makes you clear you.
If any concern then revert me.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic