How to avoid loading of all static variables when JVM encounter JAVA class name
Pramod Kumar Bollavatni
posted 4 years ago
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 .
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.