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

About Singleton pattern

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
The RMI server requires the instantiation of a single remote object to be passed to the Naming.rebind() method. Can this be considered a singleton pattern design?
please clarify me.
rgds,
Reddy
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really, though it's similar. But a singleton is all about making sure there's just one instance of a class on a single JVM. In a distributed environment it's more complex - we've got one instance of the implementing class, running on the server, and one instance of the stub class running on the client. Moreover neither of these necessarily unique. It's possible to create multiple implementation instances on the server easily enough. And if (for some reason) we wanted to bind a second instance to the registry using a different service name, then it would be possible for clients to retrieve a second separate stub class instance, using the second service name. (It's unlikely anyone would want or need to do this, but it's possible.) As such I would say this is not, strictly speaking, a singleton. But it is an example of controlled instance creation using a form of factory method, at least as far as the client is concerned.
 
G.T. Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks JIM.
rgds,
Reddy
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic