Skip to content

Instantly share code, notes, and snippets.

@deanh
Created September 13, 2013 00:04
Show Gist options
  • Save deanh/6545406 to your computer and use it in GitHub Desktop.
Save deanh/6545406 to your computer and use it in GitHub Desktop.
package net.openaura.util
import com.twitter.util.{Future => FinagleFuture}
import scala.concurrent.{Promise, ExecutionContext, Future}
object FinagleImplicits {
implicit def finagleFuture2AkkaFuture[A](future: FinagleFuture[A])(implicit executor: ExecutionContext): Future[_] = {
val promise = Promise[A]
future onSuccess { result =>
promise.success(result)
}
future onFailure { err =>
promise.failure(err)
}
promise.future
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment