[ 
https://issues.apache.org/jira/browse/AVRO-539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13043428#comment-13043428
 ] 

Scott Carey commented on AVRO-539:
----------------------------------

I wouldn't say Futures are more general.  Its only a few lines of code to 
create a Future from a callback.

A future is just a callback with a lock, that implements the callback by 
storing the result for access through the future API.  We could write a class 
or take one from elsewhere that does this, and users could pass this in as the 
callback.

Futures are more natural to use for imperative style asynchronous work:
* Send a request, do some other work, then get or wait for the result.
* Iterate through a list of asynchronous requests, then iterate over the future 
results (pipelined batch).
* Often more useful if there is shared state managed by the calling thread.

Callbacks are useful for event based / message based systems, or in general 
systems with a more functional style.  Generally useful for high throughput 
'server' applications or client applications with event based frameworks (often 
UI's).

I think we need both, or an easy way for users to get one from the other.

> Allow asynchronous clients to specify a callback to be run when server 
> processing completes
> -------------------------------------------------------------------------------------------
>
>                 Key: AVRO-539
>                 URL: https://issues.apache.org/jira/browse/AVRO-539
>             Project: Avro
>          Issue Type: New Feature
>            Reporter: Jeff Hammerbacher
>         Attachments: AVRO-539.patch
>
>


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to