keith-turner commented on issue #967: Prototype adding async get methods to 
Transaction
URL: https://github.com/apache/fluo/issues/967#issuecomment-343345665
 
 
   I have thought about two possible approaches to prototyping this.  Both 
approaches would have the following.
   
     * An internal class called AsyncGet that contains a RowColumn and 
CompletableFuture
     * A per transaction queue of AyncGet objects
     * Whenever getAsycn is called on a transaction it creates an AsyncGet 
object and adds it to the queue
     * Something eventually processes the queue by taking all AsyncGet objects 
and calling the existing `get(Collection<RowColumn>)` method and uses the 
results to complete all of the futures.
   
   The difference between the two approaches is how the queue is processed.  
Below are two ways I have been thinking of processing the queue.
   
      * There is a single threaded executor service per transaction (created 
1st time getAsync is called).  Each time something is added to the queue a task 
is also added to the executor service.  What the task does is take everything 
that is present on the queue processes it as described above.  When a 
transaction is closed, this service is stopped.
      * The first time anything tries to use the result of any completable 
future returned by getAsync, then everything in the queue is processed.  
Ideally this would be done by the thread executing the transaction and trying 
to use the future.  However I am not sure this approach is even possible.  I 
have not had enough time to explore CompeltableFuture in depth, but from what I 
have seen so far this approach does not seem possible.  I am writing it up 
because I think its the ideal approach, but may not be possible with 
CompletableFuture.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to