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

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



Hi,

HelloWorld5.java uses two connections, here
the second connection clones a global:

  ...
  Global globReceiver = glob.getClone(null);
  receiver = globReceiver.getXmlBlasterAccess();

  ConnectQos qos = new ConnectQos(receiver.getGlobal());
  ConnectReturnQos conRetQos = receiver.connect(qos, new I_Callback() {
  ...

The getClone(String[]) is probably the way to go.

The Global is a 'local stack' of execution, the
local settings of a client connection (and as well
the local settings of an embedded xmlBlaster server).
With this approach you can have many independent
client connections and embedded servers in the same
JVM.

We don't use ANY singletons in xmlBlaster (apart from
finals) as they are only causing problems.
Global can be seen as a connection specific singleton.

Since this is now the second time that somebody
gets confused about using different global instances
for different connections we need to think about
the design or a better naming ... any ideas?


David Hooker wrote:
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 have set this to deprecated, please use getClone() instead.

thanks

Marcel

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