Skip to content

Instantly share code, notes, and snippets.

@maiha
Created August 27, 2014 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maiha/bfd067bab756d13f5c66 to your computer and use it in GitHub Desktop.
Save maiha/bfd067bab756d13f5c66 to your computer and use it in GitHub Desktop.
check a selection has active Actor or not
private def probeActorRef(sel: ActorSelection): Unit = {
import scala.util.{Success, Failure}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.util.Timeout
import scala.concurrent.duration._
implicit val timeout = Timeout(300.millis) // Timeout for the resolveOne call
sel.resolveOne().onComplete {
case Success(ref) =>
logger.debug(s" resolved: $ref [${ref.getClass.getSimpleName}]")
case Failure(ex) => logger.debug(s"$ex")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment