Thanks for your help :o)

-----Messaggio originale-----
Da: Randy Layman [mailto:[EMAIL PROTECTED]]
Inviato: venerdì 30 marzo 2001 14.12
A: [EMAIL PROTECTED]
Oggetto: RE: Singleton and multiple JVM



        You'll have to build the construct yourself as there is no
pre-defined way to accomplish what you are trying to accomplish.

        Basically what you're going to want to do is to create an instance
of the Singleton in each JVM.  Then designate one of the instances as the
master - the one that responsible for keeping track of whatever value you
need tracked and multiple slaves that consult with the master.
        A few notes that I've just thought about:
        * If all the servers know about all the others then you could use
something like RMI, or plain sockets for the communication
        * If the servers don't know about each other then use something like
Multicasting Sockets to find and possibly communicate
        * Don't assume anything about the master, make the code work so that
if a master doesn't already exist then the next singleton created becomes
the master
        * Remember to code for the possibility that the master might die and
one slave needs to become the master
        * Remember that, because of networking or timing issues, two
machines might think that they are the master and you'll need to demote one
of them.

        If you don't want to code it, you might use a shared database or
filespace to store the value.

        All of this assumes that you are using a singleton to track some
data (which might include locks), if you are using it as some sort of
factory, why do you care about multiple singleton in different JVMs? (In
other words, make sure that you are worrying about the right problem)

        Randy

> -----Original Message-----
> From: Luise Massimo
> [mailto:IMCEAEX-_O=COMPUTER+20CENTER+20ORG_OU=COMPUTER+20CENTE
> R+20SITE_C
> [EMAIL PROTECTED]]
> Sent: Thursday, March 29, 2001 10:08 AM
> To: '[EMAIL PROTECTED]'
> Subject: Singleton and multiple JVM
> 
> 
> Hello to everyone.
> There is anyone that can help me for this problem:
>  
> I made a webapps that use some singleton object (a single 
> instance object
> accessed through class method).
> If i use the load-balancer worker (tomcat 3.2.1 with mod_jk), 
> that it's to
> say multiple JVM, there is no more a single instance object, but one
> instance for JVM !!
> I need singleton object but also load-balancing....is there 
> some solution ?
>  
> I hope someone can help......bye.
> Luise Massimo
> 

Reply via email to