This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Pramod Kumar Bollavatni
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 607
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pramod Kumar Bollavatni
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sam it is helpful.....
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic