rename application to app everywhere to make it consistent

This commit is contained in:
Roland 2011-10-13 14:23:44 +02:00
parent 44b94643e5
commit 9e8091459b
29 changed files with 104 additions and 104 deletions

View file

@ -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

View file

@ -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)

View file

@ -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 {

View file

@ -148,7 +148,7 @@ abstract class ActorRef extends ActorRefShared with UntypedChannel with ReplyCha
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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

View file

@ -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)

View file

@ -246,17 +246,17 @@ object DeploymentConfig {
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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)

View file

@ -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_?

View file

@ -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))

View file

@ -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)),

View file

@ -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)
}

View file

@ -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

View file

@ -119,7 +119,7 @@ object ReflectiveAccess {
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
class ReflectiveAccess(val application: AkkaApplication) {
class ReflectiveAccess(val app: AkkaApplication) {
import ReflectiveAccess._
@ -129,7 +129,7 @@ class ReflectiveAccess(val application: AkkaApplication) {
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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 <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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
}
}

View file

@ -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

View file

@ -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
}

View file

@ -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
*/

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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

View file

@ -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
}

View file

@ -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]

View file

@ -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")

View file

@ -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")

View file

@ -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")

View file

@ -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:

View file

@ -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 {

View file

@ -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

View file

@ -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)
}

View file

@ -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