Merged with current master
This commit is contained in:
commit
9ccac820be
116 changed files with 407 additions and 281 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
||||||
This software is licensed under the Apache 2 license, quoted below.
|
This software is licensed under the Apache 2 license, quoted below.
|
||||||
|
|
||||||
Copyright 2009-2010 Scalable Solutions AB [http://scalablesolutions.se]
|
Copyright 2009-2011 Scalable Solutions AB [http://scalablesolutions.se]
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
use this file except in compliance with the License. You may obtain a copy of
|
use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka
|
package akka
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka
|
package akka
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.config
|
package akka.config
|
||||||
|
|
@ -20,7 +20,7 @@ class ModuleNotAvailableException(message: String) extends AkkaException(message
|
||||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||||
*/
|
*/
|
||||||
object Config extends Logging {
|
object Config extends Logging {
|
||||||
val VERSION = "1.0-RC2-SNAPSHOT"
|
val VERSION = "1.1-SNAPSHOT"
|
||||||
|
|
||||||
val HOME = {
|
val HOME = {
|
||||||
val envHome = System.getenv("AKKA_HOME") match {
|
val envHome = System.getenv("AKKA_HOME") match {
|
||||||
|
|
@ -64,9 +64,19 @@ object Config extends Logging {
|
||||||
"\n\tdue to: " + e.toString)
|
"\n\tdue to: " + e.toString)
|
||||||
}
|
}
|
||||||
Configgy.config
|
Configgy.config
|
||||||
|
} else if (getClass.getClassLoader.getResource(confName) ne null) {
|
||||||
|
try {
|
||||||
|
Configgy.configureFromResource(confName, getClass.getClassLoader)
|
||||||
|
log.slf4j.info("Config [{}] loaded from the application classpath.",confName)
|
||||||
|
} catch {
|
||||||
|
case e: ParseException => throw new ConfigurationException(
|
||||||
|
"Can't load '" + confName + "' config file from application classpath," +
|
||||||
|
"\n\tdue to: " + e.toString)
|
||||||
|
}
|
||||||
|
Configgy.config
|
||||||
} else if (HOME.isDefined) {
|
} else if (HOME.isDefined) {
|
||||||
try {
|
try {
|
||||||
val configFile = HOME.getOrElse(throwNoAkkaHomeException) + "/config/" + confName
|
val configFile = HOME.get + "/config/" + confName
|
||||||
Configgy.configure(configFile)
|
Configgy.configure(configFile)
|
||||||
log.slf4j.info(
|
log.slf4j.info(
|
||||||
"AKKA_HOME is defined as [{}], config loaded from [{}].",
|
"AKKA_HOME is defined as [{}], config loaded from [{}].",
|
||||||
|
|
@ -79,16 +89,6 @@ object Config extends Logging {
|
||||||
"\n\tdue to: " + e.toString)
|
"\n\tdue to: " + e.toString)
|
||||||
}
|
}
|
||||||
Configgy.config
|
Configgy.config
|
||||||
} else if (getClass.getClassLoader.getResource(confName) ne null) {
|
|
||||||
try {
|
|
||||||
Configgy.configureFromResource(confName, getClass.getClassLoader)
|
|
||||||
log.slf4j.info("Config [{}] loaded from the application classpath.",confName)
|
|
||||||
} catch {
|
|
||||||
case e: ParseException => throw new ConfigurationException(
|
|
||||||
"Can't load '" + confName + "' config file from application classpath," +
|
|
||||||
"\n\tdue to: " + e.toString)
|
|
||||||
}
|
|
||||||
Configgy.config
|
|
||||||
} else {
|
} else {
|
||||||
log.slf4j.warn(
|
log.slf4j.warn(
|
||||||
"\nCan't load '" + confName + "'." +
|
"\nCan't load '" + confName + "'." +
|
||||||
|
|
@ -101,6 +101,7 @@ object Config extends Logging {
|
||||||
CConfig.fromString("<akka></akka>") // default empty config
|
CConfig.fromString("<akka></akka>") // default empty config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (config.getBool("akka.enable-jmx", true)) config.registerWithJmx("akka")
|
||||||
|
|
||||||
val CONFIG_VERSION = config.getString("akka.version", VERSION)
|
val CONFIG_VERSION = config.getString("akka.version", VERSION)
|
||||||
if (VERSION != CONFIG_VERSION) throw new ConfigurationException(
|
if (VERSION != CONFIG_VERSION) throw new ConfigurationException(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.config
|
package akka.config
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.config
|
package akka.config
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.config
|
package akka.config
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dataflow
|
package akka.dataflow
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dispatch
|
package akka.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.routing
|
package akka.routing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.routing
|
package akka.routing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.routing
|
package akka.routing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.routing
|
package akka.routing
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.util
|
package akka.util
|
||||||
|
|
@ -87,6 +87,49 @@ 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 noParams = Array[Class[_]]()
|
||||||
val noArgs = Array[AnyRef]()
|
val noArgs = Array[AnyRef]()
|
||||||
|
|
||||||
|
|
@ -130,9 +173,15 @@ object ReflectiveAccess extends Logging {
|
||||||
instance.setAccessible(true)
|
instance.setAccessible(true)
|
||||||
Option(instance.get(null).asInstanceOf[T])
|
Option(instance.get(null).asInstanceOf[T])
|
||||||
} catch {
|
} catch {
|
||||||
case e: ClassNotFoundException =>
|
case e: ClassNotFoundException => {
|
||||||
log.slf4j.debug("Could not get object [{}] due to [{}]", fqn, e)
|
log.slf4j.debug("Could not get object [{}] due to [{}]", fqn, e)
|
||||||
None
|
None
|
||||||
|
}
|
||||||
|
case ei: ExceptionInInitializerError => {
|
||||||
|
log.error("Exception in initializer for object [%s]".format(fqn))
|
||||||
|
log.error(ei.getCause, "Cause was:")
|
||||||
|
throw ei
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getClassFor[T](fqn: String, classloader: ClassLoader = loader): Option[Class[T]] = try {
|
def getClassFor[T](fqn: String, classloader: ClassLoader = loader): Option[Class[T]] = try {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka
|
package akka
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor
|
package akka.actor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.dataflow
|
package akka.dataflow
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.actor.dispatch
|
package akka.actor.dispatch
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.actor.dispatch
|
package akka.actor.dispatch
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.dispatch
|
package akka.actor.dispatch
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ class AkkaRestServlet extends ServletContainer {
|
||||||
|
|
||||||
val initParams = new java.util.HashMap[String,String]
|
val initParams = new java.util.HashMap[String,String]
|
||||||
|
|
||||||
addInitParameter("com.sun.jersey.config.property.packages", c.getList("akka.http.resource_packages").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(","))
|
addInitParameter("com.sun.jersey.spi.container.ResourceFilters",c.getList("akka.http.filters").mkString(","))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,4 +35,4 @@ class AkkaRestServlet extends ServletContainer {
|
||||||
* Provide possibility to add config params
|
* Provide possibility to add config params
|
||||||
*/
|
*/
|
||||||
def addInitParameter(param: String, value: String): Unit = initParams.put(param,value)
|
def addInitParameter(param: String, value: String): Unit = initParams.put(param,value)
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.http
|
package akka.http
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.servlet
|
package akka.servlet
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.servlet
|
package akka.servlet
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.security
|
package akka.security
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
option java_package = "akka.remote.protocol";
|
option java_package = "akka.remote.protocol";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.remote
|
package akka.remote
|
||||||
|
|
@ -404,7 +404,7 @@ class RemoteClientHandler(
|
||||||
} catch {
|
} catch {
|
||||||
case e: Exception =>
|
case e: Exception =>
|
||||||
client.notifyListeners(RemoteClientError(e, client))
|
client.notifyListeners(RemoteClientError(e, client))
|
||||||
log.slf4j.error("Unexpected exception in remote client handler: {}", e)
|
log.slf4j.error("Unexpected exception in remote client handler", e)
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.serialization
|
package akka.serialization
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.serialization
|
package akka.serialization
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.serialization
|
package akka.serialization
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.serialization
|
package akka.serialization
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.serialization
|
package akka.serialization
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor;
|
package akka.actor;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka
|
package akka
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.remote
|
package akka.actor.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.remote
|
package akka.actor.remote
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,26 @@ import akka.util.Logging
|
||||||
|
|
||||||
import Actor._
|
import Actor._
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
Instructions how to run the sample:
|
||||||
|
|
||||||
|
* Download Akka distribution.
|
||||||
|
* Unzip and step into the Akka root dir
|
||||||
|
* Set AKKA_HOME. For exampe 'export AKKA_HOME=`pwd`
|
||||||
|
|
||||||
|
* Then open up two shells and in each run:
|
||||||
|
* sbt
|
||||||
|
* > project akka-remote
|
||||||
|
* > console
|
||||||
|
|
||||||
|
* Then paste in the code below into both shells.
|
||||||
|
|
||||||
|
Then run:
|
||||||
|
* ServerInitiatedRemoteActorServer.run in one shell
|
||||||
|
* ServerInitiatedRemoteActorClient.run in one shell
|
||||||
|
Have fun.
|
||||||
|
*************************************/
|
||||||
|
|
||||||
class HelloWorldActor extends Actor {
|
class HelloWorldActor extends Actor {
|
||||||
self.start
|
self.start
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.remote
|
package akka.actor.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.remote
|
package akka.actor.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.actor.remote
|
package akka.actor.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -146,4 +146,4 @@ class MyStatelessTypedActorImpl extends TypedActor with MyTypedActor {
|
||||||
override def requestReply(message: String) : String = {
|
override def requestReply(message: String) : String = {
|
||||||
if (message == "hello") "world" else ("hello " + message)
|
if (message == "hello") "world" else ("hello " + message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.actor.ticket
|
package akka.actor.ticket
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
package akka.actor.ticket
|
package akka.actor.ticket
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sample.ants
|
package sample.ants
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sample.remote
|
package sample.remote
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sample.remote
|
package sample.remote
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@ project.name=Akka SBT Plugin
|
||||||
# need full domain name for publishing to scala-tools
|
# need full domain name for publishing to scala-tools
|
||||||
project.organization=se.scalablesolutions.akka
|
project.organization=se.scalablesolutions.akka
|
||||||
# mirrors akka version
|
# mirrors akka version
|
||||||
project.version=1.0-RC2-SNAPSHOT
|
project.version=1.1-SNAPSHOT
|
||||||
sbt.version=0.7.4
|
sbt.version=0.7.4
|
||||||
build.scala.versions=2.7.7
|
build.scala.versions=2.7.7
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ trait AkkaBaseProject extends BasicScalaProject {
|
||||||
}
|
}
|
||||||
|
|
||||||
trait AkkaProject extends AkkaBaseProject {
|
trait AkkaProject extends AkkaBaseProject {
|
||||||
val akkaVersion = "1.0-RC2-SNAPSHOT"
|
val akkaVersion = "1.1-SNAPSHOT"
|
||||||
|
|
||||||
// convenience method
|
// convenience method
|
||||||
def akkaModule(module: String) = "se.scalablesolutions.akka" % ("akka-" + module) % akkaVersion
|
def akkaModule(module: String) = "se.scalablesolutions.akka" % ("akka-" + module) % akkaVersion
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.agent
|
package akka.agent
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
@ -75,7 +75,8 @@ object Transaction {
|
||||||
TransactionManagement.transaction.set(Some(tx))
|
TransactionManagement.transaction.set(Some(tx))
|
||||||
mtx.registerLifecycleListener(new TransactionLifecycleListener() {
|
mtx.registerLifecycleListener(new TransactionLifecycleListener() {
|
||||||
def notify(mtx: MultiverseTransaction, event: TransactionLifecycleEvent) = event match {
|
def notify(mtx: MultiverseTransaction, event: TransactionLifecycleEvent) = event match {
|
||||||
case TransactionLifecycleEvent.PostCommit => tx.commit
|
case TransactionLifecycleEvent.PostCommit => tx.commitJta
|
||||||
|
case TransactionLifecycleEvent.PreCommit => tx.commitPersistentState
|
||||||
case TransactionLifecycleEvent.PostAbort => tx.abort
|
case TransactionLifecycleEvent.PostAbort => tx.abort
|
||||||
case _ => {}
|
case _ => {}
|
||||||
}
|
}
|
||||||
|
|
@ -89,6 +90,7 @@ object Transaction {
|
||||||
*/
|
*/
|
||||||
@serializable class Transaction extends Logging {
|
@serializable class Transaction extends Logging {
|
||||||
val JTA_AWARE = config.getBool("akka.stm.jta-aware", false)
|
val JTA_AWARE = config.getBool("akka.stm.jta-aware", false)
|
||||||
|
val STATE_RETRIES = config.getInt("akka.storage.max-retries",10)
|
||||||
|
|
||||||
val id = Transaction.idFactory.incrementAndGet
|
val id = Transaction.idFactory.incrementAndGet
|
||||||
@volatile private[this] var status: TransactionStatus = TransactionStatus.New
|
@volatile private[this] var status: TransactionStatus = TransactionStatus.New
|
||||||
|
|
@ -109,10 +111,16 @@ object Transaction {
|
||||||
jta.foreach { _.beginWithStmSynchronization(this) }
|
jta.foreach { _.beginWithStmSynchronization(this) }
|
||||||
}
|
}
|
||||||
|
|
||||||
def commit = synchronized {
|
def commitPersistentState = synchronized {
|
||||||
log.slf4j.trace("Committing transaction " + toString)
|
log.trace("Committing transaction " + toString)
|
||||||
persistentStateMap.valuesIterator.foreach(_.commit)
|
retry(STATE_RETRIES){
|
||||||
|
persistentStateMap.valuesIterator.foreach(_.commit)
|
||||||
|
persistentStateMap.clear
|
||||||
|
}
|
||||||
status = TransactionStatus.Completed
|
status = TransactionStatus.Completed
|
||||||
|
}
|
||||||
|
|
||||||
|
def commitJta = synchronized {
|
||||||
jta.foreach(_.commit)
|
jta.foreach(_.commit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,6 +131,21 @@ object Transaction {
|
||||||
persistentStateMap.clear
|
persistentStateMap.clear
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def retry(tries:Int)(block: => Unit):Unit={
|
||||||
|
log.debug("Trying commit of persistent data structures")
|
||||||
|
if(tries==0){
|
||||||
|
throw new TransactionRetryException("Exhausted Retries while committing persistent state")
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
block
|
||||||
|
} catch{
|
||||||
|
case e:Exception=>{
|
||||||
|
log.warn(e,"Exception while committing persistent state, retrying")
|
||||||
|
retry(tries-1){block}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def isNew = synchronized { status == TransactionStatus.New }
|
def isNew = synchronized { status == TransactionStatus.New }
|
||||||
|
|
||||||
def isActive = synchronized { status == TransactionStatus.Active }
|
def isActive = synchronized { status == TransactionStatus.Active }
|
||||||
|
|
@ -144,7 +167,13 @@ object Transaction {
|
||||||
private[akka] def isTopLevel = depth.get == 0
|
private[akka] def isTopLevel = depth.get == 0
|
||||||
//when calling this method, make sure to prefix the uuid with the type so you
|
//when calling this method, make sure to prefix the uuid with the type so you
|
||||||
//have no possibility of kicking a diffferent type with the same uuid out of a transction
|
//have no possibility of kicking a diffferent type with the same uuid out of a transction
|
||||||
private[akka] def register(uuid: String, storage: Committable with Abortable) = persistentStateMap.put(uuid, storage)
|
private[akka] def register(uuid: String, storage: Committable with Abortable) = {
|
||||||
|
if(persistentStateMap.getOrElseUpdate(uuid, {storage}) ne storage){
|
||||||
|
log.error("existing:"+System.identityHashCode(persistentStateMap.get(uuid).get))
|
||||||
|
log.error("new:"+System.identityHashCode(storage))
|
||||||
|
throw new IllegalStateException("attempted to register an instance of persistent data structure for id [%s] when there is already a different instance registered".format(uuid))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private def ensureIsActive = if (status != TransactionStatus.Active)
|
private def ensureIsActive = if (status != TransactionStatus.Active)
|
||||||
throw new StmConfigurationException(
|
throw new StmConfigurationException(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.stm
|
package akka.stm
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka
|
package akka
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package akka.transactor
|
package akka.transactor
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue