This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes Websphere and the fly likes Multiple VMs/servlet containers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Multiple VMs/servlet containers" Watch "Multiple VMs/servlet containers" New topic

Multiple VMs/servlet containers

Ron Perich
Ranch Hand

Joined: Mar 25, 2003
Posts: 41
I recently developed a thread whose purpose is to run maintenance on database tables, send out emails, etc.
When this system was deployed to the server, I noticed that the server had two servlet containers running in parallel on the same machine. I assume this is something our server team put in place to help with load balancing, etc. (This second VM was on the same machine, not a fail-over machine).
As a result, the thread was actually run in both containers. I had added a System attribute to prevent another Thread from running if a hot re-deploy was attempted, and it stops another thread from running in the same VM.
But, I noticed that the second servet container also runs the thread. Am I to assume that the two servlet containers do not share System properties because they are running in separate VMs.
Also, should I assume that if we were to have a fail-over machine, the Thread would have executed in both machines, so I would have a similar problem?
To solve this, we created a persistent data source that holds the unique ID of the last Thread that modified the source, so it will be the only one to run. Any other thoughts on how I could have handled this?
Thanks for your inputs!

I agree. Here's the link:
subject: Multiple VMs/servlet containers