1 Reply Latest reply on Feb 8, 2011 11:54 PM by danilopau

    RemoteObject multiple calls problem?


      Hi guys,

      first of all, sorry for my english (i can write in italian or spanish, if someone prefer).


      I'll try to resume the question: i have a flex main application, with a single RemoteObject to manage the RPCs to a Spring Bean in the server (i'm using springflex, but not it's not this the question). I mean, in the MainApplication.mxml i have something like this:



      <s:RemoteObject id="rpcService" destination="beanName" >


                <mx:method name="method_1" fault="faultHandler(event)" result = "resultHandler(event)" />

                <mx:method name="method_2" fault="faultHandler(event)" result = "resultHandler(event)" />




      In the MainApplication.mxml, i use other flex components that i made, and some of them have its own RemoteObject to manage its content.


      Well, everything was working well, but now i'm having some trouble.. i get my browser "blocked", i mean.. when i do something that cause a rpcService.method_X, the browser blocks, just like the flash plugin crash someway (and yes, i get the plugin alert to stop the application in the browser).


      I must say that the MainApplication launch RPCs and the inner components too, so i made some test to see if it was the "concurrency" to cause my problem.. and so it seems.. when i don't have multiple RPC calls, everything works fine.. when i left the application with all its RPCs, the browser crash/get blocked..


      Surfing on the net, i've found something, and it seems a channel problem (see the text at the end), but.. i don't know, it seems strange to me that two RPCs can cause the app to block.. it isn't exactly the idea of "asynchronous" i have..


      Any idea guys??

      Thank you very much for reading till here




      RemoteObject requests get queued until the next execution frame and then sent via the same HTTP request, ie. multiple operations over the same request. So when you call:service1.method(1);service2.method(2)
      Both operations are going over the same HTTP request. The first one causes the thread handling that request to sleep thus causing the second operation to not be called until the thread resumes.

      The only way I know of to avoid this is to make sure that each operation goes on it's own HTTP request and thus gets it's own thread. But remember that you only get 2 concurrent HTTP requests in most browsers. So if you are making more than two requests at a time then you will still be blocked and not parallel beyond 2 concurrent operations.