From 80adb71850427aa3a3d9cc4e0f30eb7d49c8cc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Mon, 22 Nov 2010 08:59:45 +0100 Subject: [PATCH 1/7] Fixed bug in ActorRegistry getting typed actor by manifest --- .../main/scala/akka/actor/ActorRegistry.scala | 101 +++++++----------- .../ExecutorBasedEventDrivenDispatcher.scala | 10 +- .../scala/akka/dispatch/MailboxHandling.scala | 16 +-- .../scala/akka/util/ReflectiveAccess.scala | 58 +++++----- .../scala/akka/misc/ActorRegistrySpec.scala | 1 - .../typed-actor/TypedActorRegistrySpec.scala | 26 +++++ 6 files changed, 106 insertions(+), 106 deletions(-) create mode 100644 akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorRegistrySpec.scala diff --git a/akka-actor/src/main/scala/akka/actor/ActorRegistry.scala b/akka-actor/src/main/scala/akka/actor/ActorRegistry.scala index bf0a479f7f..aebfe70d85 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorRegistry.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorRegistry.scala @@ -37,10 +37,10 @@ case class ActorUnregistered(actor: ActorRef) extends ActorRegistryEvent * @author Jonas Bonér */ object ActorRegistry extends ListenerManagement { - private val actorsByUUID = new ConcurrentHashMap[Uuid, ActorRef] - private val actorsById = new Index[String,ActorRef] - private val remoteActorSets = Map[Address, RemoteActorSet]() - private val guard = new ReadWriteGuard + private val actorsByUUID = new ConcurrentHashMap[Uuid, ActorRef] + private val actorsById = new Index[String,ActorRef] + private val remoteActorSets = Map[Address, RemoteActorSet]() + private val guard = new ReadWriteGuard /** * Returns all actors in the system. @@ -50,7 +50,7 @@ object ActorRegistry extends ListenerManagement { /** * Returns the number of actors in the system. */ - def size : Int = actorsByUUID.size + def size: Int = actorsByUUID.size /** * Invokes a function for all actors. @@ -68,8 +68,7 @@ object ActorRegistry extends ListenerManagement { val elements = actorsByUUID.elements while (elements.hasMoreElements) { val element = elements.nextElement - if(f isDefinedAt element) - return Some(f(element)) + if (f isDefinedAt element) return Some(f(element)) } None } @@ -88,9 +87,7 @@ object ActorRegistry extends ListenerManagement { val elements = actorsByUUID.elements while (elements.hasMoreElements) { val actorId = elements.nextElement - if (p(actorId)) { - all += actorId - } + if (p(actorId)) all += actorId } all.toArray } @@ -105,7 +102,7 @@ object ActorRegistry extends ListenerManagement { * Finds any actor that matches T. */ def actorFor[T <: Actor](implicit manifest: Manifest[T]): Option[ActorRef] = - find({ case a:ActorRef if manifest.erasure.isAssignableFrom(a.actor.getClass) => a }) + find({ case a: ActorRef if manifest.erasure.isAssignableFrom(a.actor.getClass) => a }) /** * Finds all actors of type or sub-type specified by the class passed in as the Class argument. @@ -132,13 +129,11 @@ object ActorRegistry extends ListenerManagement { * Invokes a function for all typed actors. */ def foreachTypedActor(f: (AnyRef) => Unit) = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled val elements = actorsByUUID.elements while (elements.hasMoreElements) { val proxy = typedActorFor(elements.nextElement) - if (proxy.isDefined) { - f(proxy.get) - } + if (proxy.isDefined) f(proxy.get) } } @@ -147,12 +142,11 @@ object ActorRegistry extends ListenerManagement { * Returns None if the function never returns Some */ def findTypedActor[T](f: PartialFunction[AnyRef,T]) : Option[T] = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled val elements = actorsByUUID.elements while (elements.hasMoreElements) { val proxy = typedActorFor(elements.nextElement) - if(proxy.isDefined && (f isDefinedAt proxy)) - return Some(f(proxy)) + if (proxy.isDefined && (f isDefinedAt proxy)) return Some(f(proxy)) } None } @@ -161,14 +155,12 @@ object ActorRegistry extends ListenerManagement { * Finds all typed actors that satisfy a predicate. */ def filterTypedActors(p: AnyRef => Boolean): Array[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled val all = new ListBuffer[AnyRef] val elements = actorsByUUID.elements while (elements.hasMoreElements) { val proxy = typedActorFor(elements.nextElement) - if (proxy.isDefined && p(proxy.get)) { - all += proxy.get - } + if (proxy.isDefined && p(proxy.get)) all += proxy.get } all.toArray } @@ -177,7 +169,7 @@ object ActorRegistry extends ListenerManagement { * Finds all typed actors that are subtypes of the class passed in as the Manifest argument. */ def typedActorsFor[T <: AnyRef](implicit manifest: Manifest[T]): Array[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled typedActorsFor[T](manifest.erasure.asInstanceOf[Class[T]]) } @@ -185,20 +177,20 @@ object ActorRegistry extends ListenerManagement { * Finds any typed actor that matches T. */ def typedActorFor[T <: AnyRef](implicit manifest: Manifest[T]): Option[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled - def predicate(proxy: AnyRef) : Boolean = { + TypedActorModule.ensureEnabled + def predicate(proxy: AnyRef): Boolean = { val actorRef = TypedActorModule.typedActorObjectInstance.get.actorFor(proxy) actorRef.isDefined && manifest.erasure.isAssignableFrom(actorRef.get.actor.getClass) } - findTypedActor({ case a:AnyRef if predicate(a) => a }) + findTypedActor({ case a: Some[AnyRef] if predicate(a.get) => a }) } /** * Finds all typed actors of type or sub-type specified by the class passed in as the Class argument. */ def typedActorsFor[T <: AnyRef](clazz: Class[T]): Array[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled - def predicate(proxy: AnyRef) : Boolean = { + TypedActorModule.ensureEnabled + def predicate(proxy: AnyRef): Boolean = { val actorRef = TypedActorModule.typedActorObjectInstance.get.actorFor(proxy) actorRef.isDefined && clazz.isAssignableFrom(actorRef.get.actor.getClass) } @@ -209,7 +201,7 @@ object ActorRegistry extends ListenerManagement { * Finds all typed actors that have a specific id. */ def typedActorsFor(id: String): Array[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled val actorRefs = actorsById values id actorRefs.flatMap(typedActorFor(_)) } @@ -218,12 +210,10 @@ object ActorRegistry extends ListenerManagement { * Finds the typed actor that has a specific UUID. */ def typedActorFor(uuid: Uuid): Option[AnyRef] = { - TypedActorModule.ensureTypedActorEnabled + TypedActorModule.ensureEnabled val actorRef = actorsByUUID get uuid - if (actorRef eq null) - None - else - typedActorFor(actorRef) + if (actorRef eq null) None + else typedActorFor(actorRef) } /** @@ -265,20 +255,15 @@ object ActorRegistry extends ListenerManagement { */ def shutdownAll() { log.info("Shutting down all actors in the system...") - if (TypedActorModule.isTypedActorEnabled) { + if (TypedActorModule.isEnabled) { val elements = actorsByUUID.elements while (elements.hasMoreElements) { val actorRef = elements.nextElement val proxy = typedActorFor(actorRef) - if (proxy.isDefined) { - TypedActorModule.typedActorObjectInstance.get.stop(proxy.get) - } else { - actorRef.stop - } + if (proxy.isDefined) TypedActorModule.typedActorObjectInstance.get.stop(proxy.get) + else actorRef.stop } - } else { - foreach(_.stop) - } + } else foreach(_.stop) actorsByUUID.clear actorsById.clear log.info("All actors have been shut down and unregistered from ActorRegistry") @@ -337,16 +322,13 @@ class Index[K <: AnyRef,V <: AnyRef : Manifest] { if (set ne null) { set.synchronized { - if (set.isEmpty) { - retry = true //IF the set is empty then it has been removed, so signal retry - } + if (set.isEmpty) retry = true //IF the set is empty then it has been removed, so signal retry else { //Else add the value to the set and signal that retry is not needed added = set add v retry = false } } - } - else { + } else { val newSet = new ConcurrentSkipListSet[V] newSet add v @@ -354,24 +336,20 @@ class Index[K <: AnyRef,V <: AnyRef : Manifest] { val oldSet = container.putIfAbsent(k,newSet) if (oldSet ne null) { oldSet.synchronized { - if (oldSet.isEmpty) { - retry = true //IF the set is empty then it has been removed, so signal retry - } + if (oldSet.isEmpty) retry = true //IF the set is empty then it has been removed, so signal retry else { //Else try to add the value to the set and signal that retry is not needed added = oldSet add v retry = false } } - } else { - added = true - } + } else added = true } - if (retry) spinPut(k,v) + if (retry) spinPut(k, v) else added } - spinPut(key,value) + spinPut(key, value) } /** @@ -390,10 +368,8 @@ class Index[K <: AnyRef,V <: AnyRef : Manifest] { def findValue(key: K)(f: (V) => Boolean): Option[V] = { import scala.collection.JavaConversions._ val set = container get key - if (set ne null) - set.iterator.find(f) - else - None + if (set ne null) set.iterator.find(f) + else None } /** @@ -420,8 +396,7 @@ class Index[K <: AnyRef,V <: AnyRef : Manifest] { container.remove(key,emptySet) //We try to remove the key if it's mapped to an empty set true //Remove succeeded - } - else false //Remove failed + } else false //Remove failed } } else false //Remove failed } @@ -434,5 +409,5 @@ class Index[K <: AnyRef,V <: AnyRef : Manifest] { /** * Removes all keys and all values */ - def clear = foreach { case (k,v) => remove(k,v) } + def clear = foreach { case (k, v) => remove(k, v) } } diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala index 83ff50427a..ee5dd890b8 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala @@ -5,7 +5,7 @@ package akka.dispatch import akka.actor.{ActorRef, IllegalActorStateException} -import akka.util.ReflectiveAccess.EnterpriseModule +import akka.util.ReflectiveAccess.AkkaCloudModule import java.util.Queue import akka.util.Switch @@ -123,10 +123,10 @@ class ExecutorBasedEventDrivenDispatcher( */ def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = mailboxType match { // FIXME make generic (work for TypedActor as well) - case FileBasedDurableMailbox(serializer) => EnterpriseModule.createFileBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case ZooKeeperBasedDurableMailbox(serializer) => EnterpriseModule.createZooKeeperBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case BeanstalkBasedDurableMailbox(serializer) => EnterpriseModule.createBeanstalkBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case RedisBasedDurableMailbox(serializer) => EnterpriseModule.createRedisBasedMailbox(actorRef).asInstanceOf[MessageQueue] + case FileBasedDurableMailbox(serializer) => AkkaCloudModule.createFileBasedMailbox(actorRef).asInstanceOf[MessageQueue] + case ZooKeeperBasedDurableMailbox(serializer) => AkkaCloudModule.createZooKeeperBasedMailbox(actorRef).asInstanceOf[MessageQueue] + case BeanstalkBasedDurableMailbox(serializer) => AkkaCloudModule.createBeanstalkBasedMailbox(actorRef).asInstanceOf[MessageQueue] + case RedisBasedDurableMailbox(serializer) => AkkaCloudModule.createRedisBasedMailbox(actorRef).asInstanceOf[MessageQueue] case AMQPBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("AMQPBasedDurableMailbox is not yet supported") case JMSBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("JMSBasedDurableMailbox is not yet supported") } diff --git a/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala b/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala index ff71b607ce..7e81d4a598 100644 --- a/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala +++ b/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala @@ -5,7 +5,7 @@ package akka.dispatch import akka.actor.{Actor, ActorType, ActorRef, ActorInitializationException} -import akka.util.ReflectiveAccess.EnterpriseModule +import akka.util.ReflectiveAccess.AkkaCloudModule import akka.AkkaException import java.util.{Queue, List} @@ -42,15 +42,15 @@ case class BoundedMailbox( if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null") } -abstract class DurableMailboxType(val serializer: EnterpriseModule.Serializer) extends MailboxType { +abstract class DurableMailboxType(val serializer: AkkaCloudModule.Serializer) extends MailboxType { if (serializer eq null) throw new IllegalArgumentException("The serializer for DurableMailboxType can not be null") } -case class FileBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) -case class RedisBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) -case class BeanstalkBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) -case class ZooKeeperBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) -case class AMQPBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) -case class JMSBasedDurableMailbox(ser: EnterpriseModule.Serializer) extends DurableMailboxType(ser) +case class FileBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class RedisBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class BeanstalkBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class ZooKeeperBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class AMQPBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class JMSBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) class DefaultUnboundedMessageQueue(blockDequeue: Boolean) extends LinkedBlockingQueue[MessageInvocation] with MessageQueue { diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index 5257d596f0..b5a4c7edb7 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -20,13 +20,13 @@ object ReflectiveAccess extends Logging { val loader = getClass.getClassLoader - lazy val isRemotingEnabled = RemoteClientModule.isRemotingEnabled - lazy val isTypedActorEnabled = TypedActorModule.isTypedActorEnabled - lazy val isEnterpriseEnabled = EnterpriseModule.isEnterpriseEnabled + lazy val isRemotingEnabled = RemoteClientModule.isEnabled + lazy val isTypedActorEnabled = TypedActorModule.isEnabled + lazy val isAkkaCloudEnabled = AkkaCloudModule.isEnabled - def ensureRemotingEnabled = RemoteClientModule.ensureRemotingEnabled - def ensureTypedActorEnabled = TypedActorModule.ensureTypedActorEnabled - def ensureEnterpriseEnabled = EnterpriseModule.ensureEnterpriseEnabled + def ensureRemotingEnabled = RemoteClientModule.ensureEnabled + def ensureTypedActorEnabled = TypedActorModule.ensureEnabled + def ensureAkkaCloudEnabled = AkkaCloudModule.ensureEnabled /** * Reflective access to the RemoteClient module. @@ -56,32 +56,32 @@ object ReflectiveAccess extends Logging { def clientFor(hostname: String, port: Int, loader: Option[ClassLoader]): RemoteClient } - lazy val isRemotingEnabled = remoteClientObjectInstance.isDefined + lazy val isEnabled = remoteClientObjectInstance.isDefined - def ensureRemotingEnabled = if (!isRemotingEnabled) throw new ModuleNotAvailableException( + def ensureEnabled = if (!isEnabled) throw new ModuleNotAvailableException( "Can't load the remoting module, make sure that akka-remote.jar is on the classpath") val remoteClientObjectInstance: Option[RemoteClientObject] = getObjectFor("akka.remote.RemoteClient$") def register(address: InetSocketAddress, uuid: Uuid) = { - ensureRemotingEnabled + ensureEnabled remoteClientObjectInstance.get.register(address.getHostName, address.getPort, uuid) } def unregister(address: InetSocketAddress, uuid: Uuid) = { - ensureRemotingEnabled + ensureEnabled remoteClientObjectInstance.get.unregister(address.getHostName, address.getPort, uuid) } def registerSupervisorForActor(remoteAddress: InetSocketAddress, actorRef: ActorRef) = { - ensureRemotingEnabled + ensureEnabled val remoteClient = remoteClientObjectInstance.get.clientFor(remoteAddress) remoteClient.registerSupervisorForActor(actorRef) } def clientFor(hostname: String, port: Int, loader: Option[ClassLoader]): RemoteClient = { - ensureRemotingEnabled + ensureEnabled remoteClientObjectInstance.get.clientFor(hostname, port, loader) } @@ -95,7 +95,7 @@ object ReflectiveAccess extends Logging { actorRef: ActorRef, typedActorInfo: Option[Tuple2[String, String]], actorType: ActorType): Option[CompletableFuture[T]] = { - ensureRemotingEnabled + ensureEnabled clientFor(remoteAddress.getHostName, remoteAddress.getPort, None).send[T]( message, senderOption, senderFuture, remoteAddress, timeout, isOneWay, actorRef, typedActorInfo, actorType) } @@ -126,17 +126,17 @@ object ReflectiveAccess extends Logging { getObjectFor("akka.remote.RemoteNode$") def registerActor(address: InetSocketAddress, actorRef: ActorRef) = { - ensureRemotingEnabled + RemoteClientModule.ensureEnabled remoteServerObjectInstance.get.registerActor(address, actorRef) } def registerTypedActor(address: InetSocketAddress, implementationClassName: String, proxy: AnyRef) = { - ensureRemotingEnabled + RemoteClientModule.ensureEnabled remoteServerObjectInstance.get.registerTypedActor(address, implementationClassName, proxy) } def unregister(actorRef: ActorRef) = { - ensureRemotingEnabled + RemoteClientModule.ensureEnabled remoteNodeObjectInstance.get.unregister(actorRef) } } @@ -156,16 +156,16 @@ object ReflectiveAccess extends Logging { def stop(anyRef: AnyRef) : Unit } - lazy val isTypedActorEnabled = typedActorObjectInstance.isDefined + lazy val isEnabled = typedActorObjectInstance.isDefined - def ensureTypedActorEnabled = if (!isTypedActorEnabled) throw new ModuleNotAvailableException( + def ensureEnabled = if (!isTypedActorEnabled) throw new ModuleNotAvailableException( "Can't load the typed actor module, make sure that akka-typed-actor.jar is on the classpath") val typedActorObjectInstance: Option[TypedActorObject] = getObjectFor("akka.actor.TypedActor$") def resolveFutureIfMessageIsJoinPoint(message: Any, future: Future[_]): Boolean = { - ensureTypedActorEnabled + ensureEnabled if (typedActorObjectInstance.get.isJoinPointAndOneWay(message)) { future.asInstanceOf[CompletableFuture[Option[_]]].completeWithResult(None) } @@ -173,7 +173,7 @@ object ReflectiveAccess extends Logging { } } - object EnterpriseModule { + object AkkaCloudModule { type Mailbox = { def enqueue(message: MessageInvocation) @@ -185,27 +185,27 @@ object ReflectiveAccess extends Logging { def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef } - lazy val isEnterpriseEnabled = clusterObjectInstance.isDefined + lazy val isEnabled = clusterObjectInstance.isDefined val clusterObjectInstance: Option[AnyRef] = - getObjectFor("akka.cluster.Cluster$") + getObjectFor("akka.cloud.cluster.Cluster$") val serializerClass: Option[Class[_]] = getClassFor("akka.serialization.Serializer") - def ensureEnterpriseEnabled = if (!isEnterpriseEnabled) throw new ModuleNotAvailableException( - "Feature is only available in Akka Enterprise edition") + def ensureEnabled = if (!isEnabled) throw new ModuleNotAvailableException( + "Feature is only available in Akka Cloud") - def createFileBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.actor.mailbox.FileBasedMailbox", actorRef) + def createFileBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.FileBasedMailbox", actorRef) - def createZooKeeperBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.actor.mailbox.ZooKeeperBasedMailbox", actorRef) + def createZooKeeperBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.ZooKeeperBasedMailbox", actorRef) - def createBeanstalkBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.actor.mailbox.BeanstalkBasedMailbox", actorRef) + def createBeanstalkBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.BeanstalkBasedMailbox", actorRef) - def createRedisBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.actor.mailbox.RedisBasedMailbox", actorRef) + def createRedisBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.RedisBasedMailbox", actorRef) private def createMailbox(mailboxClassname: String, actorRef: ActorRef): Mailbox = { - ensureEnterpriseEnabled + ensureEnabled createInstance( mailboxClassname, Array(classOf[ActorRef]), diff --git a/akka-actor/src/test/scala/akka/misc/ActorRegistrySpec.scala b/akka-actor/src/test/scala/akka/misc/ActorRegistrySpec.scala index 6148b04f53..f951281f2e 100644 --- a/akka-actor/src/test/scala/akka/misc/ActorRegistrySpec.scala +++ b/akka-actor/src/test/scala/akka/misc/ActorRegistrySpec.scala @@ -27,7 +27,6 @@ object ActorRegistrySpec { self.reply("got ping") } } - } class ActorRegistrySpec extends JUnitSuite { diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorRegistrySpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorRegistrySpec.scala new file mode 100644 index 0000000000..31c17a725d --- /dev/null +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorRegistrySpec.scala @@ -0,0 +1,26 @@ +package akka.actor + +import org.scalatest.junit.JUnitSuite +import org.junit.Test + +object TypedActorRegistrySpec { + trait My + class MyImpl extends TypedActor with My +} + +class TypedActorRegistrySpec extends JUnitSuite { + import TypedActorRegistrySpec._ + + @Test def shouldGetTypedActorByClassFromActorRegistry { + ActorRegistry.shutdownAll + val my = TypedActor.newInstance[My](classOf[My], classOf[MyImpl], 3000) + + val actors = ActorRegistry.typedActorsFor(classOf[My]) + assert(actors.length === 1) + + val option = ActorRegistry.typedActorFor[My] + assert(option != null) + assert(option.isDefined) + ActorRegistry.shutdownAll + } +} From 1ee3a54372cf31bbfc618aa3d5791bc68686b7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Mon, 22 Nov 2010 15:32:54 +0100 Subject: [PATCH 2/7] Fixed issues with config - Ticket #535 --- .../src/main/scala/akka/config/Config.scala | 2 +- .../src/main/scala/akka/CamelService.scala | 2 +- .../src/main/scala/akka/AkkaBroadcaster.scala | 2 +- .../main/scala/akka/AkkaCometServlet.scala | 8 ++-- .../main/scala/akka/EmbeddedAppServer.scala | 23 +++++----- .../src/main/scala/akka/ListWriter.scala | 5 ++- akka-http/src/main/scala/akka/Security.scala | 18 ++++---- .../scala/akka/CassandraStorageBackend.scala | 6 +-- .../scala/akka/CouchDBStorageBackend.scala | 4 +- .../main/scala/akka/HbaseStorageBackend.scala | 2 +- .../SimpleHbaseSpecTestIntegration.scala | 2 +- .../scala/akka/MemcachedStorageBackend.scala | 4 +- .../main/scala/akka/MongoStorageBackend.scala | 6 +-- .../main/scala/akka/RedisStorageBackend.scala | 6 +-- .../main/scala/akka/RiakStorageBackend.scala | 12 ++--- .../scala/akka/SimpledbStorageBackend.scala | 30 ++++++------- .../scala/akka/VoldemortStorageBackend.scala | 10 ++--- .../remote/BootableRemoteActorService.scala | 4 +- .../main/scala/akka/remote/RemoteServer.scala | 4 +- .../src/main/scala/SimpleService.scala | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- config/akka-reference.conf | 44 ++++++++----------- 22 files changed, 97 insertions(+), 101 deletions(-) diff --git a/akka-actor/src/main/scala/akka/config/Config.scala b/akka-actor/src/main/scala/akka/config/Config.scala index 0571449b67..371e61b640 100644 --- a/akka-actor/src/main/scala/akka/config/Config.scala +++ b/akka-actor/src/main/scala/akka/config/Config.scala @@ -69,7 +69,7 @@ object Config { "\n\tdue to: " + e.toString) } Configgy.config - } else if (HOME.isDefined) { + } else if (HOME.isDefined) { try { val configFile = HOME.getOrElse(throwNoAkkaHomeException) + "/config/" + confName Configgy.configure(configFile) diff --git a/akka-camel/src/main/scala/akka/CamelService.scala b/akka-camel/src/main/scala/akka/CamelService.scala index b546636610..da71701ae1 100644 --- a/akka-camel/src/main/scala/akka/CamelService.scala +++ b/akka-camel/src/main/scala/akka/CamelService.scala @@ -26,7 +26,7 @@ trait CamelService extends Bootable with Logging { private[camel] val consumerPublisher = actorOf[ConsumerPublisher] private[camel] val publishRequestor = actorOf[PublishRequestor] - private val serviceEnabled = config.getBool("akka.camel.service", true) + private val serviceEnabled = config.getList("akka.enabled-modules").exists(_ == "camel") /** * Starts this CamelService unless akka.camel.service is set to false. diff --git a/akka-http/src/main/scala/akka/AkkaBroadcaster.scala b/akka-http/src/main/scala/akka/AkkaBroadcaster.scala index fd0f76631a..4da1a1fda5 100644 --- a/akka-http/src/main/scala/akka/AkkaBroadcaster.scala +++ b/akka-http/src/main/scala/akka/AkkaBroadcaster.scala @@ -12,7 +12,7 @@ import akka.dispatch.Dispatchers import org.atmosphere.jersey.util.JerseyBroadcasterUtil object AkkaBroadcaster { - val broadcasterDispatcher = Dispatchers.fromConfig("akka.rest.comet-dispatcher") + val broadcasterDispatcher = Dispatchers.fromConfig("akka.http.comet-dispatcher") type Event = AtmosphereResourceEvent[_,_] type Resource = AtmosphereResource[_,_] diff --git a/akka-http/src/main/scala/akka/AkkaCometServlet.scala b/akka-http/src/main/scala/akka/AkkaCometServlet.scala index 5b15096c92..0c651bc776 100644 --- a/akka-http/src/main/scala/akka/AkkaCometServlet.scala +++ b/akka-http/src/main/scala/akka/AkkaCometServlet.scala @@ -51,11 +51,11 @@ class AkkaServlet extends AtmosphereServlet { addInitParameter(AtmosphereServlet.DISABLE_ONSTATE_EVENT,"true") addInitParameter(AtmosphereServlet.BROADCASTER_CLASS,classOf[AkkaBroadcaster].getName) addInitParameter(AtmosphereServlet.PROPERTY_USE_STREAM,"true") - addInitParameter("com.sun.jersey.config.property.packages",c.getList("akka.rest.resource_packages").mkString(";")) - addInitParameter("com.sun.jersey.spi.container.ResourceFilters",c.getList("akka.rest.filters").mkString(",")) + addInitParameter("com.sun.jersey.config.property.packages",c.getList("akka.http.resource_packages").mkString(";")) + addInitParameter("com.sun.jersey.spi.container.ResourceFilters",c.getList("akka.http.filters").mkString(",")) - c.getInt("akka.rest.maxInactiveActivity") foreach { value => addInitParameter(CometSupport.MAX_INACTIVE,value.toString) } - c.getString("akka.rest.cometSupport") foreach { value => addInitParameter("cometSupport",value) } + c.getInt("akka.http.maxInactiveActivity") foreach { value => addInitParameter(CometSupport.MAX_INACTIVE,value.toString) } + c.getString("akka.http.cometSupport") foreach { value => addInitParameter("cometSupport",value) } /* * Provide a fallback for default values diff --git a/akka-http/src/main/scala/akka/EmbeddedAppServer.scala b/akka-http/src/main/scala/akka/EmbeddedAppServer.scala index ea68bf1106..db5761eb29 100644 --- a/akka-http/src/main/scala/akka/EmbeddedAppServer.scala +++ b/akka-http/src/main/scala/akka/EmbeddedAppServer.scala @@ -20,23 +20,25 @@ import org.eclipse.jetty.server.handler.{HandlerList, HandlerCollection, Context * Handles the Akka Comet Support (load/unload) */ trait EmbeddedAppServer extends Bootable with Logging { - self : BootableActorLoaderService => + self: BootableActorLoaderService => import akka.config.Config._ - val REST_HOSTNAME = config.getString("akka.rest.hostname", "localhost") - val REST_PORT = config.getInt("akka.rest.port", 9998) + val REST_HOSTNAME = config.getString("akka.http.hostname", "localhost") + val REST_PORT = config.getInt("akka.http.port", 9998) + + val isRestEnabled = config.getList("akka.enabled-modules").exists(_ == "http") protected var server: Option[Server] = None abstract override def onLoad = { super.onLoad - if (config.getBool("akka.rest.service", true)) { - log.info("Attempting to start Akka REST service (Jersey)") + if (isRestEnabled) { + log.info("Attempting to start Akka HTTP service") - System.setProperty("jetty.port",REST_PORT.toString) - System.setProperty("jetty.host",REST_HOSTNAME) - System.setProperty("jetty.home",HOME.getOrElse(throwNoAkkaHomeException) + "/deploy/root") + System.setProperty("jetty.port", REST_PORT.toString) + System.setProperty("jetty.host", REST_HOSTNAME) + System.setProperty("jetty.home", HOME.getOrElse(throwNoAkkaHomeException) + "/deploy/root") val configuration = new XmlConfiguration( new File(HOME.getOrElse(throwNoAkkaHomeException) + "/config/microkernel-server.xml").toURI.toURL) @@ -57,16 +59,15 @@ trait EmbeddedAppServer extends Bootable with Logging { s.start() s } - log.info("Akka REST service started (Jersey)") + log.info("Akka HTTP service started") } } abstract override def onUnload = { super.onUnload - server foreach { t => { + server foreach { t => log.info("Shutting down REST service (Jersey)") t.stop() - } } } } diff --git a/akka-http/src/main/scala/akka/ListWriter.scala b/akka-http/src/main/scala/akka/ListWriter.scala index 3a2c69d02a..b2addd6cd7 100644 --- a/akka-http/src/main/scala/akka/ListWriter.scala +++ b/akka-http/src/main/scala/akka/ListWriter.scala @@ -1,10 +1,11 @@ /** * Copyright (C) 2009-2010 Scalable Solutions AB */ -package akka.rest +package akka.http + +import akka.serialization.Serializer import java.io.OutputStream -import akka.serialization.Serializer import javax.ws.rs.core.{MultivaluedMap, MediaType} import javax.ws.rs.ext.{MessageBodyWriter, Provider} import javax.ws.rs.Produces diff --git a/akka-http/src/main/scala/akka/Security.scala b/akka-http/src/main/scala/akka/Security.scala index b6aec9a1f0..e9152970fa 100644 --- a/akka-http/src/main/scala/akka/Security.scala +++ b/akka-http/src/main/scala/akka/Security.scala @@ -101,8 +101,8 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging { } lazy val authenticatorFQN = { - val auth = Config.config.getString("akka.rest.authenticator", "N/A") - if (auth == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.authenticator' is not defined in 'akka.conf'") + val auth = Config.config.getString("akka.http.authenticator", "N/A") + if (auth == "N/A") throw new IllegalActorStateException("The config option 'akka.http.authenticator' is not defined in 'akka.conf'") auth } @@ -399,8 +399,8 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w * principal name for the HTTP kerberos service, i.e HTTP/ { server } @ { realm } */ lazy val servicePrincipal = { - val p = Config.config.getString("akka.rest.kerberos.servicePrincipal", "N/A") - if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.servicePrincipal' is not defined in 'akka.conf'") + val p = Config.config.getString("akka.http.kerberos.servicePrincipal", "N/A") + if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.http.kerberos.servicePrincipal' is not defined in 'akka.conf'") p } @@ -408,21 +408,21 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w * keytab location with credentials for the service principal */ lazy val keyTabLocation = { - val p = Config.config.getString("akka.rest.kerberos.keyTabLocation", "N/A") - if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.keyTabLocation' is not defined in 'akka.conf'") + val p = Config.config.getString("akka.http.kerberos.keyTabLocation", "N/A") + if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.http.kerberos.keyTabLocation' is not defined in 'akka.conf'") p } lazy val kerberosDebug = { - val p = Config.config.getString("akka.rest.kerberos.kerberosDebug", "N/A") - if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.kerberosDebug' is not defined in 'akka.conf'") + val p = Config.config.getString("akka.http.kerberos.kerberosDebug", "N/A") + if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.http.kerberos.kerberosDebug' is not defined in 'akka.conf'") p } /** * is not used by this authenticator, so accept an empty value */ - lazy val realm = Config.config.getString("akka.rest.kerberos.realm", "") + lazy val realm = Config.config.getString("akka.http.kerberos.realm", "") /** * verify the kerberos token from a client with the server diff --git a/akka-persistence/akka-persistence-cassandra/src/main/scala/akka/CassandraStorageBackend.scala b/akka-persistence/akka-persistence-cassandra/src/main/scala/akka/CassandraStorageBackend.scala index a4eb481215..d077215a7f 100644 --- a/akka-persistence/akka-persistence-cassandra/src/main/scala/akka/CassandraStorageBackend.scala +++ b/akka-persistence/akka-persistence-cassandra/src/main/scala/akka/CassandraStorageBackend.scala @@ -34,10 +34,10 @@ private[akka] object CassandraStorageBackend extends CommonStorageBackend { val REF_KEY = "item".getBytes("UTF-8") val EMPTY_BYTE_ARRAY = new Array[Byte](0) - val CASSANDRA_SERVER_HOSTNAME = config.getString("akka.storage.cassandra.hostname", "127.0.0.1") - val CASSANDRA_SERVER_PORT = config.getInt("akka.storage.cassandra.port", 9160) + val CASSANDRA_SERVER_HOSTNAME = config.getString("akka.persistence.cassandra.hostname", "127.0.0.1") + val CASSANDRA_SERVER_PORT = config.getInt("akka.persistence.cassandra.port", 9160) val CONSISTENCY_LEVEL = { - config.getString("akka.storage.cassandra.consistency-level", "QUORUM") match { + config.getString("akka.persistence.cassandra.consistency-level", "QUORUM") match { case "ZERO" => ConsistencyLevel.ZERO case "ONE" => ConsistencyLevel.ONE case "QUORUM" => ConsistencyLevel.QUORUM diff --git a/akka-persistence/akka-persistence-couchdb/src/main/scala/akka/CouchDBStorageBackend.scala b/akka-persistence/akka-persistence-couchdb/src/main/scala/akka/CouchDBStorageBackend.scala index 780222535d..e86ad9bfd1 100644 --- a/akka-persistence/akka-persistence-couchdb/src/main/scala/akka/CouchDBStorageBackend.scala +++ b/akka-persistence/akka-persistence-couchdb/src/main/scala/akka/CouchDBStorageBackend.scala @@ -31,8 +31,8 @@ private [akka] object CouchDBStorageBackend extends } lazy val URL = config. - getString("akka.storage.couchdb.url"). - getOrElse(throw new IllegalArgumentException("'akka.storage.couchdb.url' not found in config")) + getString("akka.persistence.couchdb.url"). + getOrElse(throw new IllegalArgumentException("'akka.persistence.couchdb.url' not found in config")) def drop() = { val client = new HttpClient() diff --git a/akka-persistence/akka-persistence-hbase/src/main/scala/akka/HbaseStorageBackend.scala b/akka-persistence/akka-persistence-hbase/src/main/scala/akka/HbaseStorageBackend.scala index 2b33876ecf..7e3d750803 100644 --- a/akka-persistence/akka-persistence-hbase/src/main/scala/akka/HbaseStorageBackend.scala +++ b/akka-persistence/akka-persistence-hbase/src/main/scala/akka/HbaseStorageBackend.scala @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.util.Bytes */ private[akka] object HbaseStorageBackend extends MapStorageBackend[Array[Byte], Array[Byte]] with VectorStorageBackend[Array[Byte]] with RefStorageBackend[Array[Byte]] with Logging { - val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper-quorum", "localhost") + val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.persistence.hbase.zookeeper-quorum", "localhost") val CONFIGURATION = new HBaseConfiguration val REF_TABLE_NAME = "__REF_TABLE" val VECTOR_TABLE_NAME = "__VECTOR_TABLE" diff --git a/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseSpecTestIntegration.scala b/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseSpecTestIntegration.scala index 427163d634..5e949c8a28 100644 --- a/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseSpecTestIntegration.scala +++ b/akka-persistence/akka-persistence-hbase/src/test/scala/SimpleHbaseSpecTestIntegration.scala @@ -48,7 +48,7 @@ class SimpleHbaseSpecTestIntegration extends Spec with BeforeAndAfterAll with Sh import org.apache.hadoop.hbase.client.HBaseAdmin import org.apache.hadoop.hbase.client.HTable - val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.storage.hbase.zookeeper-quorum", "0") + val HBASE_ZOOKEEPER_QUORUM = config.getString("akka.persistence.hbase.zookeeper-quorum", "0") HBASE_ZOOKEEPER_QUORUM should not equal ("0") HBASE_ZOOKEEPER_QUORUM should equal("localhost") diff --git a/akka-persistence/akka-persistence-memcached/src/main/scala/akka/MemcachedStorageBackend.scala b/akka-persistence/akka-persistence-memcached/src/main/scala/akka/MemcachedStorageBackend.scala index 4b36fa4b87..0859e6d88e 100644 --- a/akka-persistence/akka-persistence-memcached/src/main/scala/akka/MemcachedStorageBackend.scala +++ b/akka-persistence/akka-persistence-memcached/src/main/scala/akka/MemcachedStorageBackend.scala @@ -20,7 +20,7 @@ private[akka] object MemcachedStorageBackend extends CommonStorageBackend { import KVStorageBackend._ import org.apache.commons.codec.binary.Base64 - val clientAddresses = config.getString("akka.storage.memcached.client.addresses", "localhost:11211") + val clientAddresses = config.getString("akka.persistence.memcached.client.addresses", "localhost:11211") val factory = new KetamaConnectionFactory val client = new MemcachedClient(factory, AddrUtil.getAddresses(clientAddresses)) val base64 = new Base64(76, Array.empty[Byte], true) @@ -114,4 +114,4 @@ private[akka] object MemcachedStorageBackend extends CommonStorageBackend { } -} \ No newline at end of file +} diff --git a/akka-persistence/akka-persistence-mongo/src/main/scala/akka/MongoStorageBackend.scala b/akka-persistence/akka-persistence-mongo/src/main/scala/akka/MongoStorageBackend.scala index cab7237eb0..e1a2405222 100644 --- a/akka-persistence/akka-persistence-mongo/src/main/scala/akka/MongoStorageBackend.scala +++ b/akka-persistence/akka-persistence-mongo/src/main/scala/akka/MongoStorageBackend.scala @@ -31,9 +31,9 @@ private[akka] object MongoStorageBackend extends val REF = "__ref" val COLLECTION = "akka_coll" - val HOSTNAME = config.getString("akka.storage.mongodb.hostname", "127.0.0.1") - val DBNAME = config.getString("akka.storage.mongodb.dbname", "testdb") - val PORT = config.getInt("akka.storage.mongodb.port", 27017) + val HOSTNAME = config.getString("akka.persistence.mongodb.hostname", "127.0.0.1") + val DBNAME = config.getString("akka.persistence.mongodb.dbname", "testdb") + val PORT = config.getInt("akka.persistence.mongodb.port", 27017) val db: MongoDB = MongoConnection(HOSTNAME, PORT)(DBNAME) val coll: MongoCollection = db(COLLECTION) diff --git a/akka-persistence/akka-persistence-redis/src/main/scala/akka/RedisStorageBackend.scala b/akka-persistence/akka-persistence-redis/src/main/scala/akka/RedisStorageBackend.scala index df7a1feab4..d6a8cfb0a7 100644 --- a/akka-persistence/akka-persistence-redis/src/main/scala/akka/RedisStorageBackend.scala +++ b/akka-persistence/akka-persistence-redis/src/main/scala/akka/RedisStorageBackend.scala @@ -52,14 +52,14 @@ private [akka] object RedisStorageBackend extends Logging { // need an explicit definition in akka-conf - val nodes = config.getList("akka.storage.redis.cluster") + val nodes = config.getList("akka.persistence.redis.cluster") def connect() = nodes match { case Seq() => // no cluster defined - val REDIS_SERVER_HOSTNAME = config.getString("akka.storage.redis.hostname", "127.0.0.1") - val REDIS_SERVER_PORT = config.getInt("akka.storage.redis.port", 6379) + val REDIS_SERVER_HOSTNAME = config.getString("akka.persistence.redis.hostname", "127.0.0.1") + val REDIS_SERVER_PORT = config.getInt("akka.persistence.redis.port", 6379) new RedisClient(REDIS_SERVER_HOSTNAME, REDIS_SERVER_PORT) case s => diff --git a/akka-persistence/akka-persistence-riak/src/main/scala/akka/RiakStorageBackend.scala b/akka-persistence/akka-persistence-riak/src/main/scala/akka/RiakStorageBackend.scala index 57c8776a1b..149576da05 100644 --- a/akka-persistence/akka-persistence-riak/src/main/scala/akka/RiakStorageBackend.scala +++ b/akka-persistence/akka-persistence-riak/src/main/scala/akka/RiakStorageBackend.scala @@ -18,12 +18,12 @@ import com.trifork.riak.{RequestMeta, RiakObject, RiakClient} private[akka] object RiakStorageBackend extends CommonStorageBackend { - val refBucket = config.getString("akka.storage.riak.bucket.ref", "Refs") - val mapBucket = config.getString("akka.storage.riak.bucket.map", "Maps") - val vectorBucket = config.getString("akka.storage.riak.bucket.vector", "Vectors") - val queueBucket = config.getString("akka.storage.riak.bucket.queue", "Queues") - val clientHost = config.getString("akka.storage.riak.client.host", "localhost") - val clientPort = config.getInt("akka.storage.riak.client.port", 8087) + val refBucket = config.getString("akka.persistence.riak.bucket.ref", "Refs") + val mapBucket = config.getString("akka.persistence.riak.bucket.map", "Maps") + val vectorBucket = config.getString("akka.persistence.riak.bucket.vector", "Vectors") + val queueBucket = config.getString("akka.persistence.riak.bucket.queue", "Queues") + val clientHost = config.getString("akka.persistence.riak.client.host", "localhost") + val clientPort = config.getInt("akka.persistence.riak.client.port", 8087) val riakClient: RiakClient = new RiakClient(clientHost, clientPort); import CommonStorageBackendAccess._ diff --git a/akka-persistence/akka-persistence-simpledb/src/main/scala/akka/SimpledbStorageBackend.scala b/akka-persistence/akka-persistence-simpledb/src/main/scala/akka/SimpledbStorageBackend.scala index f0441a60ef..dba6579e41 100644 --- a/akka-persistence/akka-persistence-simpledb/src/main/scala/akka/SimpledbStorageBackend.scala +++ b/akka-persistence/akka-persistence-simpledb/src/main/scala/akka/SimpledbStorageBackend.scala @@ -28,42 +28,42 @@ private[akka] object SimpledbStorageBackend extends CommonStorageBackend { val ownerAtt = "owner" val base64 = new Base64(1024, seperatorBytes, true) val base64key = new Base64(1024, Array.empty[Byte], true) - val id = config.getString("akka.storage.simpledb.account.id").getOrElse{ + val id = config.getString("akka.persistence.simpledb.account.id").getOrElse{ val e = new IllegalStateException("You must provide an AWS id") log.error(e, "You Must Provide an AWS id to use the SimpledbStorageBackend") throw e } - val secretKey = config.getString("akka.storage.simpledb.account.secretKey").getOrElse{ + val secretKey = config.getString("akka.persistence.simpledb.account.secretKey").getOrElse{ val e = new IllegalStateException("You must provide an AWS secretKey") log.error(e, "You Must Provide an AWS secretKey to use the SimpledbStorageBackend") throw e } - val refDomain = config.getString("akka.storage.simpledb.domain.ref", "ref") - val mapDomain = config.getString("akka.storage.simpledb.domain.map", "map") - val queueDomain = config.getString("akka.storage.simpledb.domain.queue", "queue") - val vectorDomain = config.getString("akka.storage.simpledb.domain.vector", "vector") + val refDomain = config.getString("akka.persistence.simpledb.domain.ref", "ref") + val mapDomain = config.getString("akka.persistence.simpledb.domain.map", "map") + val queueDomain = config.getString("akka.persistence.simpledb.domain.queue", "queue") + val vectorDomain = config.getString("akka.persistence.simpledb.domain.vector", "vector") val credentials = new BasicAWSCredentials(id, secretKey); val clientConfig = new ClientConfiguration() - for (i <- config.getInt("akka.storage.simpledb.client.timeout")) { + for (i <- config.getInt("akka.persistence.simpledb.client.timeout")) { clientConfig.setConnectionTimeout(i) } - for (i <- config.getInt("akka.storage.simpledb.client.maxconnections")) { + for (i <- config.getInt("akka.persistence.simpledb.client.maxconnections")) { clientConfig.setMaxConnections(i) } - clientConfig.setMaxErrorRetry(config.getInt("akka.storage.simpledb.client.maxretries", 10)) + clientConfig.setMaxErrorRetry(config.getInt("akka.persistence.simpledb.client.maxretries", 10)) - for (s <- config.getString("akka.storage.simpledb.client.protocol")) { + for (s <- config.getString("akka.persistence.simpledb.client.protocol")) { clientConfig.setProtocol(Protocol.valueOf(s)) } - for (i <- config.getInt("akka.storage.simpledb.client.sockettimeout")) { + for (i <- config.getInt("akka.persistence.simpledb.client.sockettimeout")) { clientConfig.setSocketTimeout(i) } - for {s <- config.getInt("akka.storage.simpledb.client.sendbuffer") - r <- config.getInt("akka.storage.simpledb.client.receivebuffer")} { + for {s <- config.getInt("akka.persistence.simpledb.client.sendbuffer") + r <- config.getInt("akka.persistence.simpledb.client.receivebuffer")} { clientConfig.setSocketBufferSizeHints(s, r) } - for (s <- config.getString("akka.storage.simpledb.client.useragent")) { + for (s <- config.getString("akka.persistence.simpledb.client.useragent")) { clientConfig.setUserAgent(s) } @@ -292,4 +292,4 @@ private[akka] object SimpledbStorageBackend extends CommonStorageBackend { } -} \ No newline at end of file +} diff --git a/akka-persistence/akka-persistence-voldemort/src/main/scala/akka/VoldemortStorageBackend.scala b/akka-persistence/akka-persistence-voldemort/src/main/scala/akka/VoldemortStorageBackend.scala index 520b2030fe..8f2779eb06 100644 --- a/akka-persistence/akka-persistence-voldemort/src/main/scala/akka/VoldemortStorageBackend.scala +++ b/akka-persistence/akka-persistence-voldemort/src/main/scala/akka/VoldemortStorageBackend.scala @@ -28,14 +28,14 @@ private[akka] object VoldemortStorageBackend extends CommonStorageBackend { import VoldemortAccess._ val bootstrapUrlsProp = "bootstrap_urls" - val clientConfig = config.getConfigMap("akka.storage.voldemort.client") match { + val clientConfig = config.getConfigMap("akka.persistence.voldemort.client") match { case Some(configMap) => getClientConfig(configMap.asMap) case None => getClientConfig(new HashMap[String, String] + (bootstrapUrlsProp -> "tcp://localhost:6666")) } - val refStore = config.getString("akka.storage.voldemort.store.ref", "Refs") - val mapStore = config.getString("akka.storage.voldemort.store.map", "Maps") - val vectorStore = config.getString("akka.storage.voldemort.store.vector", "Vectors") - val queueStore = config.getString("akka.storage.voldemort.store.queue", "Queues") + val refStore = config.getString("akka.persistence.voldemort.store.ref", "Refs") + val mapStore = config.getString("akka.persistence.voldemort.store.map", "Maps") + val vectorStore = config.getString("akka.persistence.voldemort.store.vector", "Vectors") + val queueStore = config.getString("akka.persistence.voldemort.store.queue", "Queues") var storeClientFactory: StoreClientFactory = null diff --git a/akka-remote/src/main/scala/akka/remote/BootableRemoteActorService.scala b/akka-remote/src/main/scala/akka/remote/BootableRemoteActorService.scala index 506d95905b..d67c09cd93 100644 --- a/akka-remote/src/main/scala/akka/remote/BootableRemoteActorService.scala +++ b/akka-remote/src/main/scala/akka/remote/BootableRemoteActorService.scala @@ -22,11 +22,11 @@ trait BootableRemoteActorService extends Bootable with Logging { else RemoteNode.start } }, "Akka Remote Service") - + def startRemoteService = remoteServerThread.start abstract override def onLoad = { - if (config.getBool("akka.remote.server.service", true)) { + if (RemoteServer.isRemotingEnabled) { log.info("Initializing Remote Actors Service...") startRemoteService log.info("Remote Actors Service initialized") diff --git a/akka-remote/src/main/scala/akka/remote/RemoteServer.scala b/akka-remote/src/main/scala/akka/remote/RemoteServer.scala index 3d4e81e336..33b71f1425 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteServer.scala @@ -66,12 +66,14 @@ object RemoteNode extends RemoteServer * @author Jonas Bonér */ object RemoteServer { + val isRemotingEnabled = config.getList("akka.enabled-modules").exists(_ == "remote") + val UUID_PREFIX = "uuid:" val MESSAGE_FRAME_SIZE = config.getInt("akka.remote.server.message-frame-size", 1048576) val SECURE_COOKIE = config.getString("akka.remote.secure-cookie") val REQUIRE_COOKIE = { val requireCookie = config.getBool("akka.remote.server.require-cookie", true) - if (requireCookie && RemoteServer.SECURE_COOKIE.isEmpty) throw new ConfigurationException( + if (isRemotingEnabled && requireCookie && RemoteServer.SECURE_COOKIE.isEmpty) throw new ConfigurationException( "Configuration option 'akka.remote.server.require-cookie' is turned on but no secure cookie is defined in 'akka.remote.secure-cookie'.") requireCookie } diff --git a/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala b/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala index 1a462d1700..bee8dd5bd9 100644 --- a/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala +++ b/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala @@ -39,7 +39,7 @@ class Boot { } /* - * In akka.conf you can set the FQN of any AuthenticationActor of your wish, under the property name: akka.rest.authenticator + * In akka.conf you can set the FQN of any AuthenticationActor of your wish, under the property name: akka.http.authenticator */ class DigestAuthenticationService extends DigestAuthenticationActor { //If you want to have a distributed nonce-map, you can use something like below, diff --git a/akka-samples/akka-sample-security/src/main/webapp/WEB-INF/web.xml b/akka-samples/akka-sample-security/src/main/webapp/WEB-INF/web.xml index e9d5bbb4db..d532f0e3f2 100644 --- a/akka-samples/akka-sample-security/src/main/webapp/WEB-INF/web.xml +++ b/akka-samples/akka-sample-security/src/main/webapp/WEB-INF/web.xml @@ -8,7 +8,7 @@ AkkaServlet - akka.rest.AkkaServlet + akka.http.AkkaServlet diff --git a/config/akka-reference.conf b/config/akka-reference.conf index 17a29b0ff9..04992fb83d 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -8,7 +8,9 @@ akka { version = "1.0-SNAPSHOT" # Akka version, checked against the runtime version of Akka. - time-unit = "seconds" # Default timeout time unit for all timeout properties throughout the config + enabled-modules = [] # Comma separated list of the enabled modules. Options: ["remote", "remote.ssl", "camel", "http"] + + time-unit = "seconds" # Time unit for all timeout properties throughout the config # These boot classes are loaded (and created) automatically when the Akka Microkernel boots up # Can be used to bootstrap your application(s) @@ -84,8 +86,7 @@ akka { timeout = 60 } - rest { - service = on + http { hostname = "localhost" port = 9998 #cometSupport = "org.atmosphere.container.Jetty7CometSupport" # Disregard autodetection, for valid values: http://doc.akkasource.org/comet @@ -133,13 +134,12 @@ akka { } server { - service = on - hostname = "localhost" # The hostname or IP that clients should connect to - port = 2552 # The port clients should connect to - message-frame-size = 1048576 + hostname = "localhost" # The hostname or IP that clients should connect to + port = 2552 # The port clients should connect to. Default is 2552 (AKKA) + message-frame-size = 1048576 # Increase this if you want to be able to send messages with large payloads connection-timeout = 1 - require-cookie = on - untrusted-mode = off + require-cookie = on # Should the remote server require that it peers share the same secure-cookie (defined in the 'remote' section)? + untrusted-mode = off # Enable untrusted mode for full security of server managed actors, allows untrusted clients to connect. } client { @@ -148,15 +148,9 @@ akka { message-frame-size = 1048576 reconnection-time-window = 600 # Maximum time window that a client should try to reconnect for } - - cluster { - service = on - name = "default" # The name of the cluster - serializer = "akka.serialization.Serializer$Java$" # FQN of the serializer class - } } - storage { + persistence { cassandra { hostname = "127.0.0.1" # IP address or hostname of one of the Cassandra cluster's seeds port = 9160 # Port to Cassandra @@ -203,24 +197,25 @@ akka { queue = "Queues" } - client{ + client { host = "localhost" port = 8087 #Default Riak Protobuf port } } memcached { - client{ - addresses = "localhost:11211" #Formatted according to spymemcached "localhost:11211 otherhost:11211" etc.. + client { + addresses = "localhost:11211" #Formatted according to spymemcached "localhost:11211 otherhost:11211" etc.. } } simpledb { - account{ + account { id = "YOU NEED TO PROVIDE AN AWS ID" secretKey = "YOU NEED TO PROVIDE AN AWS SECRETKEY" } - client{ + + client { #Defaults to default AWS ClientConfiguration timeout =50000 #maxconnections = @@ -231,7 +226,8 @@ akka { #receivebuffer = 0 #useragent = "AWS Java SDK-1.0.14" } - domain{ + + domain { ref = "ref" map = "map" vector = "vector" @@ -239,8 +235,4 @@ akka { } } } - - camel { - service = on - } } From ada24c7cf5b1dda26eb1ec2775ae2f91c4218e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Mon, 22 Nov 2010 17:58:21 +0100 Subject: [PATCH 3/7] Removed reflective coupling to akka cloud --- .../scala/akka/dispatch/Dispatchers.scala | 2 +- .../ExecutorBasedEventDrivenDispatcher.scala | 18 +++----- ...sedEventDrivenWorkStealingDispatcher.scala | 15 +++---- .../scala/akka/dispatch/HawtDispatcher.scala | 2 +- .../scala/akka/dispatch/MailboxHandling.scala | 11 +---- .../scala/akka/dispatch/MessageHandling.scala | 21 ++++++++- .../scala/akka/util/ReflectiveAccess.scala | 45 ------------------- config/akka-reference.conf | 18 +------- 8 files changed, 33 insertions(+), 99 deletions(-) diff --git a/akka-actor/src/main/scala/akka/dispatch/Dispatchers.scala b/akka-actor/src/main/scala/akka/dispatch/Dispatchers.scala index 4d33bf03ce..bb58c8600a 100644 --- a/akka-actor/src/main/scala/akka/dispatch/Dispatchers.scala +++ b/akka-actor/src/main/scala/akka/dispatch/Dispatchers.scala @@ -5,9 +5,9 @@ package akka.dispatch import akka.actor.{Actor, ActorRef} +import akka.actor.newUuid import akka.config.Config._ import akka.util.{Duration, Logging} -import akka.actor.newUuid import net.lag.configgy.ConfigMap diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala index ee5dd890b8..2673d0af33 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala @@ -5,12 +5,11 @@ package akka.dispatch import akka.actor.{ActorRef, IllegalActorStateException} -import akka.util.ReflectiveAccess.AkkaCloudModule +import akka.util.{ReflectiveAccess, Switch} import java.util.Queue -import akka.util.Switch import java.util.concurrent.atomic.AtomicReference -import java.util.concurrent. {ExecutorService, RejectedExecutionException, ConcurrentLinkedQueue, LinkedBlockingQueue} +import java.util.concurrent.{ExecutorService, RejectedExecutionException, ConcurrentLinkedQueue, LinkedBlockingQueue} /** * Default settings are: @@ -119,17 +118,10 @@ class ExecutorBasedEventDrivenDispatcher( } /** - * Creates and returns a durable mailbox for the given actor. + * Creates and returns a durable mailbox for the given actor. */ - def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = mailboxType match { - // FIXME make generic (work for TypedActor as well) - case FileBasedDurableMailbox(serializer) => AkkaCloudModule.createFileBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case ZooKeeperBasedDurableMailbox(serializer) => AkkaCloudModule.createZooKeeperBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case BeanstalkBasedDurableMailbox(serializer) => AkkaCloudModule.createBeanstalkBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case RedisBasedDurableMailbox(serializer) => AkkaCloudModule.createRedisBasedMailbox(actorRef).asInstanceOf[MessageQueue] - case AMQPBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("AMQPBasedDurableMailbox is not yet supported") - case JMSBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("JMSBasedDurableMailbox is not yet supported") - } + private[akka] def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = + createMailbox(mailboxType.mailboxImplClassname, actorRef) private[akka] def start = log.debug("Starting up %s\n\twith throughput [%d]", toString, throughput) diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala index 69aa5d9365..42f3e0f4cf 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenWorkStealingDispatcher.scala @@ -4,13 +4,15 @@ package akka.dispatch -import jsr166x.{Deque, ConcurrentLinkedDeque, LinkedBlockingDeque} import akka.actor.{Actor, ActorRef, IllegalActorStateException} import akka.util.Switch + import java.util.concurrent. {ExecutorService, CopyOnWriteArrayList} import java.util.concurrent.atomic.AtomicReference +import jsr166x.{Deque, ConcurrentLinkedDeque, LinkedBlockingDeque} + /** * An executor based event driven dispatcher which will try to redistribute work from busy actors to idle actors. It is assumed * that all actors using the same instance of this dispatcher can process all messages that have been sent to one of the actors. I.e. the @@ -222,15 +224,8 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher( /** * Creates and returns a durable mailbox for the given actor. */ - private[akka] def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = mailboxType match { - // FIXME make generic (work for TypedActor as well) - case FileBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("FileBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - case ZooKeeperBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("ZooKeeperBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - case BeanstalkBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("BeanstalkBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - case RedisBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("RedisBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - case AMQPBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("AMQPBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - case JMSBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("JMSBasedDurableMailbox is not yet supported for ExecutorBasedEventDrivenWorkStealingDispatcher") - } + private[akka] def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = + createMailbox(mailboxType.mailboxImplClassname, actorRef) private[akka] override def register(actorRef: ActorRef) = { verifyActorsAreOfSameType(actorRef) diff --git a/akka-actor/src/main/scala/akka/dispatch/HawtDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/HawtDispatcher.scala index 1031ae4c9a..d35fc46617 100644 --- a/akka-actor/src/main/scala/akka/dispatch/HawtDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/HawtDispatcher.scala @@ -5,6 +5,7 @@ package akka.dispatch import akka.actor.ActorRef +import akka.util.Switch import org.fusesource.hawtdispatch.DispatchQueue import org.fusesource.hawtdispatch.ScalaDispatch._ @@ -13,7 +14,6 @@ import org.fusesource.hawtdispatch.ListEventAggregator import java.util.concurrent.atomic.{AtomicInteger, AtomicBoolean} import java.util.concurrent.CountDownLatch -import akka.util.Switch /** * Holds helper methods for working with actors that are using a HawtDispatcher as it's dispatcher. diff --git a/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala b/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala index 7e81d4a598..d6c13bfda4 100644 --- a/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala +++ b/akka-actor/src/main/scala/akka/dispatch/MailboxHandling.scala @@ -5,7 +5,6 @@ package akka.dispatch import akka.actor.{Actor, ActorType, ActorRef, ActorInitializationException} -import akka.util.ReflectiveAccess.AkkaCloudModule import akka.AkkaException import java.util.{Queue, List} @@ -42,15 +41,7 @@ case class BoundedMailbox( if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null") } -abstract class DurableMailboxType(val serializer: AkkaCloudModule.Serializer) extends MailboxType { - if (serializer eq null) throw new IllegalArgumentException("The serializer for DurableMailboxType can not be null") -} -case class FileBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) -case class RedisBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) -case class BeanstalkBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) -case class ZooKeeperBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) -case class AMQPBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) -case class JMSBasedDurableMailbox(ser: AkkaCloudModule.Serializer) extends DurableMailboxType(ser) +case class DurableMailboxType(mailboxImplClassname: String) extends MailboxType class DefaultUnboundedMessageQueue(blockDequeue: Boolean) extends LinkedBlockingQueue[MessageInvocation] with MessageQueue { diff --git a/akka-actor/src/main/scala/akka/dispatch/MessageHandling.scala b/akka-actor/src/main/scala/akka/dispatch/MessageHandling.scala index 467bccd13e..b766a7a974 100644 --- a/akka-actor/src/main/scala/akka/dispatch/MessageHandling.scala +++ b/akka-actor/src/main/scala/akka/dispatch/MessageHandling.scala @@ -6,7 +6,8 @@ package akka.dispatch import java.util.concurrent._ import atomic. {AtomicInteger, AtomicBoolean, AtomicReference, AtomicLong} -import akka.util. {Switch, ReentrantGuard, Logging, HashCode} + +import akka.util.{Switch, ReentrantGuard, Logging, HashCode, ReflectiveAccess} import akka.actor._ /** @@ -59,11 +60,27 @@ object MessageDispatcher { */ trait MessageDispatcher extends MailboxFactory with Logging { import MessageDispatcher._ + protected val uuids = new ConcurrentSkipListSet[Uuid] protected val guard = new ReentrantGuard - private var shutdownSchedule = UNSCHEDULED //This can be non-volatile since it is protected by guard withGuard protected val active = new Switch(false) + private var shutdownSchedule = UNSCHEDULED //This can be non-volatile since it is protected by guard withGuard + + /** + * Creates and returns a mailbox for the given actor. + */ + def createMailbox(mailboxImplClassname: String, actorRef: ActorRef): MessageQueue = { + ReflectiveAccess.createInstance( + mailboxImplClassname, + Array(classOf[ActorRef]), + Array(actorRef).asInstanceOf[Array[AnyRef]], + ReflectiveAccess.loader) + .getOrElse(throw new IllegalActorStateException( + "Could not create mailbox [" + mailboxImplClassname + "] for actor [" + actorRef + "]")) + .asInstanceOf[MessageQueue] + } + /** * Attaches the specified actorRef to this dispatcher */ diff --git a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala index b5a4c7edb7..f359ab9b98 100644 --- a/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/akka/util/ReflectiveAccess.scala @@ -22,11 +22,9 @@ object ReflectiveAccess extends Logging { lazy val isRemotingEnabled = RemoteClientModule.isEnabled lazy val isTypedActorEnabled = TypedActorModule.isEnabled - lazy val isAkkaCloudEnabled = AkkaCloudModule.isEnabled def ensureRemotingEnabled = RemoteClientModule.ensureEnabled def ensureTypedActorEnabled = TypedActorModule.ensureEnabled - def ensureAkkaCloudEnabled = AkkaCloudModule.ensureEnabled /** * Reflective access to the RemoteClient module. @@ -173,49 +171,6 @@ object ReflectiveAccess extends Logging { } } - object AkkaCloudModule { - - type Mailbox = { - def enqueue(message: MessageInvocation) - def dequeue: MessageInvocation - } - - type Serializer = { - def toBinary(obj: AnyRef): Array[Byte] - def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef - } - - lazy val isEnabled = clusterObjectInstance.isDefined - - val clusterObjectInstance: Option[AnyRef] = - getObjectFor("akka.cloud.cluster.Cluster$") - - val serializerClass: Option[Class[_]] = - getClassFor("akka.serialization.Serializer") - - def ensureEnabled = if (!isEnabled) throw new ModuleNotAvailableException( - "Feature is only available in Akka Cloud") - - def createFileBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.FileBasedMailbox", actorRef) - - def createZooKeeperBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.ZooKeeperBasedMailbox", actorRef) - - def createBeanstalkBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.BeanstalkBasedMailbox", actorRef) - - def createRedisBasedMailbox(actorRef: ActorRef): Mailbox = createMailbox("akka.cloud.cluster.RedisBasedMailbox", actorRef) - - private def createMailbox(mailboxClassname: String, actorRef: ActorRef): Mailbox = { - ensureEnabled - createInstance( - mailboxClassname, - Array(classOf[ActorRef]), - Array(actorRef).asInstanceOf[Array[AnyRef]], - loader) - .getOrElse(throw new IllegalActorStateException("Could not create durable mailbox [" + mailboxClassname + "] for actor [" + actorRef + "]")) - .asInstanceOf[Mailbox] - } - } - val noParams = Array[Class[_]]() val noArgs = Array[AnyRef]() diff --git a/config/akka-reference.conf b/config/akka-reference.conf index 04992fb83d..7e5d4af6d6 100644 --- a/config/akka-reference.conf +++ b/config/akka-reference.conf @@ -8,7 +8,7 @@ akka { version = "1.0-SNAPSHOT" # Akka version, checked against the runtime version of Akka. - enabled-modules = [] # Comma separated list of the enabled modules. Options: ["remote", "remote.ssl", "camel", "http"] + enabled-modules = [] # Comma separated list of the enabled modules. Options: ["remote", "camel", "http"] time-unit = "seconds" # Time unit for all timeout properties throughout the config @@ -117,22 +117,6 @@ akka { compression-scheme = "zlib" # Options: "zlib" (lzf to come), leave out for no compression zlib-compression-level = 6 # Options: 0-9 (1 being fastest and 9 being the most compressed), default is 6 - ssl { - service = off # NOTE: This feature is not deemed production ready and is not possible to turn on yet - - # You can either use java command-line options or use the settings below - - #key-store-type = "pkcs12" # Same as -Djavax.net.ssl.keyStoreType=pkcs12 - #key-store = "yourcertificate.p12" # Same as -Djavax.net.ssl.keyStore=yourcertificate.p12 - #key-store-pass = "$PASS" # Same as -Djavax.net.ssl.keyStorePassword=$PASS - - #trust-store-type = "jks" # Same as -Djavax.net.ssl.trustStoreType=jks - #trust-store = "your.keystore" # Same as -Djavax.net.ssl.trustStore=your.keystore - #trust-store-pass = "$PASS" # Same as -Djavax.net.ssl.trustStorePassword=$PASS - - debug = off # This can be useful for debugging. If on, very verbose debug, same as -Djavax.net.debug=ssl - } - server { hostname = "localhost" # The hostname or IP that clients should connect to port = 2552 # The port clients should connect to. Default is 2552 (AKKA) From 629334bc9f54dde0e1dc9a2ad2d76787914cc63f Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Tue, 23 Nov 2010 11:50:06 +1300 Subject: [PATCH 4/7] Remove scala version from dist paths - fixes #549 --- project/build/AkkaProject.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index eace80ba22..3d80b2d8d8 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -325,7 +325,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { .filter(_.getName.endsWith(".jar")) .filter(!_.getName.contains("servlet_2.4")) .filter(!_.getName.contains("scala-library")) - .map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName) + .map("lib_managed/compile/" + _.getName) .mkString(" ") + " config/" + " scala-library.jar" + @@ -785,6 +785,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { } class AkkaOSGiAssemblyProject(info: ProjectInfo) extends DefaultProject(info) { + override def disableCrossPaths = true // Scala bundle val scala_bundle = "com.weiglewilczek.scala-lang-osgi" % "scala-library" % buildScalaVersion % "compile" intransitive @@ -845,6 +846,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaSampleAntsProject(info: ProjectInfo) extends DefaultSpdeProject(info) { + override def disableCrossPaths = true override def spdeSourcePath = mainSourcePath / "spde" } From 1178f156c6c339b10d0f4452e865227e69ced9d6 Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Tue, 23 Nov 2010 12:28:21 +1300 Subject: [PATCH 5/7] Disable cross paths on parent projects as well --- project/build/AkkaProject.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index 3d80b2d8d8..298983e9f1 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -542,6 +542,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaPersistenceParentProject(info: ProjectInfo) extends ParentProject(info) { + override def disableCrossPaths = true + lazy val akka_persistence_common = project("akka-persistence-common", "akka-persistence-common", new AkkaPersistenceCommonProject(_), akka_remote, akka_stm) lazy val akka_persistence_redis = project("akka-persistence-redis", "akka-persistence-redis", @@ -749,6 +751,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaOSGiParentProject(info: ProjectInfo) extends ParentProject(info) { + override def disableCrossPaths = true + lazy val akka_osgi_dependencies_bundle = project("akka-osgi-dependencies-bundle", "akka-osgi-dependencies-bundle", new AkkaOSGiDependenciesBundleProject(_), akka_kernel, akka_jta) // akka_kernel does not depend on akka_jta (why?) therefore we list akka_jta here lazy val akka_osgi_assembly = project("akka-osgi-assembly", "akka-osgi-assembly", @@ -895,6 +899,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { } class AkkaSamplesParentProject(info: ProjectInfo) extends ParentProject(info) { + override def disableCrossPaths = true + lazy val akka_sample_ants = project("akka-sample-ants", "akka-sample-ants", new AkkaSampleAntsProject(_), akka_stm) lazy val akka_sample_chat = project("akka-sample-chat", "akka-sample-chat", From 7ee8accfb15dd44f71605277729c68b8e8c92ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Tue, 23 Nov 2010 08:36:47 +0100 Subject: [PATCH 6/7] Fixed problem with message toString is not lazily evaluated in RemoteClient --- akka-remote/src/main/scala/akka/remote/RemoteClient.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/akka-remote/src/main/scala/akka/remote/RemoteClient.scala b/akka-remote/src/main/scala/akka/remote/RemoteClient.scala index 77052c8547..e501411f6f 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteClient.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteClient.scala @@ -417,8 +417,7 @@ class RemoteClientHandler( if (result.isInstanceOf[RemoteMessageProtocol]) { val reply = result.asInstanceOf[RemoteMessageProtocol] val replyUuid = uuidFrom(reply.getUuid.getHigh, reply.getUuid.getLow) -// log.debug("Remote client received RemoteMessageProtocol[\n%s]".format(request.toString)) - log.debug("Remote client received RemoteMessageProtocol[\n%s]", reply.toString) + log.debug("Remote client received RemoteMessageProtocol[\n%s]".format(reply.toString)) val future = futures.get(replyUuid).asInstanceOf[CompletableFuture[Any]] if (reply.hasMessage) { if (future eq null) throw new IllegalActorStateException("Future mapped to UUID " + replyUuid + " does not exist") From 4c4fe3c71b3819187447aa2fadebb10ad07f6ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bon=C3=A9r?= Date: Tue, 23 Nov 2010 09:20:44 +0100 Subject: [PATCH 7/7] Upgrade to Scala 2.8.1 --- project/build.properties | 4 ++-- project/build/AkkaProject.scala | 2 +- project/plugins/Plugins.scala | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/project/build.properties b/project/build.properties index 4b70e4a190..b09217e854 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,7 +1,7 @@ project.organization=se.scalablesolutions.akka project.name=akka project.version=1.0-SNAPSHOT -scala.version=2.8.0 +scala.version=2.8.1 sbt.version=0.7.4 def.scala.version=2.7.7 -build.scala.versions=2.8.0 +build.scala.versions=2.8.1 diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index e8cda66d3b..5bbd3e92ff 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -264,7 +264,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val junit = "junit" % "junit" % "4.5" % "test" //Common Public License 1.0 lazy val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test" //MIT lazy val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test" //ApacheV2 - lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.5" % "test" //MIT + lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.6" % "test" //MIT //HBase testing lazy val hadoop_test = "org.apache.hadoop" % "hadoop-test" % "0.20.2" % "test" //ApacheV2 diff --git a/project/plugins/Plugins.scala b/project/plugins/Plugins.scala index 4f4ec09479..0a2e64a2a8 100644 --- a/project/plugins/Plugins.scala +++ b/project/plugins/Plugins.scala @@ -25,5 +25,5 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) { // Dependencies // ------------------------------------------------------------------------------------------------------------------- lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.0.RC4" - lazy val spdeSbt = "us.technically.spde" % "spde-sbt-plugin" % "0.4.1" + lazy val spdeSbt = "us.technically.spde" % "spde-sbt-plugin" % "0.4.2" }