diff --git a/akka-actor/src/main/scala/akka/util/Index.scala b/akka-actor/src/main/scala/akka/util/Index.scala index 7b0638c5a2..afbb7a2c20 100644 --- a/akka-actor/src/main/scala/akka/util/Index.scala +++ b/akka-actor/src/main/scala/akka/util/Index.scala @@ -17,6 +17,11 @@ import java.util.{ Comparator, Set ⇒ JSet } * @author Viktor Klang */ class Index[K, V](val mapSize: Int, val valueComparator: Comparator[V]) { + + def this(mapSize: Int, cmp: (V, V) ⇒ Int) = this(mapSize, new Comparator[V] { + def compare(a: V, b: V): Int = cmp(a, b) + }) + private val container = new ConcurrentHashMap[K, JSet[V]](mapSize) private val emptySet = new ConcurrentSkipListSet[V] diff --git a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala index add91d8a82..cd2c87bc44 100644 --- a/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala +++ b/akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala @@ -35,6 +35,7 @@ import java.net.InetSocketAddress import java.util.concurrent._ import java.util.concurrent.atomic._ import akka.AkkaException +import java.util.Comparator class RemoteClientMessageBufferException(message: String, cause: Throwable = null) extends AkkaException(message, cause) { def this(msg: String) = this(msg, null); @@ -57,7 +58,7 @@ object RemoteEncoder { trait NettyRemoteClientModule extends RemoteClientModule { self: ListenerManagement ⇒ private val remoteClients = new HashMap[RemoteAddress, RemoteClient] - private val remoteActors = new Index[RemoteAddress, Uuid] + private val remoteActors = new Index[RemoteAddress, Uuid](1024, _ compareTo _) private val lock = new ReadWriteGuard protected[akka] def send[T](message: Any,