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

Re: [xmlblaster-devel] LOCAL not working?

Peter Antman wrote:
Meetings all day yesterday, but now I have something that works; but as
far as I understand it not designed exactly the way your stuff seems to
be heading.

Here's the deal:

You must use a Global which contains the serverside engine global in its
ObjectEntry "ServerNodeScope". The cloning process for each
XmlBlasterAccess instance must therefore include ServerNodeScope.

The LocalConnections is simple: look up the engine.Global, get the stuff
you need from it and just delegate.

LocalCallbackImpl must also have access to the engine.Global. There it
simply adds itself as an ObjectEntry with its raw adress as key. It
implements a new interface ServerNodeScope wich the serverside callback
expect to find in the ObjectEntry.

The coolest way would be if we could get a pointer of the callback instance which we pass as a string and the ask the classloader to resolve the object instance again from this pointer (like in C).

This is the stringified object on CORBA:
  <callback type='IOR'>

A LOCAL 'pointer':
  <callback type='LOCAL'>

lc = (I_LocalCallback)Classloader.getObject("0x68F44A");

This way we don't need to pass it via Global.

But i think this is not possible in Java.

So putting the object into a hashtable in Global
(made unique with hashCode()) and retrieve it
again as you do is probably the best way.

  <callback type='LOCAL'>

Here are some snippets from LocalCallbackImpl:

public synchronized final void initialize(Global glob, String
CallbackAddress callbackAddress,
I_CallbackExtended cbClient) throws XmlBlasterException {
this.glob = (glob == null) ? Global.instance() : glob;
this.log = this.glob.getLog("local");
this.ME = "LocalCallbackImpl-" + loginName;
this.callbackId = "LOCAL:"+this.hashCode();
this.cbClient = cbClient;
// Set this object an the engine.Global so that the server cb
// can find it.
engineGlob =
if (engineGlob == null)
throw new XmlBlasterException(this.glob,
ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "could not retreive the
ServerNodeScope. Am I really on the server side ?");
// Ad the driver to the "naming" store.


   public String getCbAddress() throws XmlBlasterException {
      return callbackId;

public String[] update(String cbSessionId, MsgUnitRaw[] msgUnitArr)
throws XmlBlasterException
if (msgUnitArr == null) throw new XmlBlasterException(ME,
"Received update of null message");
if (log.CALL) log.call(ME, "Entering update(" + cbSessionId + ")
of " + msgUnitArr.length + " messages");
return cbClient.update(cbSessionId, msgUnitArr);

The serverside part is CallbackLocalDriver. Its job is to lookup the
client part in the ObjectEntry and just delegate to it.

   public final void init(Global glob, CallbackAddress callbackAddress)
throws XmlBlasterException {
      this.glob = glob;
      this.log = glob.getLog("local");
      this.callbackAddress = callbackAddress;
      String callbackId = callbackAddress.getRawAddress();
      try {
         localCallback  = ( I_LocalCallback

if ( localCallback == null) {
throw new XmlBlasterException(this.glob,
ErrorCode.INTERNAL_UNKNOWN, ME + ".init", "could not retreive the
LocalCallbackImpl, was there really one started");
} // end of if ()
catch (Throwable e) {
log.error(ME, "The given callback id ='" + callbackId + "' is
invalid: " + e.toString());
throw new XmlBlasterException(glob,
ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, "Local-CallbackHandleInvalid",
"The given callback Id is invalid: " + e.toString());

public final String[] sendUpdate(MsgUnitRaw[] msgArr) throws
if (msgArr == null || msgArr.length < 1)
throw new XmlBlasterException(glob,
ErrorCode.INTERNAL_ILLEGALARGUMENT, ME, "Illegal sendUpdate()
if (log.TRACE) log.trace(ME, "xmlBlaster.update() to " +
try {
localCallback.update(callbackAddress.getSecretSessionId(), msgArr);
} catch (XmlBlasterException xmlBlasterException) {
if (xmlBlasterException.isUser())
throw xmlBlasterException;
throw new XmlBlasterException(glob,
"Local Callback of " + msgArr.length +
" messages to client [" +
callbackAddress.getSecretSessionId() + "] failed.",

What do you say about this?

Yes this was my intention as well.



On Mon, 2003-09-15 at 23:58, Marcel Ruff wrote:

Michele Laghi wrote:

Hi Peter,
you'r right. The implementation of the native access has not been completed yet.

I have started on it but hadn't time to finish it. There are probably one/two days open for finishing implementation, adding testsuite and docu and a little demo client. If you do it its fine, otherwise one day i will complete it. The native access is to be seen in conjunction with the runlevel manager to load the native client, see http://www.xmlBlaster.org/xmlBlaster/doc/requirements/engine.runlevel.howto.html



PS: The Euro wasn't introduced in Sweden, so my
Kroner lying around somewhere won't be valueless :-)


Peter Antman wrote:

am I right if I have found that client.protocol.local is not working, or
should it be able to get it to work (yes, I do have access to
engine.Global), but I am getting exceptions on the server callback part
(and looking into the code I get the impression that something is


-- http://www.xmlBlaster.org