| 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: 576
|
|
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.....
|
 |
 |
|
|
subject: How to avoid loading of all static variables when JVM encounter JAVA class name
|
|
|