Professional Web Applications Themes

Locking on multiple asynchronous calls - Macromedia Flex General Discussion

Several parts of our Flex application require loading multiple types of data on initialization of a component. We use RemoteObjects to get data from the server. When we try to start multiple (asynchronous) calls at the same time, about 80% of the time, the Flex application locks up. If we re-arrange the calls so that one method is not called until the prior method has returned. This fixes the problem, but makes the full time to retrieve data from the server slower. Do you know what might be causing this? Do you know any fixes? Here's the general pattern we ...

  1. #1

    Default Locking on multiple asynchronous calls

    Several parts of our Flex application require loading multiple types of data on
    initialization of a component. We use RemoteObjects to get data from the server.

    When we try to start multiple (asynchronous) calls at the same time, about 80%
    of the time, the Flex application locks up. If we re-arrange the calls so that
    one method is not called until the prior method has returned. This fixes the
    problem, but makes the full time to retrieve data from the server slower.

    Do you know what might be causing this? Do you know any fixes?

    Here's the general pattern we use for remote object calls:

    (in our Application object):
    <mx:RemoteObject id="myDelegate" source="com.foo.MyServerDelegate"
    result="event.call.resultHandler(event.result)"
    fault="errorHandler.handleError(event)">
    </mx:RemoteObject>

    (from an initialization method in an ActionScript):
    function init()
    {
    var pendingCall = tierManagerDelegate.getDefaultServiceTierFields();

    pendingCall.resultHandler=mx.utils.Delegate.create (this,defaultTierFieldsResultH
    andler);

    lmcp Guest

  2. #2

    Default Re: Locking on multiple asynchronous calls

    Oops, saved this before I finished...here's the pattern:

    (in our Application object):
    <mx:RemoteObject id="myDelegate" source="com.foo.MyServerDelegate"
    result="event.call.resultHandler(event.result)"
    fault="errorHandler.handleError(event)">
    </mx:RemoteObject>

    (from an initialization method in an ActionScript):
    function init()
    {
    var pendingCall = myDelegate.getData1();
    pendingCall.resultHandler=mx.utils.Delegate.create (this,data1ResultHandler);

    // !! Can't do this or the application locks
    //var pendingCall2 = myDelegate.getData2();

    //pendingCall2.resultHandler=mx.utils.Delegate.creat e(this,data2ResultHandler);
    }

    function data1ResultHandler(result)
    {
    myData1 = result;

    // Need to do this AFTER the first call finishes or application locks
    var pendingCall2 = myDelegate.getData2();

    pendingCall2.resultHandler=mx.utils.Delegate.creat e(this,data2ResultHandler);
    }

    function data2ResultHandler(result)
    {
    myData2 = result;
    }

    lmcp Guest

Similar Threads

  1. Asynchronous calls from Java?
    By bobbrose in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: February 28th, 04:55 AM
  2. Web service calls asynchronous vs synchronous
    By J_Master in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: February 16th, 05:39 PM
  3. Asynchronous web service calls
    By Russell Mason in forum ASP.NET Web Services
    Replies: 3
    Last Post: August 5th, 03:09 PM
  4. duplicateMovieClip function calls (Asynchronous)
    By irraticFlash in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: March 2nd, 04:29 PM
  5. Windows identity during asynchronous calls
    By Dave Mullen in forum ASP.NET General
    Replies: 2
    Last Post: August 1st, 01:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139