Adding support for giving a Scala function to Index for comparison, and fixed a compilation error in NEttyRemoteSupport
This commit is contained in:
parent
dd9555fa4b
commit
aa1c636a6b
2 changed files with 7 additions and 1 deletions
|
|
@ -17,6 +17,11 @@ import java.util.{ Comparator, Set ⇒ JSet }
|
||||||
* @author Viktor Klang
|
* @author Viktor Klang
|
||||||
*/
|
*/
|
||||||
class Index[K, V](val mapSize: Int, val valueComparator: Comparator[V]) {
|
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 container = new ConcurrentHashMap[K, JSet[V]](mapSize)
|
||||||
private val emptySet = new ConcurrentSkipListSet[V]
|
private val emptySet = new ConcurrentSkipListSet[V]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import java.net.InetSocketAddress
|
||||||
import java.util.concurrent._
|
import java.util.concurrent._
|
||||||
import java.util.concurrent.atomic._
|
import java.util.concurrent.atomic._
|
||||||
import akka.AkkaException
|
import akka.AkkaException
|
||||||
|
import java.util.Comparator
|
||||||
|
|
||||||
class RemoteClientMessageBufferException(message: String, cause: Throwable = null) extends AkkaException(message, cause) {
|
class RemoteClientMessageBufferException(message: String, cause: Throwable = null) extends AkkaException(message, cause) {
|
||||||
def this(msg: String) = this(msg, null);
|
def this(msg: String) = this(msg, null);
|
||||||
|
|
@ -57,7 +58,7 @@ object RemoteEncoder {
|
||||||
trait NettyRemoteClientModule extends RemoteClientModule {
|
trait NettyRemoteClientModule extends RemoteClientModule {
|
||||||
self: ListenerManagement ⇒
|
self: ListenerManagement ⇒
|
||||||
private val remoteClients = new HashMap[RemoteAddress, RemoteClient]
|
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
|
private val lock = new ReadWriteGuard
|
||||||
|
|
||||||
protected[akka] def send[T](message: Any,
|
protected[akka] def send[T](message: Any,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue