Merge branch 'master' of github.com:jboner/akka
This commit is contained in:
commit
bc29b0ef2e
7 changed files with 46 additions and 45 deletions
|
|
@ -159,7 +159,7 @@ object ActorRegistry extends ListenerManagement {
|
||||||
/**
|
/**
|
||||||
* Shuts down and unregisters all actors in the system.
|
* Shuts down and unregisters all actors in the system.
|
||||||
*/
|
*/
|
||||||
def shutdownAll = {
|
def shutdownAll() {
|
||||||
log.info("Shutting down all actors in the system...")
|
log.info("Shutting down all actors in the system...")
|
||||||
foreach(_.stop)
|
foreach(_.stop)
|
||||||
actorsByUUID.clear
|
actorsByUUID.clear
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ private [akka] object RedisStorageBackend extends
|
||||||
// need an explicit definition in akka-conf
|
// need an explicit definition in akka-conf
|
||||||
val nodes = config.getList("akka.storage.redis.cluster")
|
val nodes = config.getList("akka.storage.redis.cluster")
|
||||||
|
|
||||||
val db =
|
def connect() =
|
||||||
nodes match {
|
nodes match {
|
||||||
case Seq() =>
|
case Seq() =>
|
||||||
// no cluster defined
|
// no cluster defined
|
||||||
|
|
@ -89,6 +89,8 @@ private [akka] object RedisStorageBackend extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var db = connect()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map storage in Redis.
|
* Map storage in Redis.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
@ -411,6 +413,10 @@ private [akka] object RedisStorageBackend extends
|
||||||
try {
|
try {
|
||||||
body
|
body
|
||||||
} catch {
|
} catch {
|
||||||
|
case e: RedisConnectionException => {
|
||||||
|
db = connect()
|
||||||
|
body
|
||||||
|
}
|
||||||
case e: java.lang.NullPointerException =>
|
case e: java.lang.NullPointerException =>
|
||||||
throw new StorageException("Could not connect to Redis server")
|
throw new StorageException("Could not connect to Redis server")
|
||||||
case e =>
|
case e =>
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
/**
|
|
||||||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package sample.osgi
|
|
||||||
|
|
||||||
import org.osgi.framework.{BundleActivator, BundleContext}
|
|
||||||
|
|
||||||
|
|
||||||
class Activator extends BundleActivator {
|
|
||||||
|
|
||||||
def start(context: BundleContext) {
|
|
||||||
println("Start")
|
|
||||||
val osgiActor = new OSGiActor
|
|
||||||
//osgiActor ! "Hello"
|
|
||||||
Unit
|
|
||||||
}
|
|
||||||
|
|
||||||
def stop(context: BundleContext) {
|
|
||||||
println("stop")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package sample.osgi
|
|
||||||
|
|
||||||
import se.scalablesolutions.akka.actor.Actor
|
|
||||||
|
|
||||||
|
|
||||||
class OSGiActor extends Actor {
|
|
||||||
def receive = {
|
|
||||||
case msg: String =>
|
|
||||||
println("Got message: " + msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||||
|
*/
|
||||||
|
|
||||||
|
package se.scalablesolutions.akka
|
||||||
|
package sample.osgi
|
||||||
|
|
||||||
|
import actor.{ Actor, ActorRegistry }
|
||||||
|
import actor.Actor._
|
||||||
|
|
||||||
|
import org.osgi.framework.{ BundleActivator, BundleContext }
|
||||||
|
|
||||||
|
class Activator extends BundleActivator {
|
||||||
|
|
||||||
|
def start(context: BundleContext) {
|
||||||
|
println("Starting the OSGi example ...")
|
||||||
|
val echo = actorOf[EchoActor].start
|
||||||
|
val answer = (echo !! "OSGi example")
|
||||||
|
println(answer getOrElse "No answer!")
|
||||||
|
}
|
||||||
|
|
||||||
|
def stop(context: BundleContext) {
|
||||||
|
ActorRegistry.shutdownAll()
|
||||||
|
println("Stopped the OSGi example.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EchoActor extends Actor {
|
||||||
|
|
||||||
|
override def receive = {
|
||||||
|
case x => self reply x
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
|
@ -170,6 +170,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
|
|
||||||
lazy val protobuf = "com.google.protobuf" % "protobuf-java" % "2.3.0" % "compile"
|
lazy val protobuf = "com.google.protobuf" % "protobuf-java" % "2.3.0" % "compile"
|
||||||
|
|
||||||
|
lazy val osgi_core = "org.osgi" % "org.osgi.core" % "4.2.0"
|
||||||
|
|
||||||
lazy val rabbit = "com.rabbitmq" % "amqp-client" % "1.8.1" % "compile"
|
lazy val rabbit = "com.rabbitmq" % "amqp-client" % "1.8.1" % "compile"
|
||||||
|
|
||||||
lazy val redis = "com.redis" % "redisclient" % "2.8.0-1.4" % "compile"
|
lazy val redis = "com.redis" % "redisclient" % "2.8.0-1.4" % "compile"
|
||||||
|
|
@ -646,13 +648,9 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AkkaSampleOSGiProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin {
|
class AkkaSampleOSGiProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin {
|
||||||
override def bndClasspath = compileClasspath
|
val osgi_core = Dependencies.osgi_core
|
||||||
|
override lazy val bndBundleActivator = Some("se.scalablesolutions.akka.sample.osgi.Activator")
|
||||||
val osgi_core = "org.osgi" % "org.osgi.core" % "4.2.0"
|
override lazy val bndExportPackage = Nil // Necessary because of mixing-in AkkaDefaultProject which exports all ...akka.* packages!
|
||||||
|
|
||||||
override def bndBundleActivator = Some("sample.osgi.Activator")
|
|
||||||
override def bndPrivatePackage = Nil
|
|
||||||
override def bndExportPackage = Seq("sample.osgi.*;version=0.9")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AkkaSamplesParentProject(info: ProjectInfo) extends ParentProject(info) {
|
class AkkaSamplesParentProject(info: ProjectInfo) extends ParentProject(info) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue