• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Startup Servlet in weblogic clustered environment

 
Prem Kashyap
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • 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
 
damien malone
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic