How do you combine multiple com.twitter.util.Awaitable's with Future.select semantics?

350 views Asked by At

In a service, I have a main method that starts a com.twitter.finagle.ListeningServer and also creates a custom "channel" returning a com.twitter.util.Future that never completes (unless there is an error). Both are actually com.twitter.util.Awaitable instances and I want to shut down my service if either of them completes.

If both were com.twitter.util.Futures I could use Future.select to select the first future that complete, so right now I am converting the com.twitter.finagle.ListeningServer into a com.twitter.util.Future using pool { Await.result(listeningServer) }.

Is there a better way to solve my problem?

0

There are 0 answers