2

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?

reikje
  • 2,850
  • 2
  • 24
  • 44
  • Out of curiosity, is there a reason you prefer `com.twitter.util.Future` to `scala.concurrent.Future`? – erip Nov 06 '17 at 11:27
  • 1
    I don't prefer it but if you work with Finagle it's build around `com.twitter.util.Future` – reikje Nov 06 '17 at 11:45

0 Answers0