• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic