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.Future
s 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?