And now akka-core builds!
This commit is contained in:
parent
787e7e45b7
commit
a16c6da3b7
10 changed files with 47 additions and 33 deletions
|
|
@ -138,7 +138,7 @@ object DataFlow {
|
||||||
"Access by index other than '0' is not supported by DataFlowStream")
|
"Access by index other than '0' is not supported by DataFlowStream")
|
||||||
}
|
}
|
||||||
|
|
||||||
override def elements: Iterator[T] = new Iterator[T] {
|
def iterator: Iterator[T] = new Iterator[T] {
|
||||||
private val iter = queue.iterator
|
private val iter = queue.iterator
|
||||||
def hasNext: Boolean = iter.hasNext
|
def hasNext: Boolean = iter.hasNext
|
||||||
def next: T = { val ref = iter.next; ref() }
|
def next: T = { val ref = iter.next; ref() }
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ trait PersistentDataStructure
|
||||||
*/
|
*/
|
||||||
@serializable
|
@serializable
|
||||||
final class HashTrie[K, +V] private (root: Node[K, V]) extends Map[K, V] with PersistentDataStructure {
|
final class HashTrie[K, +V] private (root: Node[K, V]) extends Map[K, V] with PersistentDataStructure {
|
||||||
lazy val size = root.size
|
override lazy val size = root.size
|
||||||
|
|
||||||
def this() = this(new EmptyNode[K])
|
def this() = this(new EmptyNode[K])
|
||||||
|
|
||||||
|
|
@ -56,11 +56,11 @@ final class HashTrie[K, +V] private (root: Node[K, V]) extends Map[K, V] with Pe
|
||||||
case (k, v) => update(k, v)
|
case (k, v) => update(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
def update[A >: V](key: K, value: A) = new HashTrie(root(0, key, key.hashCode) = value)
|
override def update[A >: V](key: K, value: A) = new HashTrie(root(0, key, key.hashCode) = value)
|
||||||
|
|
||||||
def -(key: K) = new HashTrie(root.remove(key, key.hashCode))
|
def -(key: K) = new HashTrie(root.remove(key, key.hashCode))
|
||||||
|
|
||||||
def elements = root.elements
|
def iterator = root.elements
|
||||||
|
|
||||||
def empty[A]: HashTrie[K, A] = new HashTrie(new EmptyNode[K])
|
def empty[A]: HashTrie[K, A] = new HashTrie(new EmptyNode[K])
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ private[collection] class CollisionNode[K, +V](val hash: Int, bucket: List[(K, V
|
||||||
} yield v
|
} yield v
|
||||||
}
|
}
|
||||||
|
|
||||||
def update[A >: V](shift: Int, key: K, hash: Int, value: A): Node[K, A] = {
|
override def update[A >: V](shift: Int, key: K, hash: Int, value: A): Node[K, A] = {
|
||||||
if (this.hash == hash) {
|
if (this.hash == hash) {
|
||||||
var found = false
|
var found = false
|
||||||
|
|
||||||
|
|
@ -169,7 +169,7 @@ private[collection] class CollisionNode[K, +V](val hash: Int, bucket: List[(K, V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def remove(key: K, hash: Int) = {
|
override def remove(key: K, hash: Int) = {
|
||||||
val newBucket = bucket filter { case (k, _) => k != key }
|
val newBucket = bucket filter { case (k, _) => k != key }
|
||||||
|
|
||||||
if (newBucket.length == bucket.length) this else {
|
if (newBucket.length == bucket.length) this else {
|
||||||
|
|
@ -180,6 +180,8 @@ private[collection] class CollisionNode[K, +V](val hash: Int, bucket: List[(K, V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def iterator = bucket.elements
|
||||||
|
|
||||||
def elements = bucket.elements
|
def elements = bucket.elements
|
||||||
|
|
||||||
override def toString = "CollisionNode(" + bucket.toString + ")"
|
override def toString = "CollisionNode(" + bucket.toString + ")"
|
||||||
|
|
@ -202,7 +204,7 @@ private[collection] class BitmappedNode[K, +V](shift: Int)(table: Array[Node[K,
|
||||||
if ((bits & mask) == mask) table(i)(key, hash) else None
|
if ((bits & mask) == mask) table(i)(key, hash) else None
|
||||||
}
|
}
|
||||||
|
|
||||||
def update[A >: V](levelShift: Int, key: K, hash: Int, value: A): Node[K, A] = {
|
override def update[A >: V](levelShift: Int, key: K, hash: Int, value: A): Node[K, A] = {
|
||||||
val i = (hash >>> shift) & 0x01f
|
val i = (hash >>> shift) & 0x01f
|
||||||
val mask = 1 << i
|
val mask = 1 << i
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,8 +179,13 @@ class TransactionalMap[K, V] extends Transactional with scala.collection.mutable
|
||||||
}
|
}
|
||||||
|
|
||||||
def +=(key: K, value: V) = put(key, value)
|
def +=(key: K, value: V) = put(key, value)
|
||||||
|
|
||||||
|
def +=(kv: (K, V)) = {
|
||||||
|
put(kv._1,kv._2)
|
||||||
|
this
|
||||||
|
}
|
||||||
|
|
||||||
def remove(key: K) = {
|
override def remove(key: K) = {
|
||||||
val map = ref.get.get
|
val map = ref.get.get
|
||||||
val oldValue = map.get(key)
|
val oldValue = map.get(key)
|
||||||
ref.swap(ref.get.get - key)
|
ref.swap(ref.get.get - key)
|
||||||
|
|
@ -196,19 +201,21 @@ class TransactionalMap[K, V] extends Transactional with scala.collection.mutable
|
||||||
oldValue
|
oldValue
|
||||||
}
|
}
|
||||||
|
|
||||||
def update(key: K, value: V) = {
|
override def update(key: K, value: V) = {
|
||||||
val map = ref.get.get
|
val map = ref.get.get
|
||||||
val oldValue = map.get(key)
|
val oldValue = map.get(key)
|
||||||
ref.swap(map.update(key, value))
|
ref.swap(map.update(key, value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def iterator = ref.get.get.iterator
|
||||||
|
|
||||||
def elements: Iterator[(K, V)] = ref.get.get.elements
|
override def elements: Iterator[(K, V)] = ref.get.get.elements
|
||||||
|
|
||||||
override def contains(key: K): Boolean = ref.get.get.contains(key)
|
override def contains(key: K): Boolean = ref.get.get.contains(key)
|
||||||
|
|
||||||
override def clear = ref.swap(new HashTrie[K, V])
|
override def clear = ref.swap(new HashTrie[K, V])
|
||||||
|
|
||||||
def size: Int = ref.get.get.size
|
override def size: Int = ref.get.get.size
|
||||||
|
|
||||||
override def hashCode: Int = System.identityHashCode(this);
|
override def hashCode: Int = System.identityHashCode(this);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
override def ++[A >: T](other: Iterable[A]) = other.foldLeft(this:Vector[A]) { _ + _ }
|
def ++[A >: T](other: Iterable[A]) = other.foldLeft(this:Vector[A]) { _ + _ }
|
||||||
|
|
||||||
def +[A >: T](obj: A): Vector[A] = {
|
def +[A >: T](obj: A): Vector[A] = {
|
||||||
if (tail.length < 32) {
|
if (tail.length < 32) {
|
||||||
|
|
@ -224,7 +224,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail
|
||||||
back
|
back
|
||||||
}
|
}
|
||||||
|
|
||||||
override def flatMap[A](f: (T)=>Iterable[A]): Vector[A] = {
|
def flatMap[A](f: (T)=>Iterable[A]): Vector[A] = {
|
||||||
var back = new Vector[A]
|
var back = new Vector[A]
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
|
|
@ -236,7 +236,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail
|
||||||
back
|
back
|
||||||
}
|
}
|
||||||
|
|
||||||
override def map[A](f: (T)=>A): Vector[A] = {
|
def map[A](f: (T)=>A): Vector[A] = {
|
||||||
var back = new Vector[A]
|
var back = new Vector[A]
|
||||||
var i = 0
|
var i = 0
|
||||||
|
|
||||||
|
|
@ -254,7 +254,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail
|
||||||
override def apply(i: Int) = outer.apply(length - i - 1)
|
override def apply(i: Int) = outer.apply(length - i - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
override def subseq(from: Int, end: Int) = subVector(from, end)
|
def subseq(from: Int, end: Int) = subVector(from, end)
|
||||||
|
|
||||||
def subVector(from: Int, end: Int): Vector[T] = {
|
def subVector(from: Int, end: Int): Vector[T] = {
|
||||||
if (from < 0) {
|
if (from < 0) {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class RemoteActorSpecActorAsyncSender extends Actor {
|
||||||
class ClientInitiatedRemoteActorTest extends JUnitSuite {
|
class ClientInitiatedRemoteActorTest extends JUnitSuite {
|
||||||
import Actor.Sender.Self
|
import Actor.Sender.Self
|
||||||
|
|
||||||
akka.Config.config
|
se.scalablesolutions.akka.Config.config
|
||||||
|
|
||||||
val HOSTNAME = "localhost"
|
val HOSTNAME = "localhost"
|
||||||
val PORT1 = 9990
|
val PORT1 = 9990
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ case object NotifySupervisorExit extends TestMessage
|
||||||
case class User(val usernamePassword: Tuple2[String, String],
|
case class User(val usernamePassword: Tuple2[String, String],
|
||||||
val email: String,
|
val email: String,
|
||||||
val age: Int)
|
val age: Int)
|
||||||
extends Serializable.SBinary[User] {
|
/*extends Serializable.SBinary[User]*/ {
|
||||||
def this() = this(null, null, 0)
|
def this() = this(null, null, 0)
|
||||||
import sbinary.DefaultProtocol._
|
/* import sbinary.DefaultProtocol._
|
||||||
implicit object UserFormat extends Format[User] {
|
implicit object UserFormat extends Format[User] {
|
||||||
def reads(in : Input) = User(
|
def reads(in : Input) = User(
|
||||||
read[Tuple2[String, String]](in),
|
read[Tuple2[String, String]](in),
|
||||||
|
|
@ -31,7 +31,7 @@ case class User(val usernamePassword: Tuple2[String, String],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
def fromBytes(bytes: Array[Byte]) = fromByteArray[User](bytes)
|
def fromBytes(bytes: Array[Byte]) = fromByteArray[User](bytes)
|
||||||
def toBytes: Array[Byte] = toByteArray(this)
|
def toBytes: Array[Byte] = toByteArray(this)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
case object RemotePing extends TestMessage
|
case object RemotePing extends TestMessage
|
||||||
|
|
|
||||||
|
|
@ -27,16 +27,16 @@ class PerformanceTest extends JUnitSuite {
|
||||||
case object BLUE extends Colour
|
case object BLUE extends Colour
|
||||||
case object FADED extends Colour
|
case object FADED extends Colour
|
||||||
|
|
||||||
val colours = Array(BLUE, RED, YELLOW)
|
val colours = Array[Colour](BLUE, RED, YELLOW)
|
||||||
|
|
||||||
case class Meet(from: Actor, colour: Colour)
|
case class Meet(from: Actor, colour: Colour)
|
||||||
case class Change(colour: Colour)
|
case class Change(colour: Colour)
|
||||||
case class MeetingCount(count: int)
|
case class MeetingCount(count: Int)
|
||||||
case class ExitActor(actor: Actor, reason: String)
|
case class ExitActor(actor: Actor, reason: String)
|
||||||
|
|
||||||
var totalTime = 0L
|
var totalTime = 0L
|
||||||
|
|
||||||
class Mall(var nrMeets: int, numChameneos: int) extends Actor {
|
class Mall(var nrMeets: Int, numChameneos: Int) extends Actor {
|
||||||
var waitingChameneo: Option[Actor] = None
|
var waitingChameneo: Option[Actor] = None
|
||||||
var sumMeetings = 0
|
var sumMeetings = 0
|
||||||
var numFaded = 0
|
var numFaded = 0
|
||||||
|
|
@ -86,7 +86,7 @@ class PerformanceTest extends JUnitSuite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Chameneo(var mall: Mall, var colour: Colour, cid: int) extends Actor {
|
case class Chameneo(var mall: Mall, var colour: Colour, cid: Int) extends Actor {
|
||||||
var meetings = 0
|
var meetings = 0
|
||||||
|
|
||||||
override def start = {
|
override def start = {
|
||||||
|
|
@ -156,14 +156,14 @@ class PerformanceTest extends JUnitSuite {
|
||||||
case object BLUE extends Colour
|
case object BLUE extends Colour
|
||||||
case object FADED extends Colour
|
case object FADED extends Colour
|
||||||
|
|
||||||
val colours = Array(BLUE, RED, YELLOW)
|
val colours = Array[Colour](BLUE, RED, YELLOW)
|
||||||
|
|
||||||
case class Meet(colour: Colour)
|
case class Meet(colour: Colour)
|
||||||
case class Change(colour: Colour)
|
case class Change(colour: Colour)
|
||||||
case class MeetingCount(count: int)
|
case class MeetingCount(count: Int)
|
||||||
|
|
||||||
|
|
||||||
class Mall(var n: int, numChameneos: int) extends Actor {
|
class Mall(var n: Int, numChameneos: Int) extends Actor {
|
||||||
var waitingChameneo: Option[OutputChannel[Any]] = None
|
var waitingChameneo: Option[OutputChannel[Any]] = None
|
||||||
var startTime: Long = 0L
|
var startTime: Long = 0L
|
||||||
|
|
||||||
|
|
@ -218,7 +218,7 @@ class PerformanceTest extends JUnitSuite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case class Chameneo(var mall: Mall, var colour: Colour, id: int) extends Actor {
|
case class Chameneo(var mall: Mall, var colour: Colour, id: Int) extends Actor {
|
||||||
var meetings = 0
|
var meetings = 0
|
||||||
|
|
||||||
def act() {
|
def act() {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
package se.scalablesolutions.akka.actor
|
package se.scalablesolutions.akka.actor
|
||||||
|
|
||||||
import se.scalablesolutions.akka.serialization.BinaryString
|
//import se.scalablesolutions.akka.serialization.BinaryString
|
||||||
import se.scalablesolutions.akka.config.ScalaConfig._
|
import se.scalablesolutions.akka.config.ScalaConfig._
|
||||||
import se.scalablesolutions.akka.remote.{RemoteNode, RemoteServer}
|
import se.scalablesolutions.akka.remote.{RemoteNode, RemoteServer}
|
||||||
import se.scalablesolutions.akka.OneWay
|
import se.scalablesolutions.akka.OneWay
|
||||||
|
|
@ -18,6 +18,11 @@ object Log {
|
||||||
var oneWayLog: String = ""
|
var oneWayLog: String = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Dummy until SBinary is fixed for Scala 2.8
|
||||||
|
object BinaryString{
|
||||||
|
def apply(string : String) = string
|
||||||
|
def unapply(string : String) = Some(string)
|
||||||
|
}
|
||||||
|
|
||||||
@serializable class RemotePingPong1Actor extends Actor {
|
@serializable class RemotePingPong1Actor extends Actor {
|
||||||
dispatcher = Dispatchers.newThreadBasedDispatcher(this)
|
dispatcher = Dispatchers.newThreadBasedDispatcher(this)
|
||||||
|
|
@ -74,7 +79,7 @@ object Log {
|
||||||
class RemoteSupervisorTest extends JUnitSuite {
|
class RemoteSupervisorTest extends JUnitSuite {
|
||||||
import Actor.Sender.Self
|
import Actor.Sender.Self
|
||||||
|
|
||||||
akka.Config.config
|
se.scalablesolutions.akka.Config.config
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
def run = {
|
def run = {
|
||||||
RemoteNode.start
|
RemoteNode.start
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,8 @@ object ServerInitiatedRemoteActorTest {
|
||||||
|
|
||||||
class ServerInitiatedRemoteActorTest extends JUnitSuite {
|
class ServerInitiatedRemoteActorTest extends JUnitSuite {
|
||||||
import ServerInitiatedRemoteActorTest._
|
import ServerInitiatedRemoteActorTest._
|
||||||
|
|
||||||
import Actor.Sender.Self
|
se.scalablesolutions.akka.Config.config
|
||||||
akka.Config.config
|
|
||||||
|
|
||||||
private val unit = TimeUnit.MILLISECONDS
|
private val unit = TimeUnit.MILLISECONDS
|
||||||
|
|
||||||
|
|
|
||||||
3
pom.xml
3
pom.xml
|
|
@ -45,10 +45,11 @@
|
||||||
<atmosphere.version>0.5.2</atmosphere.version>
|
<atmosphere.version>0.5.2</atmosphere.version>
|
||||||
<jersey.version>1.1.5</jersey.version>
|
<jersey.version>1.1.5</jersey.version>
|
||||||
<grizzly.version>1.9.18-i</grizzly.version>
|
<grizzly.version>1.9.18-i</grizzly.version>
|
||||||
<scalatest.version>1.0-for-scala-2.8.0-SNAPSHOT</scalatest.version>
|
<scalatest.version>1.0.1-for-scala-2.8.0.Beta1-with-test-interfaces-0.3-SNAPSHOT</scalatest.version>
|
||||||
<dispatch.version>0.7.0</dispatch.version>
|
<dispatch.version>0.7.0</dispatch.version>
|
||||||
<lift.version>2.0-scala280-SNAPSHOT</lift.version>
|
<lift.version>2.0-scala280-SNAPSHOT</lift.version>
|
||||||
<configgy.version>2.8.0.Beta1-1.5-SNAPSHOT</configgy.version>
|
<configgy.version>2.8.0.Beta1-1.5-SNAPSHOT</configgy.version>
|
||||||
|
<junit.version>4.5</junit.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue