Remove supervisor of user actors
authorChristos KK Loverdos <loverdos@gmail.com>
Fri, 25 May 2012 10:00:33 +0000 (13:00 +0300)
committerChristos KK Loverdos <loverdos@gmail.com>
Fri, 25 May 2012 10:00:33 +0000 (13:00 +0300)
src/main/scala/gr/grnet/aquarium/actor/service/router/RouterActor.scala
src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorCache.scala
src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorSupervisor.scala [deleted file]
src/main/scala/gr/grnet/aquarium/actor/service/user/UserActorsLRU.scala

index 7677b23..4851cfe 100644 (file)
@@ -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
   }
index 05707cb..59ca2a0 100644 (file)
@@ -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 (file)
index 558cd62..0000000
+++ /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 <gousiosg@gmail.com>
- */
-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
-  ))
-}
index 50f648c..c6e0006 100644 (file)
@@ -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.