wood burning stoves*
The moose likes Websphere and the fly likes loading of static attributtes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "loading of static attributtes" Watch "loading of static attributtes" New topic
Author

loading of static attributtes

jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
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

Joined: Sep 05, 2001
Posts: 181
Use init() method.


Jun Hong<br />SCJP, SCJD, SCWCD, SCEA<br />IBM Certified Systems Expert(V4.0)
Tony Chen
Ranch Hand

Joined: Jan 29, 2001
Posts: 286
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)


SCJP Java 2 - IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0 - IBM Certified System Administrator - WebSphere Network Deployment V6.0 - Canadian Securities Course (CSC) Certification
jesse harris
Ranch Hand

Joined: Oct 02, 2000
Posts: 62
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

Joined: Jan 29, 2001
Posts: 286
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)
 
wood burning stoves
 
subject: loading of static attributtes
 
Similar Threads
singleton class or to ahve a static variable inside a class
What Is A: Hash Table?
Static blocks and multi threading
singleton class or to have a static variable in a class
Adding values to a hashtable from a different class