• Post Reply Bookmark Topic Watch Topic
  • New Topic

singleton with thread and multiple VM's  RSS feed

 
Kris Melotte
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using a singleton that starts a thread when the application initializes. The thread consumes records from a database table and calls a webservice for each record. What is the best way to migrate this scenario to multiple application servers and thus multiple virtual machines. The web service should be only called once for each record in the database.
Best regards.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like a topic that will do better in Distributed Java, so I'm moving it there...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using Java Message Service - each VM sends a message for each record. A separate application retrieves the messages and calls the web service.
Bill
 
Kris Melotte
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This would mean that the application servers are the producers of messages and that a separate application on one server acts as the consumer. How do you see that consumer application? Just a simple standalone program that is started when the computer is booted with a forever loop in the main method?
Best regards,
 
sram bahl
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
since ur database is involved here..the simpler way would be to have ur database control the # of calls to the webservice. Ur singleton (read multiton) invoked thread would read the record where a new field will tell whether the service has been invoked or not. If not then it would increment the field and ask ur thread to launch the service.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!