5 Replies Latest reply on Feb 11, 2008 3:11 PM by ntsiii

    Stale ASync Remote Call

      I was wondering if anyone could point me in the right direction for handling stale ASync remote calls.

      So it would be a scenario where a user clicks a button to call a remote object but then leaves that screen and goes to another part of the application. Then the response comes back from the other call but now it is stale because the user has moved on and I do not want to do anything with the response ( like showing a alert).

      Any information would be great.
        • 1. Re: Stale ASync Remote Call
          ntsiii Level 3
          First, do not bind to lastResult. *Always* use a result handler function.

          In that function, you can use whatever logic you want to determine what to do or not do with the result.

          Note that most data service calls retrun within milliseconds. The UI delay is caused by the rendering.

          Tarcy
          1 person found this helpful
          • 2. Re: Stale ASync Remote Call
            Yes I do use the result handler function but I was wondering if there is a best practice for the situation.

            So here is the scenario.

            A) User clicks button to view tickets. The application makes a remote call to a mid tier service. This service might take some time.

            B) Before the system returns a response the user moves on and goes into a different part of the application. No longer will be viewing tickets. At this point when the response comes back it is old. User does not need it anymore and I do not want to have something pop-up to the user from another piece of the application the user is no longer in.

            So I was wondering if there was a design pattern or best practice for handling application state with remote object calls.
            • 3. Re: Stale ASync Remote Call
              ntsiii Level 3
              I guess I am not following. In your handler, check the state of the UI and decide what to do or not do with the result. For example, If they have moved off the tickets view, then don't do anything with the result.
              Tracy
              1 person found this helpful
              • 4. Re: Stale ASync Remote Call
                I guess that is the question then. How do I check or keep track of the state of the UI to know where the user is with in the application?

                That way I can always check with in my repsonse handler to know where the user is with in the application.
                • 5. Re: Stale ASync Remote Call
                  ntsiii Level 3
                  I would record the users current location in the app using an instance variable on the Application. Hook updates to that var into the navigation functions you have implemented.

                  Tracy