splitted kernel up in core + many sub modules
This commit is contained in:
parent
deeaa923d1
commit
ab6637044f
154 changed files with 1510 additions and 2651 deletions
|
|
@ -3,8 +3,8 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>akka-kernel</artifactId>
|
||||
<name>Akka Kernel Module</name>
|
||||
<artifactId>akka-actors</artifactId>
|
||||
<name>Akka Actors Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
|
@ -37,11 +37,6 @@
|
|||
<artifactId>aspectwerkz-jdk5</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.twitter</groupId>
|
||||
<artifactId>scala-stats</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.lag</groupId>
|
||||
<artifactId>configgy</artifactId>
|
||||
|
|
@ -52,21 +47,11 @@
|
|||
<artifactId>guice-core</artifactId>
|
||||
<version>2.0-beta-4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-core</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
<version>3.1.0.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache</groupId>
|
||||
<artifactId>zookeeper</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-tools</groupId>
|
||||
<artifactId>javautils</artifactId>
|
||||
|
|
@ -115,78 +100,6 @@
|
|||
<version>0.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- For Mongo -->
|
||||
<dependency>
|
||||
<groupId>com.mongodb</groupId>
|
||||
<artifactId>mongo</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Cassandra -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cassandra</groupId>
|
||||
<artifactId>cassandra</artifactId>
|
||||
<version>0.4.0-trunk</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.facebook</groupId>
|
||||
<artifactId>thrift</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.facebook</groupId>
|
||||
<artifactId>fb303</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
<version>1.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Jersey & Atmosphere -->
|
||||
<dependency>
|
||||
<groupId>com.sun.grizzly</groupId>
|
||||
<artifactId>grizzly-comet-webserver</artifactId>
|
||||
<version>1.8.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
<version>1.1.1-ea</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-json</artifactId>
|
||||
<version>1.1.1-ea</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>jsr311-api</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey.contribs</groupId>
|
||||
<artifactId>jersey-scala</artifactId>
|
||||
<version>1.1.2-ea-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-core</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-portable-runtime</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-compat</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For third-party logging -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
@ -225,50 +138,6 @@
|
|||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-executable-jar</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>
|
||||
jar-with-dependencies
|
||||
</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>se.scalablesolutions.akka.kernel.Kernel</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>install</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy file="target/akka-kernel-${akka.version}-jar-with-dependencies.jar"
|
||||
tofile="../dist/akka-${akka.version}.jar"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
43
akka-camel/pom.xml
Normal file
43
akka-camel/pom.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>akka-camel</artifactId>
|
||||
<name>Akka Camel Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>akka</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<!-- Core deps -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>akka-actors</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-core</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>META-INF/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
90
akka-kernel/pom.xml
Normal file
90
akka-kernel/pom.xml
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>akka-kernel</artifactId>
|
||||
<name>Akka Kernel Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>akka</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<!-- Core deps -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>akka-actors</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2-beta-2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create-executable-jar</id>
|
||||
<phase>install</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>
|
||||
jar-with-dependencies
|
||||
</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>se.scalablesolutions.akka.kernel.Kernel</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>install</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy file="target/akka-kernel-${akka.version}-jar-with-dependencies.jar"
|
||||
tofile="../dist/akka-${akka.version}.jar"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>../config</directory>
|
||||
<includes>
|
||||
<include>akka.conf</include>
|
||||
<include>akka-reference.conf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<filtering>false</filtering>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>META-INF/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
54
akka-persistence/pom.xml
Normal file
54
akka-persistence/pom.xml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>akka-persistence</artifactId>
|
||||
<name>Akka Persistence Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>akka</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>akka-kernel</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Mongo -->
|
||||
<dependency>
|
||||
<groupId>com.mongodb</groupId>
|
||||
<artifactId>mongo</artifactId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Cassandra -->
|
||||
<dependency>
|
||||
<groupId>org.apache.cassandra</groupId>
|
||||
<artifactId>cassandra</artifactId>
|
||||
<version>0.4.0-trunk</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.facebook</groupId>
|
||||
<artifactId>thrift</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.facebook</groupId>
|
||||
<artifactId>fb303</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
<version>1.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -11,8 +11,8 @@ import org.codehaus.aspectwerkz.proxy.Uuid
|
|||
|
||||
import scala.collection.mutable.{ArrayBuffer, HashMap}
|
||||
|
||||
sealed abstract class TransactionalStateConfig
|
||||
abstract class PersistentStorageConfig extends TransactionalStateConfig
|
||||
sealed abstract class PersistentStateConfig
|
||||
abstract class PersistentStorageConfig extends PersistentStateConfig
|
||||
case class CassandraStorageConfig extends PersistentStorageConfig
|
||||
case class TerracottaStorageConfig extends PersistentStorageConfig
|
||||
case class TokyoCabinetStorageConfig extends PersistentStorageConfig
|
||||
|
|
@ -23,146 +23,41 @@ case class MongoStorageConfig extends PersistentStorageConfig
|
|||
* <p/>
|
||||
* Example Scala usage:
|
||||
* <pre>
|
||||
* val myMap = TransactionalState.newPersistentMap(CassandraStorageConfig)
|
||||
* val myMap = PersistentState.newMap(CassandraStorageConfig)
|
||||
* </pre>
|
||||
*/
|
||||
object TransactionalState extends TransactionalState
|
||||
object PersistentState extends PersistentState
|
||||
|
||||
/**
|
||||
* Java API.
|
||||
* <p/>
|
||||
* Example Java usage:
|
||||
* <pre>
|
||||
* TransactionalState state = new TransactionalState();
|
||||
* TransactionalMap myMap = state.newPersistentMap(new CassandraStorageConfig());
|
||||
* PersistentState state = new PersistentState();
|
||||
* TransactionalMap myMap = state.newMap(new CassandraStorageConfig());
|
||||
* </pre>
|
||||
*/
|
||||
class TransactionalState {
|
||||
def newPersistentMap(config: PersistentStorageConfig): TransactionalMap[AnyRef, AnyRef] = config match {
|
||||
class PersistentState {
|
||||
def newMap(config: PersistentStorageConfig): TransactionalMap[AnyRef, AnyRef] = config match {
|
||||
case CassandraStorageConfig() => new CassandraPersistentTransactionalMap
|
||||
case MongoStorageConfig() => new MongoPersistentTransactionalMap
|
||||
case TerracottaStorageConfig() => throw new UnsupportedOperationException
|
||||
case TokyoCabinetStorageConfig() => throw new UnsupportedOperationException
|
||||
}
|
||||
|
||||
def newPersistentVector(config: PersistentStorageConfig): TransactionalVector[AnyRef] = config match {
|
||||
def newVector(config: PersistentStorageConfig): TransactionalVector[AnyRef] = config match {
|
||||
case CassandraStorageConfig() => new CassandraPersistentTransactionalVector
|
||||
case MongoStorageConfig() => new MongoPersistentTransactionalVector
|
||||
case TerracottaStorageConfig() => throw new UnsupportedOperationException
|
||||
case TokyoCabinetStorageConfig() => throw new UnsupportedOperationException
|
||||
}
|
||||
|
||||
def newPersistentRef(config: PersistentStorageConfig): TransactionalRef[AnyRef] = config match {
|
||||
def newRef(config: PersistentStorageConfig): TransactionalRef[AnyRef] = config match {
|
||||
case CassandraStorageConfig() => new CassandraPersistentTransactionalRef
|
||||
case MongoStorageConfig() => new MongoPersistentTransactionalRef
|
||||
case TerracottaStorageConfig() => throw new UnsupportedOperationException
|
||||
case TokyoCabinetStorageConfig() => throw new UnsupportedOperationException
|
||||
}
|
||||
|
||||
def newInMemoryMap[K, V]: TransactionalMap[K, V] = new InMemoryTransactionalMap[K, V]
|
||||
|
||||
def newInMemoryVector[T]: TransactionalVector[T] = new InMemoryTransactionalVector[T]
|
||||
|
||||
def newInMemoryRef[T]: TransactionalRef[T] = new TransactionalRef[T]
|
||||
}
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
@serializable
|
||||
trait Transactional {
|
||||
// FIXME: won't work across the cluster
|
||||
val uuid = Uuid.newUuid.toString
|
||||
|
||||
private[kernel] def begin
|
||||
private[kernel] def commit
|
||||
private[kernel] def rollback
|
||||
|
||||
protected def verifyTransaction = {
|
||||
val cflowTx = TransactionManagement.threadBoundTx.get
|
||||
if (!cflowTx.isDefined) {
|
||||
throw new IllegalStateException("Can't access transactional reference outside the scope of a transaction [" + this + "]")
|
||||
} else {
|
||||
cflowTx.get.register(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base trait for all state implementations (persistent or in-memory).
|
||||
*
|
||||
* FIXME: Create Java versions using pcollections
|
||||
*
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
trait TransactionalMap[K, V] extends Transactional with scala.collection.mutable.Map[K, V] {
|
||||
override def hashCode: Int = System.identityHashCode(this);
|
||||
override def equals(other: Any): Boolean = false
|
||||
def remove(key: K)
|
||||
}
|
||||
|
||||
/**
|
||||
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
|
||||
*
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
class InMemoryTransactionalMap[K, V] extends TransactionalMap[K, V] {
|
||||
protected[kernel] var state = new HashTrie[K, V]
|
||||
protected[kernel] var snapshot = state
|
||||
|
||||
// ---- For Transactional ----
|
||||
override def begin = snapshot = state
|
||||
override def commit = snapshot = state
|
||||
override def rollback = state = snapshot
|
||||
|
||||
// ---- Overriding scala.collection.mutable.Map behavior ----
|
||||
override def contains(key: K): Boolean = {
|
||||
verifyTransaction
|
||||
state.contains(key)
|
||||
}
|
||||
|
||||
override def clear = {
|
||||
verifyTransaction
|
||||
state = new HashTrie[K, V]
|
||||
}
|
||||
|
||||
override def size: Int = {
|
||||
verifyTransaction
|
||||
state.size
|
||||
}
|
||||
|
||||
// ---- For scala.collection.mutable.Map ----
|
||||
override def remove(key: K) = {
|
||||
verifyTransaction
|
||||
state = state - key
|
||||
}
|
||||
|
||||
override def elements: Iterator[(K, V)] = {
|
||||
// verifyTransaction
|
||||
state.elements
|
||||
}
|
||||
|
||||
override def get(key: K): Option[V] = {
|
||||
verifyTransaction
|
||||
state.get(key)
|
||||
}
|
||||
|
||||
override def put(key: K, value: V): Option[V] = {
|
||||
verifyTransaction
|
||||
val oldValue = state.get(key)
|
||||
state = state.update(key, value)
|
||||
oldValue
|
||||
}
|
||||
|
||||
override def -=(key: K) = {
|
||||
verifyTransaction
|
||||
remove(key)
|
||||
}
|
||||
|
||||
override def update(key: K, value: V) = {
|
||||
verifyTransaction
|
||||
put(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -315,77 +210,6 @@ class MongoPersistentTransactionalMap extends TemplatePersistentTransactionalMap
|
|||
val storage = MongoStorage
|
||||
}
|
||||
|
||||
/**
|
||||
* Base for all transactional vector implementations.
|
||||
*
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
abstract class TransactionalVector[T] extends Transactional with RandomAccessSeq[T] {
|
||||
override def hashCode: Int = System.identityHashCode(this);
|
||||
override def equals(other: Any): Boolean = false
|
||||
|
||||
def add(elem: T)
|
||||
|
||||
def get(index: Int): T
|
||||
|
||||
def getRange(start: Int, count: Int): List[T]
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements an in-memory transactional vector.
|
||||
*
|
||||
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
|
||||
*
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
class InMemoryTransactionalVector[T] extends TransactionalVector[T] {
|
||||
private[kernel] var state: Vector[T] = EmptyVector
|
||||
private[kernel] var snapshot = state
|
||||
|
||||
def add(elem: T) = {
|
||||
verifyTransaction
|
||||
state = state + elem
|
||||
}
|
||||
|
||||
def get(index: Int): T = {
|
||||
verifyTransaction
|
||||
state(index)
|
||||
}
|
||||
|
||||
def getRange(start: Int, count: Int): List[T] = {
|
||||
verifyTransaction
|
||||
state.slice(start, count).toList.asInstanceOf[List[T]]
|
||||
}
|
||||
|
||||
// ---- For Transactional ----
|
||||
override def begin = snapshot = state
|
||||
|
||||
override def commit = snapshot = state
|
||||
|
||||
override def rollback = state = snapshot
|
||||
|
||||
// ---- For Seq ----
|
||||
def length: Int = {
|
||||
verifyTransaction
|
||||
state.length
|
||||
}
|
||||
|
||||
def apply(index: Int): T = {
|
||||
verifyTransaction
|
||||
state(index)
|
||||
}
|
||||
|
||||
override def elements: Iterator[T] = {
|
||||
//verifyTransaction
|
||||
state.elements
|
||||
}
|
||||
|
||||
override def toList: List[T] = {
|
||||
verifyTransaction
|
||||
state.toList
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for all persistent transactional vector implementations should extend.
|
||||
* Implements a Unit of Work, records changes into a change set.
|
||||
|
|
@ -477,44 +301,6 @@ class MongoPersistentTransactionalVector extends TemplatePersistentTransactional
|
|||
val storage = MongoStorage
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a transactional reference.
|
||||
*
|
||||
* Not thread-safe, but should only be using from within an Actor, e.g. one single thread at a time.
|
||||
*
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
class TransactionalRef[T] extends Transactional {
|
||||
private[kernel] var ref: Option[T] = None
|
||||
private[kernel] var snapshot: Option[T] = None
|
||||
|
||||
override def begin = if (ref.isDefined) snapshot = Some(ref.get)
|
||||
|
||||
override def commit = if (ref.isDefined) snapshot = Some(ref.get)
|
||||
|
||||
override def rollback = if (snapshot.isDefined) ref = Some(snapshot.get)
|
||||
|
||||
def swap(elem: T) = {
|
||||
verifyTransaction
|
||||
ref = Some(elem)
|
||||
}
|
||||
|
||||
def get: Option[T] = {
|
||||
verifyTransaction
|
||||
ref
|
||||
}
|
||||
|
||||
def getOrElse(default: => T): T = {
|
||||
verifyTransaction
|
||||
ref.getOrElse(default)
|
||||
}
|
||||
|
||||
def isDefined: Boolean = {
|
||||
verifyTransaction
|
||||
ref.isDefined
|
||||
}
|
||||
}
|
||||
|
||||
abstract class TemplatePersistentTransactionalRef extends TransactionalRef[AnyRef] {
|
||||
val storage: RefStorage
|
||||
|
||||
68
akka-rest/pom.xml
Normal file
68
akka-rest/pom.xml
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>akka-rest</artifactId>
|
||||
<name>Akka REST Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>akka</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<!-- Core deps -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>akka-actors</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.6</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Jersey & Atmosphere -->
|
||||
<dependency>
|
||||
<groupId>com.sun.grizzly</groupId>
|
||||
<artifactId>grizzly-comet-webserver</artifactId>
|
||||
<version>1.8.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-server</artifactId>
|
||||
<version>1.1.1-ea</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-json</artifactId>
|
||||
<version>1.1.1-ea</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>jsr311-api</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey.contribs</groupId>
|
||||
<artifactId>jersey-scala</artifactId>
|
||||
<version>1.1.2-ea-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-core</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-portable-runtime</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atmosphere</groupId>
|
||||
<artifactId>atmosphere-compat</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
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