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
// create a fresh instance
val userActor = _actorProvider.actorForRole(UserActorRole)
UserActorCache.put(userID, userActor)
- UserActorSupervisor.supervisor.link(userActor)
userActor
}
+++ /dev/null
-/*
- * 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
- ))
-}
//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()
}
}
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.