Fixing ticket #450, lifeCycle = Permanent => boilerplate reduction

This commit is contained in:
Viktor Klang 2010-10-04 11:18:10 +02:00
parent 099820a258
commit 3efb427ca1
27 changed files with 103 additions and 112 deletions

View file

@ -159,7 +159,7 @@ object Actor extends Logging {
*/
def actor(body: Receive): ActorRef =
actorOf(new Actor() {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
def receive: Receive = body
}).start
@ -181,7 +181,7 @@ object Actor extends Logging {
*/
def transactor(body: Receive): ActorRef =
actorOf(new Transactor() {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
def receive: Receive = body
}).start
@ -201,7 +201,7 @@ object Actor extends Logging {
*/
def temporaryActor(body: Receive): ActorRef =
actorOf(new Actor() {
self.lifeCycle = Some(LifeCycle(Temporary))
self.lifeCycle = Temporary
def receive = body
}).start
@ -226,7 +226,7 @@ object Actor extends Logging {
def handler[A](body: => Unit) = new {
def receive(handler: Receive) =
actorOf(new Actor() {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
body
def receive = handler
}).start

View file

@ -160,12 +160,6 @@ trait ActorRef extends ActorRefShared with TransactionManagement with Logging wi
def setFaultHandler(handler: FaultHandlingStrategy) = this.faultHandler = Some(handler)
def getFaultHandler(): Option[FaultHandlingStrategy] = faultHandler
/**
* Defines the life-cycle for a supervised actor.
*/
def setLifeCycle(lifeCycle: LifeCycle) = this.lifeCycle = Some(lifeCycle)
def getLifeCycle(): Option[LifeCycle] = lifeCycle
@volatile
private[akka] var _dispatcher: MessageDispatcher = Dispatchers.defaultGlobalDispatcher
@ -698,7 +692,7 @@ class LocalActorRef private[akka] (
__isTransactor: Boolean,
__timeout: Long,
__receiveTimeout: Option[Long],
__lifeCycle: Option[LifeCycle],
__lifeCycle: LifeCycle,
__supervisor: Option[ActorRef],
__hotswap: Option[PartialFunction[Any, Unit]],
__factory: () => Actor) = {
@ -1088,7 +1082,7 @@ class LocalActorRef private[akka] (
val failedActor = actorInstance.get
guard.withGuard {
lifeCycle match {
case Some(LifeCycle(Temporary)) => shutDownTemporaryActor(this)
case Temporary => shutDownTemporaryActor(this)
case _ =>
// either permanent or none where default is permanent
Actor.log.info("Restarting actor [%s] configured as PERMANENT.", id)
@ -1109,7 +1103,7 @@ class LocalActorRef private[akka] (
linkedActorsAsList.foreach { actorRef =>
actorRef.lifeCycle match {
// either permanent or none where default is permanent
case Some(LifeCycle(Temporary)) => shutDownTemporaryActor(actorRef)
case Temporary => shutDownTemporaryActor(actorRef)
case _ => actorRef.restart(reason, maxNrOfRetries, withinTimeRange)
}
}
@ -1274,7 +1268,7 @@ class LocalActorRef private[akka] (
if (supervisor.isDefined) notifySupervisorWithMessage(Exit(this, reason))
else {
lifeCycle match {
case Some(LifeCycle(Temporary)) => shutDownTemporaryActor(this)
case Temporary => shutDownTemporaryActor(this)
case _ =>
}
}
@ -1495,7 +1489,8 @@ trait ScalaActorRef extends ActorRefShared { ref: ActorRef =>
* Defines the life-cycle for a supervised actor.
*/
@volatile
var lifeCycle: Option[LifeCycle] = None
@BeanProperty
var lifeCycle: LifeCycle = UndefinedLifeCycle
/**
* User overridable callback/setting.

View file

@ -29,10 +29,10 @@ class SupervisorException private[akka](message: String) extends AkkaException(m
* RestartStrategy(OneForOne, 3, 10, List(classOf[Exception]),
* Supervise(
* myFirstActor,
* LifeCycle(Permanent)) ::
* Permanent) ::
* Supervise(
* mySecondActor,
* LifeCycle(Permanent)) ::
* Permanent) ::
* Nil))
* </pre>
*
@ -60,10 +60,10 @@ object Supervisor {
* RestartStrategy(OneForOne, 3, 10, List(classOf[Exception]),
* Supervise(
* myFirstActor,
* LifeCycle(Permanent)) ::
* Permanent) ::
* Supervise(
* mySecondActor,
* LifeCycle(Permanent)) ::
* Permanent) ::
* Nil))
* </pre>
*
@ -160,7 +160,7 @@ sealed class Supervisor private[akka] (
else list
}
_childActors.put(className, actorRef :: currentActors)
actorRef.lifeCycle = Some(lifeCycle)
actorRef.lifeCycle = lifeCycle
supervisor.link(actorRef)
remoteAddress.foreach { address =>
RemoteServerModule.registerActor(

View file

@ -32,12 +32,13 @@ object ScalaConfig {
abstract class Server extends ConfigElement
abstract class FailOverScheme extends ConfigElement
abstract class Scope extends ConfigElement
abstract class LifeCycle extends ConfigElement
case class SupervisorConfig(restartStrategy: RestartStrategy, worker: List[Server]) extends Server
class Supervise(val actorRef: ActorRef, val lifeCycle: LifeCycle, _remoteAddress: RemoteAddress) extends Server {
val remoteAddress: Option[RemoteAddress] = if (_remoteAddress eq null) None else Some(_remoteAddress)
}
object Supervise {
def apply(actorRef: ActorRef, lifeCycle: LifeCycle, remoteAddress: RemoteAddress) = new Supervise(actorRef, lifeCycle, remoteAddress)
def apply(actorRef: ActorRef, lifeCycle: LifeCycle) = new Supervise(actorRef, lifeCycle, null)
@ -53,9 +54,9 @@ object ScalaConfig {
case object AllForOne extends FailOverScheme
case object OneForOne extends FailOverScheme
case class LifeCycle(scope: Scope) extends ConfigElement
case object Permanent extends Scope
case object Temporary extends Scope
case object Permanent extends LifeCycle
case object Temporary extends LifeCycle
case object UndefinedLifeCycle extends LifeCycle
case class RemoteAddress(val hostname: String, val port: Int) extends ConfigElement
@ -139,22 +140,22 @@ object JavaConfig {
scheme.transform, maxNrOfRetries, withinTimeRange, trapExceptions.toList)
}
class LifeCycle(@BeanProperty val scope: Scope) extends ConfigElement {
def transform = {
se.scalablesolutions.akka.config.ScalaConfig.LifeCycle(scope.transform)
}
abstract class LifeCycle extends ConfigElement {
def transform: se.scalablesolutions.akka.config.ScalaConfig.LifeCycle
}
abstract class Scope extends ConfigElement {
def transform: se.scalablesolutions.akka.config.ScalaConfig.Scope
}
class Permanent extends Scope {
class Permanent extends LifeCycle {
override def transform = se.scalablesolutions.akka.config.ScalaConfig.Permanent
}
class Temporary extends Scope {
class Temporary extends LifeCycle {
override def transform = se.scalablesolutions.akka.config.ScalaConfig.Temporary
}
class UndefinedLifeCycle extends LifeCycle {
override def transform = se.scalablesolutions.akka.config.ScalaConfig.UndefinedLifeCycle
}
abstract class FailOverScheme extends ConfigElement {
def transform: se.scalablesolutions.akka.config.ScalaConfig.FailOverScheme
}

View file

@ -20,7 +20,7 @@ object ActorFireForgetRequestReplySpec {
}
class CrashingTemporaryActor extends Actor {
self.lifeCycle = Some(LifeCycle(Temporary))
self.lifeCycle = Temporary
def receive = {
case "Die" =>

View file

@ -58,10 +58,10 @@ class SupervisorMiscSpec extends WordSpec with MustMatchers {
val sup = Supervisor(
SupervisorConfig(
RestartStrategy(OneForOne, 3, 5000, List(classOf[Exception])),
Supervise(actor1, LifeCycle(Permanent)) ::
Supervise(actor2, LifeCycle(Permanent)) ::
Supervise(actor3, LifeCycle(Permanent)) ::
Supervise(actor4, LifeCycle(Permanent)) ::
Supervise(actor1, Permanent) ::
Supervise(actor2, Permanent) ::
Supervise(actor3, Permanent) ::
Supervise(actor4, Permanent) ::
Nil))
actor1 ! "kill"

View file

@ -78,7 +78,7 @@ object SupervisorSpec {
class TemporaryActor extends Actor {
import self._
lifeCycle = Some(LifeCycle(Temporary))
lifeCycle = Temporary
def receive = {
case Ping =>
messageLog.put("ping")
@ -506,7 +506,7 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 5000, List(classOf[Exception])),
Supervise(
temporaryActor,
LifeCycle(Temporary))
Temporary)
:: Nil))
}
@ -518,7 +518,7 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 5000, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
:: Nil))
}
@ -530,7 +530,7 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(OneForOne, 3, 5000, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
:: Nil))
}
@ -544,15 +544,15 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 5000, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil))
}
@ -566,15 +566,15 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(OneForOne, 3, 5000, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil))
}
@ -588,17 +588,17 @@ class SupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 5000, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
SupervisorConfig(
RestartStrategy(AllForOne, 3, 5000, Nil),
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil)
:: Nil))
}

View file

@ -98,7 +98,7 @@ class SchedulerSpec extends JUnitSuite {
val pingLatch = new CountDownLatch(6)
val actor = actorOf(new Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
def receive = {
case Ping => pingLatch.countDown
@ -113,7 +113,7 @@ class SchedulerSpec extends JUnitSuite {
List(classOf[Exception])),
Supervise(
actor,
LifeCycle(Permanent))
Permanent)
:: Nil)).start
Scheduler.schedule(actor, Ping, 500, 500, TimeUnit.MILLISECONDS)

View file

@ -16,7 +16,7 @@ private[amqp] class FaultTolerantConnectionActor(connectionParameters: Connectio
import connectionParameters._
self.id = "amqp-connection-%s".format(host)
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
self.trapExit = List(classOf[Throwable])
self.faultHandler = Some(OneForOneStrategy(5, 5000))

View file

@ -36,7 +36,7 @@ case class VADD_WITH_SLICE(vsToAdd: List[String], start: Int, cnt: Int)
object Storage {
class HbaseSampleMapStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_MAP = "akka.sample.map"
private var fooMap = atomic { HbaseStorage.getMap(FOO_MAP) }
@ -119,7 +119,7 @@ object Storage {
}
class HbaseSampleVectorStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_VECTOR = "akka.sample.vector"
private var fooVector = atomic { HbaseStorage.getVector(FOO_VECTOR) }

View file

@ -36,7 +36,7 @@ case class VADD_WITH_SLICE(vsToAdd: List[String], start: Int, cnt: Int)
object Storage {
class MongoSampleMapStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_MAP = "akka.sample.map"
private var fooMap = atomic { MongoStorage.getMap(FOO_MAP) }
@ -119,7 +119,7 @@ object Storage {
}
class MongoSampleVectorStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_VECTOR = "akka.sample.vector"
private var fooVector = atomic { MongoStorage.getVector(FOO_VECTOR) }

View file

@ -28,7 +28,7 @@ case class SETFOO(s: String)
object SampleStorage {
class RedisSampleStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val EVENT_MAP = "akka.sample.map"
private var eventMap = atomic { RedisStorage.getMap(EVENT_MAP) }

View file

@ -41,7 +41,7 @@ case class VADD_WITH_SLICE(vsToAdd: List[String], start: Int, cnt: Int)
object Storage {
class RedisSampleMapStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_MAP = "akka.sample.map"
private var fooMap = atomic { RedisStorage.getMap(FOO_MAP) }
@ -134,7 +134,7 @@ object Storage {
}
class RedisSampleVectorStorage extends Actor {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val FOO_VECTOR = "akka.sample.vector"
private var fooVector = atomic { RedisStorage.getVector(FOO_VECTOR) }

View file

@ -241,7 +241,7 @@ object Cluster extends Cluster with Logging {
Some(Supervisor(
SupervisorConfig(
RestartStrategy(OneForOne, 5, 1000, List(classOf[Exception])),
Supervise(actor, LifeCycle(Permanent)) :: Nil)))
Supervise(actor, Permanent) :: Nil)))
private[this] def clusterActor = if (clusterActorRef.isEmpty) None else Some(clusterActorRef.get.actor.asInstanceOf[ClusterActor])

View file

@ -91,16 +91,10 @@ object ActorSerialization {
private[akka] def toSerializedActorRefProtocol[T <: Actor](
actorRef: ActorRef, format: Format[T], serializeMailBox: Boolean = true): SerializedActorRefProtocol = {
val lifeCycleProtocol: Option[LifeCycleProtocol] = {
def setScope(builder: LifeCycleProtocol.Builder, scope: Scope) = scope match {
case Permanent => builder.setLifeCycle(LifeCycleType.PERMANENT)
case Temporary => builder.setLifeCycle(LifeCycleType.TEMPORARY)
}
val builder = LifeCycleProtocol.newBuilder
actorRef.lifeCycle match {
case Some(LifeCycle(scope)) =>
setScope(builder, scope)
Some(builder.build)
case None => None
case Permanent => Some(LifeCycleProtocol.newBuilder.setLifeCycle(LifeCycleType.PERMANENT).build)
case Temporary => Some(LifeCycleProtocol.newBuilder.setLifeCycle(LifeCycleType.TEMPORARY).build)
case UndefinedLifeCycle => None//No need to send the undefined lifecycle over the wire //builder.setLifeCycle(LifeCycleType.UNDEFINED)
}
}
@ -164,11 +158,12 @@ object ActorSerialization {
val lifeCycle =
if (protocol.hasLifeCycle) {
val lifeCycleProtocol = protocol.getLifeCycle
Some(if (lifeCycleProtocol.getLifeCycle == LifeCycleType.PERMANENT) LifeCycle(Permanent)
else if (lifeCycleProtocol.getLifeCycle == LifeCycleType.TEMPORARY) LifeCycle(Temporary)
else throw new IllegalActorStateException("LifeCycle type is not valid: " + lifeCycleProtocol.getLifeCycle))
} else None
protocol.getLifeCycle.getLifeCycle match {
case LifeCycleType.PERMANENT => Permanent
case LifeCycleType.TEMPORARY => Temporary
case unknown => throw new IllegalActorStateException("LifeCycle type is not valid: " + unknown)
}
} else UndefinedLifeCycle
val supervisor =
if (protocol.hasSupervisor)

View file

@ -483,7 +483,7 @@ class RemoteSupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
:: Nil))
factory.newInstance
@ -499,7 +499,7 @@ class RemoteSupervisorSpec extends JUnitSuite {
RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
:: Nil))
factory.newInstance
}
@ -520,15 +520,15 @@ class RemoteSupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil))
factory.newInstance
}
@ -551,15 +551,15 @@ class RemoteSupervisorSpec extends JUnitSuite {
RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil))
factory.newInstance
}
@ -580,17 +580,17 @@ class RemoteSupervisorSpec extends JUnitSuite {
RestartStrategy(AllForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong1,
LifeCycle(Permanent))
Permanent)
::
SupervisorConfig(
RestartStrategy(AllForOne, 3, 100, List(classOf[Exception])),
Supervise(
pingpong2,
LifeCycle(Permanent))
Permanent)
::
Supervise(
pingpong3,
LifeCycle(Permanent))
Permanent)
:: Nil)
:: Nil))
factory.newInstance

View file

@ -55,13 +55,13 @@ class RemoteTypedActorSpec extends
new Component(
classOf[RemoteTypedActorOne],
classOf[RemoteTypedActorOneImpl],
new LifeCycle(new Permanent),
new Permanent,
10000,
new RemoteAddress("localhost", 9995)),
new Component(
classOf[RemoteTypedActorTwo],
classOf[RemoteTypedActorTwoImpl],
new LifeCycle(new Permanent),
new Permanent,
10000,
new RemoteAddress("localhost", 9995))
).toArray).supervise

View file

@ -27,8 +27,8 @@ class Boot {
//val supervisor = Supervisor(
// SupervisorConfig(
// RestartStrategy(OneForOne, 3, 100, List(classOf[Exception])),
// Supervise(actorOf[Consumer1], LifeCycle(Permanent)) ::
// Supervise(actorOf[Consumer2], LifeCycle(Permanent)) :: Nil))
// Supervise(actorOf[Consumer1], Permanent) ::
// Supervise(actorOf[Consumer2], Permanent) :: Nil))
// -----------------------------------------------------------------------
// Custom Camel route example

View file

@ -97,7 +97,7 @@ trait ChatStorage extends Actor
* Redis-backed chat storage implementation.
*/
class RedisChatStorage extends ChatStorage {
self.lifeCycle = Some(LifeCycle(Permanent))
self.lifeCycle = Permanent
val CHAT_LOG = "akka.chat.log"
private var chatLog = atomic { RedisStorage.getVector(CHAT_LOG) }

View file

@ -16,12 +16,12 @@ public class Boot {
new Component(
SimpleService.class,
SimpleServiceImpl.class,
new LifeCycle(new Permanent()),
new Permanent(),
1000),
new Component(
PersistentSimpleService.class,
PersistentSimpleServiceImpl.class,
new LifeCycle(new Permanent()),
new Permanent(),
1000)
}).supervise();
}

View file

@ -28,13 +28,13 @@ class Boot {
RestartStrategy(OneForOne, 3, 100,List(classOf[Exception])),
Supervise(
actorOf[SimpleServiceActor],
LifeCycle(Permanent)) ::
Permanent) ::
Supervise(
actorOf[ChatActor],
LifeCycle(Permanent)) ::
Permanent) ::
Supervise(
actorOf[PersistentSimpleServiceActor],
LifeCycle(Permanent))
Permanent)
:: Nil))
factory.newInstance.start
}

View file

@ -20,18 +20,18 @@ class Boot {
// see akka.conf to enable one of these for the AkkaSecurityFilterFactory
Supervise(
actorOf[BasicAuthenticationService],
LifeCycle(Permanent)) ::
Permanent) ::
/**
Supervise(
actorOf[DigestAuthenticationService],
LifeCycle(Permanent)) ::
Permanent) ::
Supervise(
actorOf[SpnegoAuthenticationService],
LifeCycle(Permanent)) ::
Permanent) ::
**/
Supervise(
actorOf[SecureTickActor],
LifeCycle(Permanent)):: Nil))
Permanent):: Nil))
val supervisor = factory.newInstance
supervisor.start

View file

@ -56,7 +56,7 @@ class SupervisionFactoryBean extends AbstractFactoryBean[AnyRef] {
*/
private[akka] def createComponent(props: ActorProperties): Component = {
import StringReflect._
val lifeCycle = if (!props.lifecycle.isEmpty && props.lifecycle.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new LifeCycle(new Temporary()) else new LifeCycle(new Permanent())
val lifeCycle = if (!props.lifecycle.isEmpty && props.lifecycle.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new Temporary() else new Permanent()
val isRemote = (props.host ne null) && (!props.host.isEmpty)
val withInterface = (props.interface ne null) && (!props.interface.isEmpty)
if (isRemote) {
@ -81,7 +81,7 @@ class SupervisionFactoryBean extends AbstractFactoryBean[AnyRef] {
*/
private[akka] def createSupervise(props: ActorProperties): Server = {
import StringReflect._
val lifeCycle = if (!props.lifecycle.isEmpty && props.lifecycle.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new LifeCycle(new Temporary()) else new LifeCycle(new Permanent())
val lifeCycle = if (!props.lifecycle.isEmpty && props.lifecycle.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new Temporary() else new Permanent()
val isRemote = (props.host ne null) && (!props.host.isEmpty)
val actorRef = Actor.actorOf(props.target.toClass)
if (props.timeout > 0) {

View file

@ -33,13 +33,13 @@ class RestartNestedTransactionalTypedActorSpec extends
new RestartStrategy(new AllForOne, 3, 5000, List(classOf[Exception]).toArray),
List(
new Component(classOf[TransactionalTypedActor],
new LifeCycle(new Permanent),
new Permanent,
10000),
new Component(classOf[NestedTransactionalTypedActor],
new LifeCycle(new Permanent),
new Permanent,
10000),
new Component(classOf[TypedActorFailer],
new LifeCycle(new Permanent),
new Permanent,
10000)
).toArray).supervise
*/

View file

@ -33,11 +33,11 @@ class RestartTransactionalTypedActorSpec extends
List(
new Component(
classOf[TransactionalTypedActor],
new LifeCycle(new Temporary),
new Temporary,
10000),
new Component(
classOf[TypedActorFailer],
new LifeCycle(new Temporary),
new Temporary,
10000)
).toArray).supervise
}

View file

@ -41,13 +41,13 @@ class TypedActorGuiceConfiguratorSpec extends
new Component(
classOf[Foo],
classOf[FooImpl],
new LifeCycle(new Permanent),
new Permanent,
1000,
dispatcher),
new Component(
classOf[Bar],
classOf[BarImpl],
new LifeCycle(new Permanent),
new Permanent,
1000,
dispatcher)
).toArray).inject.supervise

View file

@ -22,8 +22,8 @@ class TypedActorLifecycleSpec extends Spec with ShouldMatchers with BeforeAndAft
override protected def beforeAll() = {
val strategy = new RestartStrategy(new AllForOne(), 3, 1000, Array(classOf[Exception]))
val comp3 = new Component(classOf[SamplePojo], classOf[SamplePojoImpl], new LifeCycle(new Permanent()), 1000)
val comp4 = new Component(classOf[SamplePojo], classOf[SamplePojoImpl], new LifeCycle(new Temporary()), 1000)
val comp3 = new Component(classOf[SamplePojo], classOf[SamplePojoImpl], new Permanent(), 1000)
val comp4 = new Component(classOf[SamplePojo], classOf[SamplePojoImpl], new Temporary(), 1000)
conf1 = new TypedActorConfigurator().configure(strategy, Array(comp3)).supervise
conf2 = new TypedActorConfigurator().configure(strategy, Array(comp4)).supervise
}