Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-6694

Ensure that future wiring within async model operations preserves exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • qpid-java-6.0
    • qpid-java-6.0
    • Broker-J
    • None

    Description

      We have a number of cases in asynchronous model operations where we chain code to run after a future completes, returning a future to the caller that completes once the chained code completes.

      The idiom looks like this:

      public ListenableFuture<Void> doMyStateChangeOp() 
      {
        final SettableFuture<Void> returnVal = SettableFuture.create();
        ListenableFuture opFuture = operationAsync();
        opFuture.addListener(new Runnable()
        {
                      // some code
                      returnVal.set(null);
        });
        return returnVal;
      }
      

      where #addListener executes the Runnable when the future opFuture completes, successfully or otherwise. The idiom suffers from the fact that opFuture if contains an exception, the exception itself is lost. The caller who receives returnVal gets a success future and the exception is effectively swallowed.

      Attachments

        Activity

          People

            orudyy Alex Rudyy
            kwall Keith Wall
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: