• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

loading of static attributtes

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use init() method.
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic