Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-682

Change blocking calls to async in the distributed data store

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • Helium
    • None
    • mdsal
    • None
    • Operating System: All
      Platform: All

    • 1534

    Description

      The ActorContext#executeRemoteOperation method sends a message to an Actor and blocks waiting for the result. There are some places where we need to block but other places where we don't need to.

      Eg, in TransactionContextImpl#readData, it needs to return a ListenableFuture back to the caller so it submits a Callable task to an executor which just calls ActorContext#executeRemoteOperation and waits for the result. It would be ideal if we could make this completely async and avoid the overhead of submitting a task and creating a thread that just blocks.

      ActorContext#executeRemoteOperation calls the akka 'ask' method to send the message which returns a scala Future. The Future class has onSuccess and onFailure methods to register callbacks and, in reading the scala docs, these methods are non-blocking. This is very similar to guava's ListenableFuture. We can create a guava SettableFuture to return to the caller and set the result via onSuccess/onFailure asynchronously.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpantelis Tom Pantelis
            tpantelis Tom Pantelis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: