aspose file tools*
The moose likes Java in General and the fly likes How to avoid loading of all static variables when JVM encounter JAVA class name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to avoid loading of all static variables when JVM encounter JAVA class name" Watch "How to avoid loading of all static variables when JVM encounter JAVA class name" New topic
Author

How to avoid loading of all static variables when JVM encounter JAVA class name

Pramod Kumar Bollavatni
Greenhorn

Joined: Dec 27, 2011
Posts: 5
Hi friends,
could any one please answer my question.
Q : Whenever JVM encounters the java class name it loads the context(static data) of the class into memory but is there any possibility of avoiding loading all the static variables and i want to load only required static variables into memory .

Thanks in advance...
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 606

The Initialization om hold pattern is useful for lazy loading a singleton & basically postpones loading of the variable till it is actually used. However it can be used to only hold one such value (or group of values) and therefore you will need a nested helper class for each of the value groups that you like to lazy load.

Initialization-on-demand holder idiom

I don't recommend this, without having a really really good reason.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Pramod Kumar Bollavatni
Greenhorn

Joined: Dec 27, 2011
Posts: 5
Thanks sam it is helpful.....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to avoid loading of all static variables when JVM encounter JAVA class name