[CONTROLLER-682] Change blocking calls to async in the distributed data store Created: 12/Aug/14  Updated: 20/Aug/14  Resolved: 20/Aug/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: Helium
Fix Version/s: None

Type: Bug
Reporter: Tom Pantelis Assignee: Tom Pantelis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 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.



 Comments   
Comment by Tom Pantelis [ 15/Aug/14 ]

Submitted https://git.opendaylight.org/gerrit/#/c/9965/.

Generated at Wed Feb 07 19:53:37 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.