• 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

singleton with thread and multiple VM's

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like a topic that will do better in Distributed Java, so I'm moving it there...
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic