• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Startup Servlet in weblogic clustered environment

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a startup servlet which creates a new thread to read a file and create some instance with the values fetched from the file.
The WAR file is deployed in weblogic clustered environment. I mean one weblogic server but having 2 cluster. So basically its only one machine and one server. but it is clustered.
So the issue is that there are 2 clusters. And both the clusters are creating the thread and making new instance with same values from the file.
So i am having duplicate instances.

Is there any way I can stop the 2nd cluster from creating the thread if first cluster has created the thread?

How about having one config parameter in web.xml say for example: createThread and set its value to false when one of the cluster creates the thread.

Any suggestion will help...

Regards
Prem Kashyap
SCJP 1.4
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
because they are running in sperate JVM's static variables wont work. Also updating environment variables wont work as they are local to each server.

Because both servers are on the one machine you could think about a quick and dirty solution of using a .lok file

i.e. on startup look for a file called something like createthread.lok

if file exists do nothing, if doesnt exist create empty file called that, run your code and delete the file at the end of the process.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic