[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xmlblaster] Subscriber getting first message only - big clue!



Well, if I call "new Global()" more than once, it prints a warning
message to the screen.  So the best thing I see is to do something like
this:

	global = new Global(Global.instance());

I hope that's the preferred way to create multiple Globals.  The 3-arg
constructor is very cumbersome.


-----Original Message-----
From: Michele Laghi [mailto:laghi at swissinfo.org] 
Sent: Monday, April 07, 2003 3:58 PM
To: xmlblaster at server.xmlblaster.org
Subject: Re: [xmlblaster] Subscriber getting first message only - big
clue!


Hallo David,
good to hear you found out the error since I was looking at a totally 
wrong place. Now everything is clear. If you use several clients within 
the same java virtual machine you should create one global for each 
client since there is one XmlBlasterAccess per global (kind of a global 
singleton).

Saluti
Michele




David Hooker wrote:
> I think I've located my problem.
> 
> I noticed that my subscriber in my main program is being disconnected
> when the PUBLISHER in the same program logs out!
> 
> Here's some code:
> 
>     public void close()
>     {
>         if (open)
>         {
>             conn.disconnect(new DisconnectQos(global));
>             open = false;
>         }
>     }
> 
> This method is called to close my publisher connection.  This
connection
> is created AFTER my subscriber gets the first message.  The Global in
> this object is created like this:
> 
>     private static Global global = Global.instance();
> 
> So I thought that maybe the disconnect is killing BOTH connections.
So
> I set a breakpoint on the disconnect call above, and inspected the
> global object.  I found that the xmlBlasterAccess member of the global
> has a "ME" variable which specifices the SUBSCRIBER I created earlier!
> So I'm guessing that when I call disconnect here, that I'm
disconnecting
> the subscriber!
> 
> Maybe I need to understand Global better.  Is this a singleton?  If
so,
> how do I create many transient publishers and subscribers?  Am I only
> allowed one connect from a single program?
> 
> 


-- 
Michele Laghi
mailto:laghi at swissinfo.org
tel. +46 8 7492952 / mob. +46 70 4103964
http://www.geocities.com/laghi2000
http://www.xmlBlaster.org