Hi Derrell,

Am 26.01.2007 um 15:11 schrieb [EMAIL PROTECTED]:

> Andreas Junghans <[EMAIL PROTECTED]> writes:
>
>> Besides, there's already the "callAsyncListeners" method which has
>> the same purpose as "callAsync" but behaves more "qooxdoo-ish" (using
>> the standard listener concept where you can add a listener with a
>> specific "this" context).
>>
>> However, I think the callAsyncListeners method needs some rework (I
>> don't know who implemented it - Derrell?). I don't see an easy way to
>> find out which server method was called when the result arrives,
>> which makes it hard to have concurrent asynchronous calls. I think we
>> should pass something like {result: ..., methodName: ..., id: ...} to
>> the listeners.
>
> Yes, I implemented it.  It's in use in the Samba Web Administration  
> Tool in
> samba4, which uses the Finite State Machine to handle all events.
>
> The id is in the result that's passed as data to the listener.  In  
> fact, in
> the "completed" event handler (Rpc.c:311), we verify that it  
> matches the
> sequence number of the request.  Is there something other than this  
> id that's
> missing?  (We've never provided the method name on any async  
> response. I
> believe it's up to to the caller to save that information,  
> referenced by the
> id, if the caller needs it.)

I think we're talking about different things. What I mean is this use  
case:

var rpc = new qx.io.remote.Rpc(...);
rpc.addEventListener("completed", mySuccessListener);
rpc.addEventListener("failed", myFailureListener);
rpc.callAsyncListeners(true, "serverMethod1", param1, param2);
rpc.callAsyncListeners(true, "serverMethod2", param1, param2);

Now look at the code in handleRequestFinished that fires the  
"completed" event:

     case 2:                     // async with event listeners
       // Dispatch the event to our listeners.
       if (! ex) {
         eventTarget.createDispatchDataEvent(eventType, result);

What gets passed as event data is the method result (e.g. a string),  
not the whole structure (result, id, etc.).

Under these circumstances, when my "completed" listener is called,  
how am I supposed to know which of the two methods I called just  
returned? All I have is the event type ("completed") and the method  
result (e.g. "Foobar"). Did "serverMethod1" return "Foobar", or was  
it "serverMethod2"? I don't have an id or anything else that would  
tell me. Sure, I call "serverMethod1" first, but maybe it takes much  
longer than "serverMethod2".

Regards,

   Andreas


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to