diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala index bcb90b5200..196f31d8a1 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorRefSpec.scala @@ -249,7 +249,7 @@ class ActorRefSpec extends AkkaSpec { out.flush out.close - Serialization.application.withValue(app) { + Serialization.app.withValue(app) { val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray)) val readA = in.readObject @@ -259,7 +259,7 @@ class ActorRefSpec extends AkkaSpec { } } - "throw an exception on deserialize if no application in scope" in { + "throw an exception on deserialize if no app in scope" in { val a = createActor[InnerActor] import java.io._ @@ -277,7 +277,7 @@ class ActorRefSpec extends AkkaSpec { (intercept[java.lang.IllegalStateException] { in.readObject }).getMessage must be === "Trying to deserialize a serialized ActorRef without an AkkaApplication in scope." + - " Use akka.serialization.Serialization.application.withValue(akkaApplication) { ... }" + " Use akka.serialization.Serialization.app.withValue(akkaApplication) { ... }" } "must throw exception on deserialize if not present in local registry and remoting is not enabled" in { @@ -311,7 +311,7 @@ class ActorRefSpec extends AkkaSpec { a.stop() latch.await(5, TimeUnit.SECONDS) must be === true - Serialization.application.withValue(app) { + Serialization.app.withValue(app) { val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray)) (intercept[java.lang.IllegalStateException] { in.readObject diff --git a/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala index f0aacf6946..7df3a592ca 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/TypedActorSpec.scala @@ -338,7 +338,7 @@ class TypedActorSpec extends AkkaSpec with BeforeAndAfterEach with BeforeAndAfte val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray)) - Serialization.application.withValue(app) { + Serialization.app.withValue(app) { val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall] mNew.method must be(m.method) @@ -357,7 +357,7 @@ class TypedActorSpec extends AkkaSpec with BeforeAndAfterEach with BeforeAndAfte val in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray)) - Serialization.application.withValue(app) { + Serialization.app.withValue(app) { val mNew = in.readObject().asInstanceOf[TypedActor.MethodCall] mNew.method must be(m.method) diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index 2d8d71ba89..a3290b67b7 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -139,7 +139,7 @@ object Timeout { implicit def durationToTimeout(duration: Duration) = new Timeout(duration) implicit def intToTimeout(timeout: Int) = new Timeout(timeout) implicit def longToTimeout(timeout: Long) = new Timeout(timeout) - implicit def defaultTimeout(implicit application: AkkaApplication) = application.AkkaConfig.ActorTimeout + implicit def defaultTimeout(implicit app: AkkaApplication) = app.AkkaConfig.ActorTimeout } object Actor { diff --git a/akka-actor/src/main/scala/akka/actor/ActorRef.scala b/akka-actor/src/main/scala/akka/actor/ActorRef.scala index 0d0a7b13f3..61903e96d4 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRef.scala @@ -148,7 +148,7 @@ abstract class ActorRef extends ActorRefShared with UntypedChannel with ReplyCha * @author Jonas Bonér */ class LocalActorRef private[akka] ( - application: AkkaApplication, + app: AkkaApplication, private[this] val props: Props, val address: String, val systemService: Boolean = false, @@ -157,7 +157,7 @@ class LocalActorRef private[akka] ( hotswap: Stack[PartialFunction[Any, Unit]] = Stack.empty) extends ActorRef with ScalaActorRef { - private[this] val actorCell = new ActorCell(application, this, props, receiveTimeout, hotswap) + private[this] val actorCell = new ActorCell(app, this, props, receiveTimeout, hotswap) actorCell.start() /** @@ -243,7 +243,7 @@ class LocalActorRef private[akka] ( @throws(classOf[java.io.ObjectStreamException]) private def writeReplace(): AnyRef = { // TODO: this was used to really send LocalActorRef across the network, which is broken now - val inetaddr = application.reflective.RemoteModule.configDefaultAddress + val inetaddr = app.reflective.RemoteModule.configDefaultAddress SerializedActorRef(uuid, address, inetaddr.getAddress.getHostAddress, inetaddr.getPort) } } @@ -383,19 +383,19 @@ case class SerializedActorRef(uuid: Uuid, address: String, hostname: String, port: Int) { - import akka.serialization.Serialization.application + import akka.serialization.Serialization.app @throws(classOf[java.io.ObjectStreamException]) def readResolve(): AnyRef = { - if (application.value eq null) throw new IllegalStateException( + if (app.value eq null) throw new IllegalStateException( "Trying to deserialize a serialized ActorRef without an AkkaApplication in scope." + - " Use akka.serialization.Serialization.application.withValue(akkaApplication) { ... }") - application.value.provider.actorFor(address) match { + " Use akka.serialization.Serialization.app.withValue(akkaApplication) { ... }") + app.value.provider.actorFor(address) match { case Some(actor) ⇒ actor case None ⇒ // TODO FIXME Add case for when hostname+port == remote.address.hostname+port, should return a DeadActorRef or something // TODO FIXME the remote should only be in the remote actor ref provider - val remote = application.value.reflective.RemoteModule + val remote = app.value.reflective.RemoteModule if (remote.isEnabled) RemoteActorRef(remote.defaultRemoteSupport.get(), new InetSocketAddress(hostname, port), address, None) else diff --git a/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala b/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala index 63d1771a73..ba317ac25e 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRefProvider.scala @@ -75,7 +75,7 @@ object ActorRefProvider { /** * Local ActorRef provider. */ -class LocalActorRefProvider(val application: AkkaApplication, val deployer: Deployer) extends ActorRefProvider { +class LocalActorRefProvider(val app: AkkaApplication, val deployer: Deployer) extends ActorRefProvider { private val actors = new ConcurrentHashMap[String, Promise[Option[ActorRef]]] @@ -96,13 +96,13 @@ class LocalActorRefProvider(val application: AkkaApplication, val deployer: Depl val localProps = if (props.dispatcher == Props.defaultDispatcher) - props.copy(dispatcher = application.dispatcher) + props.copy(dispatcher = app.dispatcher) else props - val defaultTimeout = application.AkkaConfig.ActorTimeout + val defaultTimeout = app.AkkaConfig.ActorTimeout - val newFuture = Promise[Option[ActorRef]](5000)(application.dispatcher) // FIXME is this proper timeout? + val newFuture = Promise[Option[ActorRef]](5000)(app.dispatcher) // FIXME is this proper timeout? val oldFuture = actors.putIfAbsent(address, newFuture) if (oldFuture eq null) { // we won the race -- create the actor and resolve the future @@ -112,7 +112,7 @@ class LocalActorRefProvider(val application: AkkaApplication, val deployer: Depl // create a local actor case None | Some(DeploymentConfig.Deploy(_, _, DeploymentConfig.Direct, _, _, DeploymentConfig.LocalScope)) ⇒ - Some(new LocalActorRef(application, localProps, address, systemService)) // create a local actor + Some(new LocalActorRef(app, localProps, address, systemService)) // create a local actor // create a routed actor ref case deploy @ Some(DeploymentConfig.Deploy(_, _, routerType, nrOfInstances, _, DeploymentConfig.LocalScope)) ⇒ @@ -129,7 +129,7 @@ class LocalActorRefProvider(val application: AkkaApplication, val deployer: Depl val connections: Iterable[ActorRef] = if (nrOfInstances.factor > 0) - Vector.fill(nrOfInstances.factor)(new LocalActorRef(application, localProps, new UUID().toString, systemService)) + Vector.fill(nrOfInstances.factor)(new LocalActorRef(app, localProps, new UUID().toString, systemService)) else Nil actorOf(RoutedProps(routerFactory = routerFactory, connectionManager = new LocalConnectionManager(connections)), address) diff --git a/akka-actor/src/main/scala/akka/actor/DeploymentConfig.scala b/akka-actor/src/main/scala/akka/actor/DeploymentConfig.scala index 334d41271f..4fd6c57a5a 100644 --- a/akka-actor/src/main/scala/akka/actor/DeploymentConfig.scala +++ b/akka-actor/src/main/scala/akka/actor/DeploymentConfig.scala @@ -246,17 +246,17 @@ object DeploymentConfig { * * @author Jonas Bonér */ -class DeploymentConfig(val application: AkkaApplication) { +class DeploymentConfig(val app: AkkaApplication) { import DeploymentConfig._ case class ClusterScope( - preferredNodes: Iterable[Home] = Vector(Node(application.nodename)), + preferredNodes: Iterable[Home] = Vector(Node(app.nodename)), replication: ReplicationScheme = Transient) extends Scope case class RemoteScope(nodes: Iterable[RemoteAddress]) extends Scope - def isHomeNode(homes: Iterable[Home]): Boolean = homes exists (home ⇒ nodeNameFor(home) == application.nodename) + def isHomeNode(homes: Iterable[Home]): Boolean = homes exists (home ⇒ nodeNameFor(home) == app.nodename) def replicationSchemeFor(deployment: Deploy): Option[ReplicationScheme] = deployment match { case Deploy(_, _, _, _, _, ClusterScope(_, replicationScheme)) ⇒ Some(replicationScheme) diff --git a/akka-actor/src/main/scala/akka/actor/TypedActor.scala b/akka-actor/src/main/scala/akka/actor/TypedActor.scala index ee59faed83..64e6fc64dd 100644 --- a/akka-actor/src/main/scala/akka/actor/TypedActor.scala +++ b/akka-actor/src/main/scala/akka/actor/TypedActor.scala @@ -17,7 +17,7 @@ object TypedActor { * This class represents a Method call, and has a reference to the Method to be called and the parameters to supply * It's sent to the ActorRef backing the TypedActor and can be serialized and deserialized */ - case class MethodCall(application: AkkaApplication, method: Method, parameters: Array[AnyRef]) { + case class MethodCall(app: AkkaApplication, method: Method, parameters: Array[AnyRef]) { def isOneWay = method.getReturnType == java.lang.Void.TYPE def returnsFuture_? = classOf[Future[_]].isAssignableFrom(method.getReturnType) @@ -41,7 +41,7 @@ object TypedActor { case null ⇒ SerializedMethodCall(method.getDeclaringClass, method.getName, method.getParameterTypes, null, null) case ps if ps.length == 0 ⇒ SerializedMethodCall(method.getDeclaringClass, method.getName, method.getParameterTypes, Array[Serializer.Identifier](), Array[Array[Byte]]()) case ps ⇒ - val serializers: Array[Serializer] = ps map application.serialization.findSerializerFor + val serializers: Array[Serializer] = ps map app.serialization.findSerializerFor val serializedParameters: Array[Array[Byte]] = Array.ofDim[Array[Byte]](serializers.length) for (i ← 0 until serializers.length) serializedParameters(i) = serializers(i) toBinary parameters(i) //Mutable for the sake of sanity @@ -58,10 +58,10 @@ object TypedActor { //TODO implement writeObject and readObject to serialize //TODO Possible optimization is to special encode the parameter-types to conserve space private def readResolve(): AnyRef = { - val app = akka.serialization.Serialization.application.value + val app = akka.serialization.Serialization.app.value if (app eq null) throw new IllegalStateException( "Trying to deserialize a SerializedMethodCall without an AkkaApplication in scope." + - " Use akka.serialization.Serialization.application.withValue(akkaApplication) { ... }") + " Use akka.serialization.Serialization.app.withValue(akkaApplication) { ... }") MethodCall(app, ownerType.getDeclaredMethod(methodName, parameterTypes: _*), serializedParameters match { case null ⇒ null case a if a.length == 0 ⇒ Array[AnyRef]() @@ -102,7 +102,7 @@ object TypedActor { } /** - * Returns the akka application (for a TypedActor) when inside a method call in a TypedActor. + * Returns the akka app (for a TypedActor) when inside a method call in a TypedActor. */ def app = appReference.get match { case null ⇒ throw new IllegalStateException("Calling TypedActor.app outside of a TypedActor implementation method!") @@ -137,7 +137,7 @@ object TypedActor { * * TypedActors needs, just like Actors, to be Stopped when they are no longer needed, use TypedActor.stop(proxy) */ -class TypedActor(val application: AkkaApplication) { +class TypedActor(val app: AkkaApplication) { import TypedActor.MethodCall @@ -251,12 +251,12 @@ class TypedActor(val application: AkkaApplication) { //Warning, do not change order of the following statements, it's some elaborate chicken-n-egg handling val actorVar = new AtomVar[ActorRef](null) val timeout = props.timeout match { - case Timeout(Duration.MinusInf) ⇒ application.AkkaConfig.ActorTimeout + case Timeout(Duration.MinusInf) ⇒ app.AkkaConfig.ActorTimeout case x ⇒ x } val proxy: T = Proxy.newProxyInstance(loader, interfaces, new TypedActorInvocationHandler(actorVar)(timeout)).asInstanceOf[T] proxyVar.set(proxy) // Chicken and egg situation we needed to solve, set the proxy so that we can set the self-reference inside each receive - val ref = application.createActor(props) + val ref = app.createActor(props) actorVar.set(ref) //Make sure the InvocationHandler gets ahold of the actor reference, this is not a problem since the proxy hasn't escaped this method yet proxyVar.get } @@ -266,14 +266,14 @@ class TypedActor(val application: AkkaApplication) { private[akka] class TypedActor[R <: AnyRef, T <: R](val proxyVar: AtomVar[R], createInstance: ⇒ T) extends Actor { // FIXME TypedActor register/unregister on postStop/preStart - // override def preStart = application.registry.registerTypedActor(self, proxyVar.get) //Make sure actor registry knows about this actor - // override def postStop = application.registry.unregisterTypedActor(self, proxyVar.get) + // override def preStart = app.registry.registerTypedActor(self, proxyVar.get) //Make sure actor registry knows about this actor + // override def postStop = app.registry.unregisterTypedActor(self, proxyVar.get) val me = createInstance def receive = { case m: MethodCall ⇒ TypedActor.selfReference set proxyVar.get - TypedActor.appReference set application + TypedActor.appReference set app try { if (m.isOneWay) m(me) else if (m.returnsFuture_?) { @@ -298,7 +298,7 @@ class TypedActor(val application: AkkaApplication) { case "equals" ⇒ (args.length == 1 && (proxy eq args(0)) || actor == getActorRefFor(args(0))).asInstanceOf[AnyRef] //Force boxing of the boolean case "hashCode" ⇒ actor.hashCode.asInstanceOf[AnyRef] case _ ⇒ - MethodCall(application, method, args) match { + MethodCall(app, method, args) match { case m if m.isOneWay ⇒ actor ! m; null //Null return value case m if m.returnsFuture_? ⇒ actor ? m case m if m.returnsJOption_? || m.returnsOption_? ⇒ diff --git a/akka-actor/src/main/scala/akka/cluster/ClusterInterface.scala b/akka-actor/src/main/scala/akka/cluster/ClusterInterface.scala index f99c0aa730..d96b85f7d0 100644 --- a/akka-actor/src/main/scala/akka/cluster/ClusterInterface.scala +++ b/akka-actor/src/main/scala/akka/cluster/ClusterInterface.scala @@ -103,7 +103,7 @@ class NodeAddress(val clusterName: String, val nodeName: String) { */ object NodeAddress { def apply(clusterName: String, nodeName: String): NodeAddress = new NodeAddress(clusterName, nodeName) - def apply(application: AkkaApplication): NodeAddress = new NodeAddress(application.AkkaConfig.ClusterName, application.nodename) + def apply(app: AkkaApplication): NodeAddress = new NodeAddress(app.AkkaConfig.ClusterName, app.nodename) def unapply(other: Any) = other match { case address: NodeAddress ⇒ Some((address.clusterName, address.nodeName)) diff --git a/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala index 9836152027..aef413579f 100644 --- a/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala @@ -61,7 +61,7 @@ object MessageDispatcher { val SCHEDULED = 1 val RESCHEDULED = 2 - implicit def defaultDispatcher(implicit application: AkkaApplication) = application.dispatcher + implicit def defaultDispatcher(implicit app: AkkaApplication) = app.dispatcher } /** @@ -310,19 +310,19 @@ abstract class MessageDispatcher(val app: AkkaApplication) extends Serializable /** * Trait to be used for hooking in new dispatchers into Dispatchers.fromConfig */ -abstract class MessageDispatcherConfigurator(val application: AkkaApplication) { +abstract class MessageDispatcherConfigurator(val app: AkkaApplication) { /** * Returns an instance of MessageDispatcher given a Configuration */ def configure(config: Configuration): MessageDispatcher def mailboxType(config: Configuration): MailboxType = { - val capacity = config.getInt("mailbox-capacity", application.AkkaConfig.MailboxCapacity) + val capacity = config.getInt("mailbox-capacity", app.AkkaConfig.MailboxCapacity) if (capacity < 1) UnboundedMailbox() else { val duration = Duration( - config.getInt("mailbox-push-timeout-time", application.AkkaConfig.MailboxPushTimeout.toMillis.toInt), - application.AkkaConfig.DefaultTimeUnit) + config.getInt("mailbox-push-timeout-time", app.AkkaConfig.MailboxPushTimeout.toMillis.toInt), + app.AkkaConfig.DefaultTimeUnit) BoundedMailbox(capacity, duration) } } @@ -331,8 +331,8 @@ abstract class MessageDispatcherConfigurator(val application: AkkaApplication) { import ThreadPoolConfigDispatcherBuilder.conf_? //Apply the following options to the config if they are present in the config - ThreadPoolConfigDispatcherBuilder(createDispatcher, ThreadPoolConfig(application)).configure( - conf_?(config getInt "keep-alive-time")(time ⇒ _.setKeepAliveTime(Duration(time, application.AkkaConfig.DefaultTimeUnit))), + ThreadPoolConfigDispatcherBuilder(createDispatcher, ThreadPoolConfig(app)).configure( + conf_?(config getInt "keep-alive-time")(time ⇒ _.setKeepAliveTime(Duration(time, app.AkkaConfig.DefaultTimeUnit))), conf_?(config getDouble "core-pool-size-factor")(factor ⇒ _.setCorePoolSizeFromFactor(factor)), conf_?(config getDouble "max-pool-size-factor")(factor ⇒ _.setMaxPoolSizeFromFactor(factor)), conf_?(config getInt "executor-bounds")(bounds ⇒ _.setExecutorBounds(bounds)), diff --git a/akka-actor/src/main/scala/akka/serialization/Serialization.scala b/akka-actor/src/main/scala/akka/serialization/Serialization.scala index 0370d512e7..67e9f2d5c2 100644 --- a/akka-actor/src/main/scala/akka/serialization/Serialization.scala +++ b/akka-actor/src/main/scala/akka/serialization/Serialization.scala @@ -16,7 +16,7 @@ case class NoSerializerFoundException(m: String) extends AkkaException(m) * Serialization module. Contains methods for serialization and deserialization as well as * locating a Serializer for a particular class as defined in the mapping in the 'akka.conf' file. */ -class Serialization(val application: AkkaApplication) { +class Serialization(val app: AkkaApplication) { //TODO document me def serialize(o: AnyRef): Either[Exception, Array[Byte]] = @@ -28,7 +28,7 @@ class Serialization(val application: AkkaApplication) { clazz: Class[_], classLoader: Option[ClassLoader]): Either[Exception, AnyRef] = try { - Serialization.application.withValue(application) { + Serialization.app.withValue(app) { Right(serializerFor(clazz).fromBinary(bytes, Some(clazz), classLoader)) } } catch { case e: Exception ⇒ Left(e) } @@ -70,7 +70,7 @@ class Serialization(val application: AkkaApplication) { * But "default" can be overridden in config */ val serializers: Map[String, Serializer] = - application.config.getSection("akka.actor.serializers") + app.config.getSection("akka.actor.serializers") .map(_.map) .getOrElse(Map()) .foldLeft(Map[String, Serializer]("default" -> akka.serialization.JavaSerializer)) { @@ -81,7 +81,7 @@ class Serialization(val application: AkkaApplication) { /** * bindings is a Map whose keys = FQN of class that is serializable and values = the alias of the serializer to be used */ - val bindings: Map[String, String] = application.config.getSection("akka.actor.serialization-bindings") map { + val bindings: Map[String, String] = app.config.getSection("akka.actor.serialization-bindings") map { _.map.foldLeft(Map[String, String]()) { case (result, (k: String, vs: List[_])) ⇒ result ++ (vs collect { case v: String ⇒ (v, k) }) //All keys which are lists, take the Strings from them and Map them case (result, _) ⇒ result //For any other values, just skip them, TODO: print out warnings? @@ -102,6 +102,6 @@ class Serialization(val application: AkkaApplication) { object Serialization { // TODO ensure that these are always set (i.e. withValue()) when doing deserialization - val application = new DynamicVariable[AkkaApplication](null) + val app = new DynamicVariable[AkkaApplication](null) } diff --git a/akka-actor/src/main/scala/akka/util/AkkaLoader.scala b/akka-actor/src/main/scala/akka/util/AkkaLoader.scala index 33edb92e39..78849898d0 100644 --- a/akka-actor/src/main/scala/akka/util/AkkaLoader.scala +++ b/akka-actor/src/main/scala/akka/util/AkkaLoader.scala @@ -8,7 +8,7 @@ import akka.AkkaApplication /* * This class is responsible for booting up a stack of bundles and then shutting them down */ -class AkkaLoader(application: AkkaApplication) { +class AkkaLoader(app: AkkaApplication) { private val hasBooted = new Switch(false) @volatile diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index f0b298b29a..104d2b59bd 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -119,7 +119,7 @@ object ReflectiveAccess { * * @author Jonas Bonér */ -class ReflectiveAccess(val application: AkkaApplication) { +class ReflectiveAccess(val app: AkkaApplication) { import ReflectiveAccess._ @@ -129,7 +129,7 @@ class ReflectiveAccess(val application: AkkaApplication) { * @author Jonas Bonér */ object ClusterModule { - lazy val isEnabled = application.AkkaConfig.ClusterEnabled //&& clusterInstance.isDefined + lazy val isEnabled = app.AkkaConfig.ClusterEnabled //&& clusterInstance.isDefined lazy val clusterRefClass: Class[_] = getClassFor("akka.cluster.ClusterActorRef") match { case Left(e) ⇒ throw e @@ -150,7 +150,7 @@ class ReflectiveAccess(val application: AkkaApplication) { if (!isEnabled) { val e = new ModuleNotAvailableException( "Can't load the cluster module, make sure it is enabled in the config ('akka.enabled-modules = [\"cluster\"])' and that akka-cluster.jar is on the classpath") - application.eventHandler.debug(this, e.toString) + app.eventHandler.debug(this, e.toString) throw e } } @@ -158,21 +158,21 @@ class ReflectiveAccess(val application: AkkaApplication) { lazy val clusterInstance: Option[Cluster] = getObjectFor("akka.cluster.Cluster$") match { case Right(value) ⇒ Some(value) case Left(exception) ⇒ - application.eventHandler.debug(this, exception.toString) + app.eventHandler.debug(this, exception.toString) None } lazy val clusterDeployerInstance: Option[ActorDeployer] = getObjectFor("akka.cluster.ClusterDeployer$") match { case Right(value) ⇒ Some(value) case Left(exception) ⇒ - application.eventHandler.debug(this, exception.toString) + app.eventHandler.debug(this, exception.toString) None } lazy val transactionLogInstance: Option[TransactionLogObject] = getObjectFor("akka.cluster.TransactionLog$") match { case Right(value) ⇒ Some(value) case Left(exception) ⇒ - application.eventHandler.debug(this, exception.toString) + app.eventHandler.debug(this, exception.toString) None } @@ -235,9 +235,9 @@ class ReflectiveAccess(val application: AkkaApplication) { * @author Jonas Bonér */ object RemoteModule { - val TRANSPORT = application.AkkaConfig.RemoteTransport + val TRANSPORT = app.AkkaConfig.RemoteTransport - val configDefaultAddress = new InetSocketAddress(application.hostname, application.AkkaConfig.RemoteServerPort) + val configDefaultAddress = new InetSocketAddress(app.hostname, app.AkkaConfig.RemoteServerPort) lazy val isEnabled = remoteSupportClass.isDefined @@ -245,7 +245,7 @@ class ReflectiveAccess(val application: AkkaApplication) { if (!isEnabled) { val e = new ModuleNotAvailableException( "Can't load the remote module, make sure it is enabled in the config ('akka.enabled-modules = [\"remote\"])' and that akka-remote.jar is on the classpath") - application.eventHandler.debug(this, e.toString) + app.eventHandler.debug(this, e.toString) throw e } } @@ -253,7 +253,7 @@ class ReflectiveAccess(val application: AkkaApplication) { lazy val remoteInstance: Option[RemoteService] = getObjectFor("akka.remote.Remote$") match { case Right(value) ⇒ Some(value) case Left(exception) ⇒ - application.eventHandler.debug(this, exception.toString) + app.eventHandler.debug(this, exception.toString) None } @@ -265,7 +265,7 @@ class ReflectiveAccess(val application: AkkaApplication) { val remoteSupportClass = getClassFor[RemoteSupport](TRANSPORT) match { case Right(value) ⇒ Some(value) case Left(exception) ⇒ - application.eventHandler.debug(this, exception.toString) + app.eventHandler.debug(this, exception.toString) None } @@ -279,7 +279,7 @@ class ReflectiveAccess(val application: AkkaApplication) { case Left(exception) ⇒ val e = new ModuleNotAvailableException( "Can't instantiate [%s] - make sure that akka-remote.jar is on the classpath".format(remoteClass.getName), exception) - application.eventHandler.debug(this, e.toString) + app.eventHandler.debug(this, e.toString) throw e } } diff --git a/akka-camel/src/main/scala/akka/camel/CamelService.scala b/akka-camel/src/main/scala/akka/camel/CamelService.scala index 7774800d0b..66c89a5381 100644 --- a/akka-camel/src/main/scala/akka/camel/CamelService.scala +++ b/akka-camel/src/main/scala/akka/camel/CamelService.scala @@ -58,7 +58,7 @@ trait CamelService extends Bootable { * Starts this CamelService. */ def start: CamelService = { - // Only init and start if not already done by application + // Only init and start if not already done by app if (!CamelContextManager.initialized) CamelContextManager.init if (!CamelContextManager.started) CamelContextManager.start diff --git a/akka-camel/src/main/scala/akka/camel/Consumer.scala b/akka-camel/src/main/scala/akka/camel/Consumer.scala index b89ca0ccfd..0518a7c271 100644 --- a/akka-camel/src/main/scala/akka/camel/Consumer.scala +++ b/akka-camel/src/main/scala/akka/camel/Consumer.scala @@ -35,7 +35,7 @@ trait Consumer { this: Actor ⇒ /** * Determines whether one-way communications between an endpoint and this consumer actor - * should be auto-acknowledged or application-acknowledged. + * should be auto-acknowledged or app-acknowledged. */ def autoack = true @@ -79,7 +79,7 @@ abstract class UntypedConsumerActor extends UntypedActor with Consumer { /** * Determines whether one-way communications between an endpoint and this consumer actor - * should be auto-acknowledged or application-acknowledged. + * should be auto-acknowledged or app-acknowledged. */ def isAutoack() = super.autoack } diff --git a/akka-camel/src/main/scala/akka/camel/Message.scala b/akka-camel/src/main/scala/akka/camel/Message.scala index f15c7041ce..e3ed12fec0 100644 --- a/akka-camel/src/main/scala/akka/camel/Message.scala +++ b/akka-camel/src/main/scala/akka/camel/Message.scala @@ -208,7 +208,7 @@ object Message { } /** - * Positive acknowledgement message (used for application-acknowledged message receipts). + * Positive acknowledgement message (used for app-acknowledged message receipts). * * @author Martin Krasser */ diff --git a/akka-camel/src/main/scala/akka/camel/Producer.scala b/akka-camel/src/main/scala/akka/camel/Producer.scala index 552fa84663..b29d00e7e5 100644 --- a/akka-camel/src/main/scala/akka/camel/Producer.scala +++ b/akka-camel/src/main/scala/akka/camel/Producer.scala @@ -50,7 +50,7 @@ trait ProducerSupport { this: Actor ⇒ /** * Returns the names of message headers to copy from a request message to a response message. * By default only the Message.MessageExchangeId is copied. Applications may override this to - * define an application-specific set of message headers to copy. + * define an app-specific set of message headers to copy. */ def headersToCopy: Set[String] = headersToCopyDefault diff --git a/akka-camel/src/test/scala/akka/camel/ConsumerScalaTest.scala b/akka-camel/src/test/scala/akka/camel/ConsumerScalaTest.scala index cc9e780df7..7ee64f5d65 100644 --- a/akka-camel/src/test/scala/akka/camel/ConsumerScalaTest.scala +++ b/akka-camel/src/test/scala/akka/camel/ConsumerScalaTest.scala @@ -138,15 +138,15 @@ class ConsumerScalaTest extends WordSpec with BeforeAndAfterAll with MustMatcher "An non auto-acknowledging consumer" when { "started" must { - "must support acknowledgements on application level" in { + "must support acknowledgements on app level" in { var consumer: ActorRef = null service.awaitEndpointActivation(1) { - consumer = actorOf(new TestAckConsumer("direct:application-ack-test")) + consumer = actorOf(new TestAckConsumer("direct:app-ack-test")) } must be(true) - val endpoint = mandatoryContext.getEndpoint("direct:application-ack-test", classOf[DirectEndpoint]) + val endpoint = mandatoryContext.getEndpoint("direct:app-ack-test", classOf[DirectEndpoint]) val producer = endpoint.createProducer.asInstanceOf[AsyncProcessor] val exchange = endpoint.createExchange diff --git a/akka-cluster/src/main/scala/akka/cluster/BookKeeperServer.scala b/akka-cluster/src/main/scala/akka/cluster/BookKeeperServer.scala index 99e1f308cd..4bafaab001 100644 --- a/akka-cluster/src/main/scala/akka/cluster/BookKeeperServer.scala +++ b/akka-cluster/src/main/scala/akka/cluster/BookKeeperServer.scala @@ -9,13 +9,13 @@ import java.io.File /* A simple use of BookKeeper is to implement a write-ahead transaction log. A server maintains an in-memory data structure -(with periodic snapshots for example) and logs changes to that structure before it applies the change. The application +(with periodic snapshots for example) and logs changes to that structure before it applies the change. The app server creates a ledger at startup and store the ledger id and password in a well known place (ZooKeeper maybe). When it needs to make a change, the server adds an entry with the change information to a ledger and apply the change when BookKeeper adds the entry successfully. The server can even use asyncAddEntry to queue up many changes for high change throughput. BooKeeper meticulously logs the changes in order and call the completion functions in order. -When the application server dies, a backup server will come online, get the last snapshot and then it will open the +When the app server dies, a backup server will come online, get the last snapshot and then it will open the ledger of the old server and read all the entries from the time the snapshot was taken. (Since it doesn't know the last entry number it will use MAX_INTEGER). Once all the entries have been processed, it will close the ledger and start a new one for its use. diff --git a/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala b/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala index d67f412cc9..4eb5d1129f 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteActorRefProvider.scala @@ -35,7 +35,7 @@ class RemoteActorRefProvider(val app: AkkaApplication, val remote: Remote) exten private val actors = new ConcurrentHashMap[String, Promise[Option[ActorRef]]] private val remoteDaemonConnectionManager = new RemoteConnectionManager( - app, + app, remote = remote, failureDetector = new BannagePeriodFailureDetector(60 seconds)) // FIXME make timeout configurable diff --git a/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala b/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala index b4360de1d2..202bfaa518 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteDaemon.scala @@ -67,7 +67,7 @@ class Remote(val app: AkkaApplication) extends RemoteService { remote.register(remoteDaemonServiceName, remoteDaemon) remote.addListener(eventStream.channel) remote.addListener(remoteClientLifeCycleHandler) - // TODO actually register this provider in application in remote mode + // TODO actually register this provider in app in remote mode //app.provider.register(ActorRefProvider.RemoteProvider, new RemoteActorRefProvider) remote } diff --git a/akka-spring/src/test/scala/ActorFactoryBeanTest.scala b/akka-spring/src/test/scala/ActorFactoryBeanTest.scala index 27d7a3954c..58a112de83 100644 --- a/akka-spring/src/test/scala/ActorFactoryBeanTest.scala +++ b/akka-spring/src/test/scala/ActorFactoryBeanTest.scala @@ -65,7 +65,7 @@ class ActorFactoryBeanTest extends Spec with ShouldMatchers with BeforeAndAfterA assert(target.getStringFromVal === entry.value) } - it("should create an application context and verify dependency injection for typed") { + it("should create an app context and verify dependency injection for typed") { var ctx = new ClassPathXmlApplicationContext("appContext.xml"); val ta = ctx.getBean("typedActor").asInstanceOf[PojoInf]; assert(ta.isPreStartInvoked) @@ -75,7 +75,7 @@ class ActorFactoryBeanTest extends Spec with ShouldMatchers with BeforeAndAfterA ctx.close } - it("should create an application context and verify dependency injection for untyped actors") { + it("should create an app context and verify dependency injection for untyped actors") { var ctx = new ClassPathXmlApplicationContext("appContext.xml") val uta = ctx.getBean("untypedActor").asInstanceOf[ActorRef] val ping = uta.actor.asInstanceOf[PingActor] diff --git a/akka-spring/src/test/scala/CamelServiceSpringFeatureTest.scala b/akka-spring/src/test/scala/CamelServiceSpringFeatureTest.scala index 7d401e855a..967d94dd33 100644 --- a/akka-spring/src/test/scala/CamelServiceSpringFeatureTest.scala +++ b/akka-spring/src/test/scala/CamelServiceSpringFeatureTest.scala @@ -17,7 +17,7 @@ class CamelServiceSpringFeatureTest extends FeatureSpec with BeforeAndAfterEach Actor.registry.shutdownAll } - feature("start CamelService from Spring application context") { + feature("start CamelService from Spring app context") { import CamelContextManager._ scenario("with a custom CamelContext and access a registered typed actor") { val appctx = new ClassPathXmlApplicationContext("/appContextCamelServiceCustom.xml") diff --git a/akka-spring/src/test/scala/TypedActorSpringFeatureTest.scala b/akka-spring/src/test/scala/TypedActorSpringFeatureTest.scala index 460b72d0c4..69037bd148 100644 --- a/akka-spring/src/test/scala/TypedActorSpringFeatureTest.scala +++ b/akka-spring/src/test/scala/TypedActorSpringFeatureTest.scala @@ -60,7 +60,7 @@ class TypedActorSpringFeatureTest extends FeatureSpec with ShouldMatchers with B myPojo } - feature("parse Spring application context") { + feature("parse Spring app context") { scenario("akka:typed-actor and akka:supervision and akka:dispatcher can be used as top level elements") { val context = new ClassPathResource("/typed-actor-config.xml") diff --git a/akka-spring/src/test/scala/UntypedActorSpringFeatureTest.scala b/akka-spring/src/test/scala/UntypedActorSpringFeatureTest.scala index d552a2bb83..ef111c57ab 100644 --- a/akka-spring/src/test/scala/UntypedActorSpringFeatureTest.scala +++ b/akka-spring/src/test/scala/UntypedActorSpringFeatureTest.scala @@ -45,7 +45,7 @@ class UntypedActorSpringFeatureTest extends FeatureSpec with ShouldMatchers with pingActor } - feature("parse Spring application context") { + feature("parse Spring app context") { scenario("get a untyped actor") { val myactor = getPingActorFromContext("/untyped-actor-config.xml", "simple-untyped-actor") diff --git a/akka-stm/src/main/scala/akka/agent/Agent.scala b/akka-stm/src/main/scala/akka/agent/Agent.scala index a32a669f95..33152d5aff 100644 --- a/akka-stm/src/main/scala/akka/agent/Agent.scala +++ b/akka-stm/src/main/scala/akka/agent/Agent.scala @@ -20,7 +20,7 @@ private[akka] case object Get * Factory method for creating an Agent. */ object Agent { - def apply[T](initialValue: T)(implicit application: AkkaApplication) = new Agent(initialValue, application) + def apply[T](initialValue: T)(implicit app: AkkaApplication) = new Agent(initialValue, app) } /** @@ -93,9 +93,9 @@ object Agent { * agent4.close * }}} */ -class Agent[T](initialValue: T, application: AkkaApplication) { +class Agent[T](initialValue: T, app: AkkaApplication) { private[akka] val ref = Ref(initialValue) - private[akka] val updater = application.createActor(Props(new AgentUpdater(this))).asInstanceOf[LocalActorRef] //TODO can we avoid this somehow? + private[akka] val updater = app.createActor(Props(new AgentUpdater(this))).asInstanceOf[LocalActorRef] //TODO can we avoid this somehow? /** * Read the internal state of the agent. @@ -123,7 +123,7 @@ class Agent[T](initialValue: T, application: AkkaApplication) { def alter(f: T ⇒ T)(timeout: Timeout): Future[T] = { def dispatch = updater.?(Update(f), timeout).asInstanceOf[Future[T]] if (Stm.activeTransaction) { - val result = new DefaultPromise[T](timeout)(application.dispatcher) + val result = new DefaultPromise[T](timeout)(app.dispatcher) get //Join xa deferred { result completeWith dispatch @@ -153,8 +153,8 @@ class Agent[T](initialValue: T, application: AkkaApplication) { def sendOff(f: T ⇒ T): Unit = { send((value: T) ⇒ { suspend() - val pinnedDispatcher = new PinnedDispatcher(application, null, "agent-send-off", UnboundedMailbox(), application.AkkaConfig.ActorTimeoutMillis) - val threadBased = application.createActor(Props(new ThreadBasedAgentUpdater(this)).withDispatcher(pinnedDispatcher)) + val pinnedDispatcher = new PinnedDispatcher(app, null, "agent-send-off", UnboundedMailbox(), app.AkkaConfig.ActorTimeoutMillis) + val threadBased = app.createActor(Props(new ThreadBasedAgentUpdater(this)).withDispatcher(pinnedDispatcher)) threadBased ! Update(f) value }) @@ -168,11 +168,11 @@ class Agent[T](initialValue: T, application: AkkaApplication) { * still be executed in order. */ def alterOff(f: T ⇒ T)(timeout: Timeout): Future[T] = { - val result = new DefaultPromise[T](timeout)(application.dispatcher) + val result = new DefaultPromise[T](timeout)(app.dispatcher) send((value: T) ⇒ { suspend() - val pinnedDispatcher = new PinnedDispatcher(application, null, "agent-alter-off", UnboundedMailbox(), application.AkkaConfig.ActorTimeoutMillis) - val threadBased = application.createActor(Props(new ThreadBasedAgentUpdater(this)).withDispatcher(pinnedDispatcher)) + val pinnedDispatcher = new PinnedDispatcher(app, null, "agent-alter-off", UnboundedMailbox(), app.AkkaConfig.ActorTimeoutMillis) + val threadBased = app.createActor(Props(new ThreadBasedAgentUpdater(this)).withDispatcher(pinnedDispatcher)) result completeWith threadBased.?(Update(f), timeout).asInstanceOf[Future[T]] value }) @@ -194,7 +194,7 @@ class Agent[T](initialValue: T, application: AkkaApplication) { * Map this agent to a new agent, applying the function to the internal state. * Does not change the value of this agent. */ - def map[B](f: T ⇒ B): Agent[B] = Agent(f(get))(application) + def map[B](f: T ⇒ B): Agent[B] = Agent(f(get))(app) /** * Flatmap this agent to a new agent, applying the function to the internal state. @@ -264,7 +264,7 @@ class Agent[T](initialValue: T, application: AkkaApplication) { * Map this agent to a new agent, applying the function to the internal state. * Does not change the value of this agent. */ - def map[B](f: JFunc[T, B]): Agent[B] = Agent(f(get))(application) + def map[B](f: JFunc[T, B]): Agent[B] = Agent(f(get))(app) /** * Java API: diff --git a/akka-stm/src/test/scala/agent/AgentSpec.scala b/akka-stm/src/test/scala/agent/AgentSpec.scala index 4bfafecb75..7049be6c62 100644 --- a/akka-stm/src/test/scala/agent/AgentSpec.scala +++ b/akka-stm/src/test/scala/agent/AgentSpec.scala @@ -20,7 +20,7 @@ class CountDownFunction[A](num: Int = 1) extends Function1[A, A] { class AgentSpec extends WordSpec with MustMatchers { - implicit val application = AkkaApplication("AgentSpec") + implicit val app = AkkaApplication("AgentSpec") implicit val timeout = Timeout(5.seconds.dilated) "Agent" should { diff --git a/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala b/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala index ad8720d397..5bfc4131d6 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestActorRef.scala @@ -42,17 +42,17 @@ class TestActorRef[T <: Actor](_app: AkkaApplication, props: Props, address: Str object TestActorRef { - def apply[T <: Actor](factory: ⇒ T)(implicit application: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), new UUID().toString) + def apply[T <: Actor](factory: ⇒ T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), new UUID().toString) - def apply[T <: Actor](factory: ⇒ T, address: String)(implicit application: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), address) + def apply[T <: Actor](factory: ⇒ T, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), address) - def apply[T <: Actor](props: Props)(implicit application: AkkaApplication): TestActorRef[T] = apply[T](props, new UUID().toString) + def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, new UUID().toString) - def apply[T <: Actor](props: Props, address: String)(implicit application: AkkaApplication): TestActorRef[T] = new TestActorRef(application, props, address) + def apply[T <: Actor](props: Props, address: String)(implicit app: AkkaApplication): TestActorRef[T] = new TestActorRef(app, props, address) - def apply[T <: Actor](implicit m: Manifest[T], application: AkkaApplication): TestActorRef[T] = apply[T](new UUID().toString) + def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](new UUID().toString) - def apply[T <: Actor](address: String)(implicit m: Manifest[T], application: AkkaApplication): TestActorRef[T] = apply[T](Props({ + def apply[T <: Actor](address: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({ import ReflectiveAccess.{ createInstance, noParams, noArgs } createInstance[T](m.erasure, noParams, noArgs) match { case Right(value) ⇒ value diff --git a/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala b/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala index acbb434cdc..5dee240f36 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestFSMRef.scala @@ -34,8 +34,8 @@ import akka.AkkaApplication * @author Roland Kuhn * @since 1.2 */ -class TestFSMRef[S, D, T <: Actor](application: AkkaApplication, props: Props, address: String)(implicit ev: T <:< FSM[S, D]) - extends TestActorRef(application, props, address) { +class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, address: String)(implicit ev: T <:< FSM[S, D]) + extends TestActorRef(app, props, address) { private def fsm: T = underlyingActor @@ -80,9 +80,9 @@ class TestFSMRef[S, D, T <: Actor](application: AkkaApplication, props: Props, a object TestFSMRef { - def apply[S, D, T <: Actor](factory: ⇒ T)(implicit ev: T <:< FSM[S, D], application: AkkaApplication): TestFSMRef[S, D, T] = - new TestFSMRef(application, Props(creator = () ⇒ factory), new UUID().toString) + def apply[S, D, T <: Actor](factory: ⇒ T)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = + new TestFSMRef(app, Props(creator = () ⇒ factory), new UUID().toString) - def apply[S, D, T <: Actor](factory: ⇒ T, address: String)(implicit ev: T <:< FSM[S, D], application: AkkaApplication): TestFSMRef[S, D, T] = - new TestFSMRef(application, Props(creator = () ⇒ factory), address) + def apply[S, D, T <: Actor](factory: ⇒ T, address: String)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = + new TestFSMRef(app, Props(creator = () ⇒ factory), address) } diff --git a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala index 5fa8d136f1..c3411fc3de 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala @@ -576,7 +576,7 @@ class TestProbe(_application: AkkaApplication) extends TestKit(_application) { } object TestProbe { - def apply()(implicit application: AkkaApplication) = new TestProbe(application) + def apply()(implicit app: AkkaApplication) = new TestProbe(app) } trait ImplicitSender { this: TestKit ⇒