Created
August 27, 2014 04:34
-
-
Save maiha/bfd067bab756d13f5c66 to your computer and use it in GitHub Desktop.
check a selection has active Actor or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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