Changed file-based mailbox creation

This commit is contained in:
Jonas Bonér 2010-09-24 20:28:23 +02:00
parent 21b1eb43fc
commit 0e03f0c34e
2 changed files with 7 additions and 5 deletions

View file

@ -4,7 +4,7 @@
package se.scalablesolutions.akka.dispatch
import se.scalablesolutions.akka.actor.{Actor, ActorRef, ActorInitializationException}
import se.scalablesolutions.akka.actor.{Actor, ActorType, ActorRef, ActorInitializationException}
import se.scalablesolutions.akka.util.{SimpleLock, Duration, HashCode, Logging}
import se.scalablesolutions.akka.util.ReflectiveAccess.EnterpriseModule
import se.scalablesolutions.akka.AkkaException
@ -104,7 +104,8 @@ trait MailboxFactory {
* Creates and returns a durable mailbox for the given actor.
*/
protected def createDurableMailbox(actorRef: ActorRef, mailboxType: DurableMailboxType): AnyRef = mailboxType match {
case FileBasedDurableMailbox(serializer) => EnterpriseModule.createFileBasedMailbox(actorRef.uuid, serializer).asInstanceOf[MessageQueue]
// FIXME make generic (work for TypedActor as well)
case FileBasedDurableMailbox(serializer) => EnterpriseModule.createFileBasedMailbox(actorRef.uuid, ActorType.ScalaActor, None).asInstanceOf[MessageQueue]
case RedisBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("RedisBasedDurableMailbox is not yet supported")
case BeanstalkBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("BeanstalkBasedDurableMailbox is not yet supported")
case ZooKeeperBasedDurableMailbox(serializer) => throw new UnsupportedOperationException("ZooKeeperBasedDurableMailbox is not yet supported")

View file

@ -222,12 +222,13 @@ object ReflectiveAccess extends Logging {
def ensureEnterpriseEnabled = if (!isEnterpriseEnabled) throw new ModuleNotAvailableException(
"Feature is only available in Akka Enterprise")
def createFileBasedMailbox(name: String, serializer: Serializer): FileBasedMailbox = {
def createFileBasedMailbox(
name: String, actorType: ActorType, typedActorInfo: Option[Tuple2[String, String]]): FileBasedMailbox = {
ensureEnterpriseEnabled
createInstance(
"se.scalablesolutions.akka.cluster.FileBasedMailbox",
Array(classOf[String], serializerClass.get),
Array(name, serializer).asInstanceOf[Array[AnyRef]],
Array(classOf[String], classOf[ActorType], classOf[Option[Tuple2[String, String]]]),
Array(name, actorType, typedActorInfo).asInstanceOf[Array[AnyRef]],
loader)
.getOrElse(throw new IllegalActorStateException("Could not create file-based mailbox"))
.asInstanceOf[FileBasedMailbox]