<version>0.9.3</version>
</dependency>
- <!-- <dependency>
- <groupId>com.yammer.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <version>2.0.0-BETA18-SNAPSHOT</version>
- </dependency>-->
-<!--
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-core</artifactId>
- <version>3.5.0</version>
- </dependency>-->
-
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-core</artifactId>
- <version>3.5.0</version>
- <exclusions>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-analyzers</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-highlighter</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-memory</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-misc</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-queries</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-spatial</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-spellchecker</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-grouping</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-commons-csv</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-noggit</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.apache.solr</groupId>
- <artifactId>solr-solrj</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </exclusion>
-
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>com.github.scopt</groupId>
<artifactId>scopt_${scala.version}</artifactId>
<version>2.0.1</version>
+++ /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 org.apache.solr.util.ConcurrentLRUCache
-import akka.actor.ActorRef
-import gr.grnet.aquarium.util.{Loggable, Lifecycle}
-import collection.JavaConversions._
-
-/**
- * This class holds an LRU cache for the user actors.
- *
- * The underlying implementation is borrowed from the Apache lucene+solr project(s).
- *
- * The provided collections-like API is neither Java- nor Scala-oriented.
- *
- * @author Christos KK Loverdos <loverdos@gmail.com>
- */
-
-class UserActorsLRU(val upperWaterMark: Int, val lowerWatermark: Int) extends Lifecycle {
- private[this] val _cache = new ConcurrentLRUCache[String, ActorRef](
- upperWaterMark,
- lowerWatermark,
- ((upperWaterMark + lowerWatermark).toLong / 2).toInt,
- (3L * upperWaterMark / 4).toInt,
- true,
- false,
- EvictionListener)
-
- def put(userId: String, userActor: ActorRef): Unit = {
- _cache.put(userId, userActor)
- }
-
- def get(userId: String): Option[ActorRef] = {
- _cache.get(userId) match {
- case null ⇒ None
- case actorRef ⇒ Some(actorRef)
- }
- }
-
- def shutdownAll() = {
- val accessed = mapAsScalaMap(_cache.getLatestAccessedItems(_cache.size()))
-
- //Send the poison pill and make sure that all futures have been returned
- accessed.keysIterator.map {
- x =>
- _cache.get(x).stop()
- }
- }
-
- def size: Int = _cache.size()
-
- def clear: Unit = _cache.clear()
-
- def start() = {}
-
- def stop() = {
- _cache.destroy()
- }
-
- 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))
- // 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.
- }
- }
-
-}
-