File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

loading of static attributtes

 
jesse harris
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some servlets I am running with websphere and I have a class that contains a large hashtable which is static and final. the way it works now is that the first time I try to access that data the class hits the database and loads it up, which takes a while.
I have two questions:
1. can anyone suggest a way to prime that hashtable so that the first time its asked for its there? (I understand that I can make a call at the top of the first servlet, but that is a delay as well) can it be primed before that, or in the background as a low priority thread?
2. will that data persist as long as webshpere is running?
thanks in advance,
jesse
 
Jun Hong
Ranch Hand
Posts: 181
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use init() method.
 
Tony Chen
Ranch Hand
Posts: 286
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In WAS 3.5:
The ServiceInitializer enables you to specify user defined classes that are invoked as the last action (or actions) during application server startup and shutdown.
In WAS 4.0:
You can write a custom service class that implements the com.ibm.websphere.runtime.CustomService interface (shown below). The administrator can then create a custom service configuration for an application server, supplying the class name. When the application server is started, the custom service will be started and initialized.

------------------
Tony Chen
SCJP, ICS & ICSD (WebSphere)
 
jesse harris
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot tony, do you know if there is any way to do the same with the WTE in visual age?
 
Tony Chen
Ranch Hand
Posts: 286
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jesse harris:
thanks a lot tony, do you know if there is any way to do the same with the WTE in visual age?


Sorry, I'm not sure.

------------------
Tony Chen
SCJP, ICS & ICSD (WebSphere)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic