From eefa38f6b9d80ce63ba5e7667cd4bd0880df419c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bone=CC=81r?= Date: Wed, 22 Dec 2010 09:22:01 +0100 Subject: [PATCH] Enriched TypedActorContext --- .../main/scala/akka/actor/TypedActor.scala | 58 ++++++++++++++++--- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala b/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala index 9627c7a15b..5605b223bb 100644 --- a/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala +++ b/akka-typed-actor/src/main/scala/akka/actor/TypedActor.scala @@ -272,9 +272,46 @@ abstract class TypedActor extends Actor with Proxyable { * * @author Jonas Bonér */ -final class TypedActorContext(private val actorRef: ActorRef) { +final class TypedActorContext(private[akka] val actorRef: ActorRef) { private[akka] var _sender: AnyRef = _ + /** +5 * Returns the uuid for the actor. + */ + def getUuid() = actorRef.uuid + + /** +5 * Returns the uuid for the actor. + */ + def uuid = actorRef.uuid + + def timeout = actorRef.timeout + def getTimout = timeout + def setTimout(timeout: Long) = actorRef.timeout = timeout + + def id = actorRef.id + def getId = id + def setId(id: String) = actorRef.id = id + + def receiveTimeout = actorRef.receiveTimeout + def getReceiveTimeout = receiveTimeout + def setReceiveTimeout(timeout: Long) = actorRef.setReceiveTimeout(timeout) + + /** + * Is the actor running? + */ + def isRunning: Boolean = actorRef.isRunning + + /** + * Is the actor shut down? + */ + def isShutdown: Boolean = actorRef.isShutdown + + /** + * Is the actor ever started? + */ + def isUnstarted: Boolean = actorRef.isUnstarted + /** * Returns the current sender reference. * Scala style getter. @@ -284,27 +321,34 @@ final class TypedActorContext(private val actorRef: ActorRef) { else _sender } + /** + * Returns the current sender future TypedActor reference. + * Scala style getter. + */ + def senderFuture: Option[CompletableFuture[Any]] = actorRef.senderFuture + /** * Returns the current sender reference. * Java style getter. + * @deprecated use 'sender()' */ def getSender: AnyRef = { if (_sender eq null) throw new IllegalActorStateException("Sender reference should not be null.") else _sender } - /** - * Returns the current sender future TypedActor reference. - * Scala style getter. - */ - def senderFuture: Option[CompletableFuture[Any]] = actorRef.senderFuture - /** * Returns the current sender future TypedActor reference. * Java style getter. * This method returns 'null' if the sender future is not available. + * @deprecated use 'senderFuture()' */ def getSenderFuture = senderFuture + + /** + * Returns the home address and port for this actor. + */ + def homeAddress: InetSocketAddress = actorRef.homeAddress } object TypedActorConfiguration {