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

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).


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