lundi 29 décembre 2014

ListenableFuture like alternative/extension for listeners in Java

Consider the case where I need to perform a task and return a simple future as a handle. Now Guava suggest listenableFuture which has only two functions success and failure. Is there a more generic class which can handle more intermediate stages.


Use case example: upload a file. Now instead of final result which just says success or failure, the consumer is also interested in the current progress of the file.


Is there something similar in Guava or some reliable libraries?


This can be done through custom callback or listener based model but I wanted to know the elegant ways people have been achieving this.


Aucun commentaire:

Enregistrer un commentaire