Merge branch 'master' of git://github.com/jboner/akka
This commit is contained in:
commit
814f05a6fd
5 changed files with 55 additions and 223 deletions
|
|
@ -1,127 +0,0 @@
|
|||
<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-core</artifactId>
|
||||
<name>Akka Core - Actors, Remote Actors, Transactors and STM Module</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<artifactId>akka</artifactId>
|
||||
<groupId>se.scalablesolutions.akka</groupId>
|
||||
<version>0.7-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<!-- Core deps -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>akka-util-java</artifactId>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>akka-util</artifactId>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-lang</groupId>
|
||||
<artifactId>scala-library</artifactId>
|
||||
<version>${scala.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.aspectwerkz</groupId>
|
||||
<artifactId>aspectwerkz-nodeps-jdk5</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.aspectwerkz</groupId>
|
||||
<artifactId>aspectwerkz-jdk5</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
<version>3.2.0.ALPHA3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.scala-tools</groupId>
|
||||
<artifactId>javautils</artifactId>
|
||||
<version>2.7.4-0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Protocol/Serialization -->
|
||||
<dependency>
|
||||
<groupId>voldemort.store.compress</groupId>
|
||||
<artifactId>h2-lzf</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-core-asl</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>sbinary</groupId>
|
||||
<artifactId>sbinary</artifactId>
|
||||
<version>0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.databinder</groupId>
|
||||
<artifactId>dispatch-json_2.7.7</artifactId>
|
||||
<version>0.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.databinder</groupId>
|
||||
<artifactId>dispatch-http_2.7.7</artifactId>
|
||||
<version>0.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>sjson.json</groupId>
|
||||
<artifactId>sjson</artifactId>
|
||||
<version>0.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- For Testing -->
|
||||
<dependency>
|
||||
<groupId>org.scalatest</groupId>
|
||||
<artifactId>scalatest</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>
|
||||
se.scalablesolutions.akka.*;version=${project.version};-split-package:=merge-first
|
||||
</Export-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -3,11 +3,20 @@ package se.scalablesolutions.akka.actor
|
|||
import org.scalatest.junit.JUnitSuite
|
||||
import Actor._
|
||||
import java.util.concurrent.{CountDownLatch, TimeUnit}
|
||||
import org.junit.{After, Test}
|
||||
import se.scalablesolutions.akka.config.ScalaConfig._
|
||||
import org.multiverse.api.latches.StandardLatch
|
||||
import org.junit.Test
|
||||
|
||||
class SchedulerSpec extends JUnitSuite {
|
||||
|
||||
@Test def schedulerShouldScheduleMoreThanOnce = {
|
||||
def withCleanEndState(action: => Unit) {
|
||||
action
|
||||
Scheduler.restart
|
||||
ActorRegistry.shutdownAll
|
||||
}
|
||||
|
||||
|
||||
@Test def schedulerShouldScheduleMoreThanOnce = withCleanEndState {
|
||||
|
||||
case object Tick
|
||||
val countDownLatch = new CountDownLatch(3)
|
||||
|
|
@ -21,7 +30,7 @@ class SchedulerSpec extends JUnitSuite {
|
|||
assert(countDownLatch.await(1, TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test def schedulerShouldScheduleOnce = {
|
||||
@Test def schedulerShouldScheduleOnce = withCleanEndState {
|
||||
case object Tick
|
||||
val countDownLatch = new CountDownLatch(2)
|
||||
val tickActor = actor {
|
||||
|
|
@ -35,4 +44,44 @@ class SchedulerSpec extends JUnitSuite {
|
|||
// should still be 1 left
|
||||
assert(countDownLatch.getCount == 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* ticket #307
|
||||
*/
|
||||
@Test def actorRestartShouldPickUpScheduleAgain = withCleanEndState {
|
||||
|
||||
object Ping
|
||||
object Crash
|
||||
|
||||
val restartLatch = new StandardLatch
|
||||
val pingLatch = new CountDownLatch(6)
|
||||
|
||||
val actor = actorOf(new Actor {
|
||||
self.lifeCycle = Some(LifeCycle(Permanent))
|
||||
|
||||
def receive = {
|
||||
case Ping => pingLatch.countDown
|
||||
case Crash => throw new Exception("CRASH")
|
||||
}
|
||||
|
||||
override def postRestart(reason: Throwable) = restartLatch.open
|
||||
})
|
||||
|
||||
Supervisor(
|
||||
SupervisorConfig(
|
||||
RestartStrategy(AllForOne, 3, 1000,
|
||||
List(classOf[Exception])),
|
||||
Supervise(
|
||||
actor,
|
||||
LifeCycle(Permanent))
|
||||
:: Nil)).start
|
||||
|
||||
Scheduler.schedule(actor, Ping, 500, 500, TimeUnit.MILLISECONDS)
|
||||
// appx 2 pings before crash
|
||||
Scheduler.scheduleOnce(actor, Crash, 1000, TimeUnit.MILLISECONDS)
|
||||
|
||||
assert(restartLatch.tryAwait(2, TimeUnit.SECONDS))
|
||||
// should be enough time for the ping countdown to recover and reach 6 pings
|
||||
assert(pingLatch.await(4, TimeUnit.SECONDS))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,10 +78,8 @@ private[akka] object MongoStorageBackend extends
|
|||
val o = dbo.get(VALUE).asInstanceOf[Map[AnyRef, AnyRef]]
|
||||
o.putAll(m)
|
||||
|
||||
// remove existing reference
|
||||
removeMapStorageFor(name)
|
||||
// and insert
|
||||
coll.insert(new BasicDBObject().append(KEY, name).append(VALUE, o))
|
||||
val newdbo = new BasicDBObject().append(KEY, name).append(VALUE, o)
|
||||
coll.update(new BasicDBObject().append(KEY, name), newdbo, true, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
|||
|
||||
lazy val log4j = "log4j" % "log4j" % "1.2.15" % "compile"
|
||||
|
||||
lazy val mongo = "org.mongodb" % "mongo-java-driver" % "1.4" % "compile"
|
||||
lazy val mongo = "org.mongodb" % "mongo-java-driver" % "2.0" % "compile"
|
||||
|
||||
lazy val multiverse = "org.multiverse" % "multiverse-alpha" % MULTIVERSE_VERSION % "compile" intransitive
|
||||
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
/*---------------------------------------------------------------------------\
|
||||
| Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se> |
|
||||
\---------------------------------------------------------------------------*/
|
||||
|
||||
import sbt._
|
||||
import sbt.CompileOrder._
|
||||
import spde._
|
||||
|
||||
import java.util.jar.Attributes
|
||||
import java.util.jar.Attributes.Name._
|
||||
import java.io.File
|
||||
|
||||
import com.weiglewilczek.bnd4sbt._
|
||||
|
||||
trait AkkaWrappersProject extends DefaultProject {
|
||||
|
||||
// ------------------------------------------------------------
|
||||
// project versions
|
||||
val JERSEY_VERSION:String
|
||||
val ATMO_VERSION:String
|
||||
val CASSANDRA_VERSION:String
|
||||
val LIFT_VERSION:String
|
||||
val SCALATEST_VERSION:String
|
||||
val MULTIVERSE_VERSION:String
|
||||
|
||||
// OSGi wrappers
|
||||
lazy val akka_wrappers = project("akka-wrap", "akka-wrap", new AkkaWrappersParentProject(_))
|
||||
|
||||
import Process._
|
||||
lazy val publishLocalMvnWrapped = runMvnInstallWrapped
|
||||
def runMvnInstallWrapped = task {
|
||||
for (absPath <- wrappedArtifacts.getPaths) {
|
||||
val artifactRE = """.*/([^/]+)-([^-]+).jar""".r
|
||||
val artifactRE(artifactId, artifactVersion) = absPath
|
||||
val command = "mvn install:install-file" +
|
||||
" -Dfile=" + absPath +
|
||||
" -DgroupId=se.scalablesolutions.akka.akka-wrap" +
|
||||
" -DartifactId=" + artifactId +
|
||||
" -Dversion=" + artifactVersion +
|
||||
" -Dpackaging=jar -DgeneratePom=true"
|
||||
command ! log
|
||||
}
|
||||
None
|
||||
} dependsOn(`package`) describedAs("Run mvn install for wrapped artifacts in akka-wrap.")
|
||||
|
||||
// ================= OSGi Wrappers ==================
|
||||
class JgroupsWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) {
|
||||
override def wrappedVersion = "2.9.0.GA"
|
||||
override def bndImportPackage = Seq("org.testng.*;resolution:=optional",
|
||||
"org.bouncycastle.jce.provider;resolution:=optional",
|
||||
"bsh;resolution:=optional",
|
||||
"*")
|
||||
|
||||
val jgroups = "jgroups" % "jgroups" % wrappedVersion % "compile"
|
||||
}
|
||||
|
||||
class DispatchJsonWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) {
|
||||
override def wrappedVersion = "0.7.4"
|
||||
|
||||
val dispatch_json = "net.databinder" % "dispatch-json_2.8.0.RC3" % wrappedVersion % "compile"
|
||||
}
|
||||
|
||||
class MultiverseWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) {
|
||||
override def wrappedVersion = "0.5.2"
|
||||
|
||||
val multiverse = "org.multiverse" % "multiverse-alpha" % wrappedVersion % "compile"
|
||||
}
|
||||
|
||||
class AkkaWrappersParentProject(info: ProjectInfo) extends ParentProject(info) {
|
||||
lazy val jgroups_wrapper = project("jgroups-wrapper", "jgroups-wrapper",
|
||||
new JgroupsWrapperProject(_))
|
||||
lazy val dispath_json = project("dispatch-json", "dispatch-json",
|
||||
new DispatchJsonWrapperProject(_))
|
||||
lazy val multiverse_wrapper = project("multiverse-wrapper", "multiverse-wrapper",
|
||||
new MultiverseWrapperProject(_))
|
||||
}
|
||||
|
||||
def wrappedArtifacts = descendents(info.projectPath / "akka-wrap", "*" + buildScalaVersion + "_osgi-" + "*.jar")
|
||||
|
||||
abstract class OSGiWrapperProject(info: ProjectInfo) extends DefaultProject(info) with BNDPlugin {
|
||||
def wrappedVersion:String
|
||||
override def version = OpaqueVersion(wrappedVersion)
|
||||
override def artifactID = moduleID + "_osgi"
|
||||
override def bndExportPackage = Seq("*")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue