diff --git a/akka-actor/src/main/scala/actor/Actor.scala b/akka-actor/src/main/scala/actor/Actor.scala index d232ca2a77..36179bdde2 100644 --- a/akka-actor/src/main/scala/actor/Actor.scala +++ b/akka-actor/src/main/scala/actor/Actor.scala @@ -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 diff --git a/akka-actor/src/main/scala/actor/ActorRef.scala b/akka-actor/src/main/scala/actor/ActorRef.scala index 6bb64363f3..ffb44e6f46 100644 --- a/akka-actor/src/main/scala/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/actor/ActorRef.scala @@ -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. diff --git a/akka-actor/src/main/scala/actor/Supervisor.scala b/akka-actor/src/main/scala/actor/Supervisor.scala index f575cda299..28d883e5ea 100644 --- a/akka-actor/src/main/scala/actor/Supervisor.scala +++ b/akka-actor/src/main/scala/actor/Supervisor.scala @@ -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)) * * @@ -60,10 +60,10 @@ object Supervisor { * RestartStrategy(OneForOne, 3, 10, List(classOf[Exception]), * Supervise( * myFirstActor, - * LifeCycle(Permanent)) :: + * Permanent) :: * Supervise( * mySecondActor, - * LifeCycle(Permanent)) :: + * Permanent) :: * Nil)) * * @@ -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( diff --git a/akka-actor/src/main/scala/config/SupervisionConfig.scala b/akka-actor/src/main/scala/config/SupervisionConfig.scala index d85001b5ca..43a5e21395 100644 --- a/akka-actor/src/main/scala/config/SupervisionConfig.scala +++ b/akka-actor/src/main/scala/config/SupervisionConfig.scala @@ -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 } diff --git a/akka-actor/src/test/scala/actor/actor/ActorFireForgetRequestReplySpec.scala b/akka-actor/src/test/scala/actor/actor/ActorFireForgetRequestReplySpec.scala index 92d4356ca0..7741b79cea 100644 --- a/akka-actor/src/test/scala/actor/actor/ActorFireForgetRequestReplySpec.scala +++ b/akka-actor/src/test/scala/actor/actor/ActorFireForgetRequestReplySpec.scala @@ -20,7 +20,7 @@ object ActorFireForgetRequestReplySpec { } class CrashingTemporaryActor extends Actor { - self.lifeCycle = Some(LifeCycle(Temporary)) + self.lifeCycle = Temporary def receive = { case "Die" => diff --git a/akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala b/akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala index 26fdb6e1ef..2805a8675d 100644 --- a/akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala +++ b/akka-actor/src/test/scala/actor/supervisor/SupervisorMiscSpec.scala @@ -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" diff --git a/akka-actor/src/test/scala/actor/supervisor/SupervisorSpec.scala b/akka-actor/src/test/scala/actor/supervisor/SupervisorSpec.scala index 01eb9cb006..f7d1752ded 100644 --- a/akka-actor/src/test/scala/actor/supervisor/SupervisorSpec.scala +++ b/akka-actor/src/test/scala/actor/supervisor/SupervisorSpec.scala @@ -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)) } diff --git a/akka-actor/src/test/scala/misc/SchedulerSpec.scala b/akka-actor/src/test/scala/misc/SchedulerSpec.scala index 16dd21f327..83daff2e01 100644 --- a/akka-actor/src/test/scala/misc/SchedulerSpec.scala +++ b/akka-actor/src/test/scala/misc/SchedulerSpec.scala @@ -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) diff --git a/akka-amqp/src/main/scala/se/scalablesolutions/akka/amqp/FaultTolerantConnectionActor.scala b/akka-amqp/src/main/scala/se/scalablesolutions/akka/amqp/FaultTolerantConnectionActor.scala index 0fd3f715b5..bf5a192299 100644 --- a/akka-amqp/src/main/scala/se/scalablesolutions/akka/amqp/FaultTolerantConnectionActor.scala +++ b/akka-amqp/src/main/scala/se/scalablesolutions/akka/amqp/FaultTolerantConnectionActor.scala @@ -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)) diff --git a/akka-persistence/akka-persistence-hbase/src/test/scala/HbaseTicket343SpecTestIntegration.scala b/akka-persistence/akka-persistence-hbase/src/test/scala/HbaseTicket343SpecTestIntegration.scala index 26210ba52f..930a3b25a7 100644 --- a/akka-persistence/akka-persistence-hbase/src/test/scala/HbaseTicket343SpecTestIntegration.scala +++ b/akka-persistence/akka-persistence-hbase/src/test/scala/HbaseTicket343SpecTestIntegration.scala @@ -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) } diff --git a/akka-persistence/akka-persistence-mongo/src/test/scala/MongoTicket343Spec.scala b/akka-persistence/akka-persistence-mongo/src/test/scala/MongoTicket343Spec.scala index 413be5d860..a614fbc78d 100644 --- a/akka-persistence/akka-persistence-mongo/src/test/scala/MongoTicket343Spec.scala +++ b/akka-persistence/akka-persistence-mongo/src/test/scala/MongoTicket343Spec.scala @@ -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) } diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala index 1e760784c9..1bd2c34d86 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisInconsistentSizeBugTest.scala @@ -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) } diff --git a/akka-persistence/akka-persistence-redis/src/test/scala/RedisTicket343Spec.scala b/akka-persistence/akka-persistence-redis/src/test/scala/RedisTicket343Spec.scala index 2b06b17270..f46aa9f224 100644 --- a/akka-persistence/akka-persistence-redis/src/test/scala/RedisTicket343Spec.scala +++ b/akka-persistence/akka-persistence-redis/src/test/scala/RedisTicket343Spec.scala @@ -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) } diff --git a/akka-remote/src/main/scala/remote/Cluster.scala b/akka-remote/src/main/scala/remote/Cluster.scala index 6e1e99f0b2..c668228291 100644 --- a/akka-remote/src/main/scala/remote/Cluster.scala +++ b/akka-remote/src/main/scala/remote/Cluster.scala @@ -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]) diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index c9dd582978..427c3ad721 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -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) diff --git a/akka-remote/src/test/scala/remote/RemoteSupervisorSpec.scala b/akka-remote/src/test/scala/remote/RemoteSupervisorSpec.scala index 936d1cf5c4..40f0d27640 100644 --- a/akka-remote/src/test/scala/remote/RemoteSupervisorSpec.scala +++ b/akka-remote/src/test/scala/remote/RemoteSupervisorSpec.scala @@ -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 diff --git a/akka-remote/src/test/scala/remote/RemoteTypedActorSpec.scala b/akka-remote/src/test/scala/remote/RemoteTypedActorSpec.scala index 8b28b35f57..5a3a5bc2c4 100644 --- a/akka-remote/src/test/scala/remote/RemoteTypedActorSpec.scala +++ b/akka-remote/src/test/scala/remote/RemoteTypedActorSpec.scala @@ -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 diff --git a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala index 98c7c34b7e..461ba31d83 100644 --- a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala +++ b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala @@ -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 diff --git a/akka-samples/akka-sample-chat/src/main/scala/ChatServer.scala b/akka-samples/akka-sample-chat/src/main/scala/ChatServer.scala index 6f70d8071a..e5b60b364f 100644 --- a/akka-samples/akka-sample-chat/src/main/scala/ChatServer.scala +++ b/akka-samples/akka-sample-chat/src/main/scala/ChatServer.scala @@ -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) } diff --git a/akka-samples/akka-sample-rest-java/src/main/java/sample/rest/java/Boot.java b/akka-samples/akka-sample-rest-java/src/main/java/sample/rest/java/Boot.java index d9b41cd136..4702eead02 100644 --- a/akka-samples/akka-sample-rest-java/src/main/java/sample/rest/java/Boot.java +++ b/akka-samples/akka-sample-rest-java/src/main/java/sample/rest/java/Boot.java @@ -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(); } diff --git a/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala b/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala index c3b71a3fdf..fb8bd7c381 100644 --- a/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala +++ b/akka-samples/akka-sample-rest-scala/src/main/scala/SimpleService.scala @@ -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 } diff --git a/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala b/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala index 02af6174c6..3f2b76a359 100644 --- a/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala +++ b/akka-samples/akka-sample-security/src/main/scala/SimpleService.scala @@ -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 diff --git a/akka-spring/src/main/scala/SupervisionFactoryBean.scala b/akka-spring/src/main/scala/SupervisionFactoryBean.scala index 657a40c90a..c6d1e7ddc0 100644 --- a/akka-spring/src/main/scala/SupervisionFactoryBean.scala +++ b/akka-spring/src/main/scala/SupervisionFactoryBean.scala @@ -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) { diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/RestartNestedTransactionalTypedActorSpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/RestartNestedTransactionalTypedActorSpec.scala index 1769a5c47b..ea5db11531 100644 --- a/akka-typed-actor/src/test/scala/actor/typed-actor/RestartNestedTransactionalTypedActorSpec.scala +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/RestartNestedTransactionalTypedActorSpec.scala @@ -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 */ diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/RestartTransactionalTypedActorSpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/RestartTransactionalTypedActorSpec.scala index 56b1e6ec5b..8f80fbcd1b 100644 --- a/akka-typed-actor/src/test/scala/actor/typed-actor/RestartTransactionalTypedActorSpec.scala +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/RestartTransactionalTypedActorSpec.scala @@ -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 } diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorGuiceConfiguratorSpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorGuiceConfiguratorSpec.scala index d076ec52cf..814cd299d9 100644 --- a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorGuiceConfiguratorSpec.scala +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorGuiceConfiguratorSpec.scala @@ -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 diff --git a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala index 052f4cc7de..781537d5a9 100644 --- a/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala +++ b/akka-typed-actor/src/test/scala/actor/typed-actor/TypedActorLifecycleSpec.scala @@ -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 }