From: Christos KK Loverdos Date: Fri, 25 May 2012 10:00:33 +0000 (+0300) Subject: Remove supervisor of user actors X-Git-Url: https://code.grnet.gr/git/aquarium/commitdiff_plain/dff4901e18af9af538c8be356fc09b83d95f0943 Remove supervisor of user actors --- diff --git a/src/main/scala/gr/grnet/aquarium/actor/service/router/RouterActor.scala b/src/main/scala/gr/grnet/aquarium/actor/service/router/RouterActor.scala index 7677b23..4851cfe 100644 --- a/src/main/scala/gr/grnet/aquarium/actor/service/router/RouterActor.scala +++ b/src/main/scala/gr/grnet/aquarium/actor/service/router/RouterActor.scala @@ -40,7 +40,7 @@ package router import gr.grnet.aquarium.util.shortClassNameOf import gr.grnet.aquarium.service.RoleableActorProviderService import akka.actor.ActorRef -import user.{UserActorCache, UserActorSupervisor} +import user.{UserActorCache} import message.config.{AquariumPropertiesLoaded, ActorProviderConfigured} import gr.grnet.aquarium.actor.message.event.{ProcessResourceEvent, ProcessIMEvent} import gr.grnet.aquarium.actor.message.admin.PingAllRequest @@ -62,7 +62,6 @@ class RouterActor extends ReflectiveRoleableActor { // create a fresh instance val userActor = _actorProvider.actorForRole(UserActorRole) UserActorCache.put(userID, userActor) - UserActorSupervisor.supervisor.link(userActor) userActor } diff --git a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorCache.scala b/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorCache.scala index 05707cb..59ca2a0 100644 --- a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorCache.scala +++ b/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorCache.scala @@ -63,7 +63,6 @@ object UserActorCache extends Lifecycle with Loggable { val userActor = rn.getValue logger.debug("Parking UserActor for userID = %s".format(userID)) - UserActorSupervisor.supervisor.unlink(userActor) // Check this is received after any currently servicing business logic message. userActor.stop() } diff --git a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorSupervisor.scala b/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorSupervisor.scala deleted file mode 100644 index 558cd62..0000000 --- a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorSupervisor.scala +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011-2012 GRNET S.A. All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and - * documentation are those of the authors and should not be - * interpreted as representing official policies, either expressed - * or implied, of GRNET S.A. - */ - -package gr.grnet.aquarium.actor -package service -package user - -import akka.actor.Supervisor -import akka.config.Supervision.SupervisorConfig -import akka.config.Supervision.OneForOneStrategy - -/** - * Supervisor for user actors - * - * @author Georgios Gousios - */ -object UserActorSupervisor { - - lazy val supervisor = Supervisor(SupervisorConfig( - OneForOneStrategy( - List(classOf[Exception]), //What exceptions will be handled - 50, // maximum number of restart retries - 5000 // within time in millis - ), Nil - )) -} diff --git a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorsLRU.scala b/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorsLRU.scala index 50f648c..c6e0006 100644 --- a/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorsLRU.scala +++ b/src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorsLRU.scala @@ -79,7 +79,6 @@ class UserActorsLRU(val upperWaterMark: Int, val lowerWatermark: Int) extends Li //Send the poison pill and make sure that all futures have been returned accessed.keysIterator.map { x => - UserActorSupervisor.supervisor.unlink(_cache.get(x)) _cache.get(x).stop() } } @@ -97,7 +96,6 @@ class UserActorsLRU(val upperWaterMark: Int, val lowerWatermark: Int) extends Li private[this] object EvictionListener extends ConcurrentLRUCache.EvictionListener[String, ActorRef] with Loggable { def evictedEntry(userId: String, userActor: ActorRef): Unit = { logger.debug("Parking UserActor for userId = %s".format(userId)) - UserActorSupervisor.supervisor.unlink(userActor) // Check this is received after any currently servicing business logic message. userActor.stop() // Hopefully no need to further track these actors as they will now cause their own death.