Merge branch 'master' of github.com:akka/akka
This commit is contained in:
commit
10bb7f678a
20 changed files with 45 additions and 31 deletions
|
|
@ -95,6 +95,17 @@ class PromiseStreamSpec extends AkkaSpec with DefaultTimeout {
|
||||||
assert(Await.result(c, timeout.duration) === 4)
|
assert(Await.result(c, timeout.duration) === 4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"map futures" in {
|
||||||
|
val q = PromiseStream[String]()
|
||||||
|
flow {
|
||||||
|
q << (Future("a"), Future("b"), Future("c"))
|
||||||
|
}
|
||||||
|
val a, b, c = q.dequeue
|
||||||
|
Await.result(a, timeout.duration) must be("a")
|
||||||
|
Await.result(b, timeout.duration) must be("b")
|
||||||
|
Await.result(c, timeout.duration) must be("c")
|
||||||
|
}
|
||||||
|
|
||||||
"not fail under concurrent stress" in {
|
"not fail under concurrent stress" in {
|
||||||
implicit val timeout = Timeout(60 seconds)
|
implicit val timeout = Timeout(60 seconds)
|
||||||
val q = PromiseStream[Long](timeout.duration.toMillis)
|
val q = PromiseStream[Long](timeout.duration.toMillis)
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,10 @@ class PromiseStream[A](implicit val dispatcher: MessageDispatcher, val timeout:
|
||||||
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒ elem map (a ⇒ cont(this += a)) }
|
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒ elem map (a ⇒ cont(this += a)) }
|
||||||
|
|
||||||
final def <<(elem1: Future[A], elem2: Future[A], elems: Future[A]*): PromiseStream[A] @cps[Future[Any]] =
|
final def <<(elem1: Future[A], elem2: Future[A], elems: Future[A]*): PromiseStream[A] @cps[Future[Any]] =
|
||||||
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒ Future.flow(this << elem1 << elem2 <<< Future.sequence(elems.toSeq)) map cont }
|
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒
|
||||||
|
val seq = Future.sequence(elem1 +: elem2 +: elems)
|
||||||
|
seq map (a ⇒ cont(this ++= a))
|
||||||
|
}
|
||||||
|
|
||||||
final def <<<(elems: Traversable[A]): PromiseStream[A] @cps[Future[Any]] =
|
final def <<<(elems: Traversable[A]): PromiseStream[A] @cps[Future[Any]] =
|
||||||
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒ cont(this ++= elems) }
|
shift { cont: (PromiseStream[A] ⇒ Future[Any]) ⇒ cont(this ++= elems) }
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,11 @@ Akka uses `Git`_ and is hosted at `Github`_.
|
||||||
.. _Github: http://github.com
|
.. _Github: http://github.com
|
||||||
|
|
||||||
You first need Git installed on your machine. You can then clone the source
|
You first need Git installed on your machine. You can then clone the source
|
||||||
repository from http://github.com/jboner/akka.
|
repository from http://github.com/akka/akka.
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
git clone git://github.com/jboner/akka.git
|
git clone git://github.com/akka/akka.git
|
||||||
|
|
||||||
If you have already cloned the repository previously then you can update the
|
If you have already cloned the repository previously then you can update the
|
||||||
code with ``git pull``::
|
code with ``git pull``::
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,12 @@ All code that is checked in **should** have tests. All testing is done with ``Sc
|
||||||
* Name tests as **Test.scala** if they do not depend on any external stuff. That keeps surefire happy.
|
* Name tests as **Test.scala** if they do not depend on any external stuff. That keeps surefire happy.
|
||||||
* Name tests as **Spec.scala** if they have external dependencies.
|
* Name tests as **Spec.scala** if they have external dependencies.
|
||||||
|
|
||||||
There is a testing standard that should be followed: `Ticket001Spec <https://github.com/jboner/akka/blob/master/akka-actor-tests/src/test/scala/akka/ticket/Ticket001Spec.scala>`_
|
There is a testing standard that should be followed: `Ticket001Spec <https://github.com/akka/akka/blob/master/akka-actor-tests/src/test/scala/akka/ticket/Ticket001Spec.scala>`_
|
||||||
|
|
||||||
Actor TestKit
|
Actor TestKit
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
|
||||||
There is a useful test kit for testing actors: `akka.util.TestKit <https://github.com/jboner/akka/tree/master/akka-testkit/src/main/scala/akka/testkit/TestKit.scala>`_. It enables assertions concerning replies received and their timing, there is more documentation in the :ref:`akka-testkit` module.
|
There is a useful test kit for testing actors: `akka.util.TestKit <https://github.com/akka/akka/tree/master/akka-testkit/src/main/scala/akka/testkit/TestKit.scala>`_. It enables assertions concerning replies received and their timing, there is more documentation in the :ref:`akka-testkit` module.
|
||||||
|
|
||||||
Multi-JVM Testing
|
Multi-JVM Testing
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ Akka Benchmark project
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Benches Akka against various other actors and concurrency tools
|
Benches Akka against various other actors and concurrency tools
|
||||||
`<http://github.com/jboner/akka-bench>`_
|
`<http://github.com/akka/akka-bench>`_
|
||||||
|
|
||||||
Typed Actor (Java API) sample project
|
Typed Actor (Java API) sample project
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ Links
|
||||||
|
|
||||||
* `Downloads <http://akka.io/downloads/>`_
|
* `Downloads <http://akka.io/downloads/>`_
|
||||||
|
|
||||||
* `Source Code <http://github.com/jboner/akka>`_
|
* `Source Code <http://github.com/akka/akka>`_
|
||||||
|
|
||||||
* :ref:`scaladoc`
|
* :ref:`scaladoc`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,12 @@ Tutorial source code
|
||||||
|
|
||||||
If you want don't want to type in the code and/or set up a Maven project then you can check out the full tutorial from the Akka GitHub repository. It is in the ``akka-tutorials/akka-tutorial-first`` module. You can also browse it online `here`__, with the actual source code `here`__.
|
If you want don't want to type in the code and/or set up a Maven project then you can check out the full tutorial from the Akka GitHub repository. It is in the ``akka-tutorials/akka-tutorial-first`` module. You can also browse it online `here`__, with the actual source code `here`__.
|
||||||
|
|
||||||
__ https://github.com/jboner/akka/tree/master/akka-tutorials/akka-tutorial-first
|
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
|
||||||
__ https://github.com/jboner/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/java/akka/tutorial/first/java/Pi.java
|
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/java/akka/tutorial/first/java/Pi.java
|
||||||
|
|
||||||
To check out the code using Git invoke the following::
|
To check out the code using Git invoke the following::
|
||||||
|
|
||||||
$ git clone git://github.com/jboner/akka.git
|
$ git clone git://github.com/akka/akka.git
|
||||||
|
|
||||||
Then you can navigate down to the tutorial::
|
Then you can navigate down to the tutorial::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,12 @@ check out the full tutorial from the Akka GitHub repository. It is in the
|
||||||
``akka-tutorials/akka-tutorial-first`` module. You can also browse it online
|
``akka-tutorials/akka-tutorial-first`` module. You can also browse it online
|
||||||
`here`__, with the actual source code `here`__.
|
`here`__, with the actual source code `here`__.
|
||||||
|
|
||||||
__ https://github.com/jboner/akka/tree/master/akka-tutorials/akka-tutorial-first
|
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
|
||||||
__ https://github.com/jboner/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/Pi.scala
|
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/Pi.scala
|
||||||
|
|
||||||
To check out the code using Git invoke the following::
|
To check out the code using Git invoke the following::
|
||||||
|
|
||||||
$ git clone git://github.com/jboner/akka.git
|
$ git clone git://github.com/akka/akka.git
|
||||||
|
|
||||||
Then you can navigate down to the tutorial::
|
Then you can navigate down to the tutorial::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,12 @@ check out the full tutorial from the Akka GitHub repository. It is in the
|
||||||
``akka-tutorials/akka-tutorial-first`` module. You can also browse it online
|
``akka-tutorials/akka-tutorial-first`` module. You can also browse it online
|
||||||
`here`__, with the actual source code `here`__.
|
`here`__, with the actual source code `here`__.
|
||||||
|
|
||||||
__ https://github.com/jboner/akka/tree/master/akka-tutorials/akka-tutorial-first
|
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
|
||||||
__ https://github.com/jboner/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/akka/tutorial/first/scala/Pi.scala
|
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/akka/tutorial/first/scala/Pi.scala
|
||||||
|
|
||||||
To check out the code using Git invoke the following::
|
To check out the code using Git invoke the following::
|
||||||
|
|
||||||
$ git clone git://github.com/jboner/akka.git
|
$ git clone git://github.com/akka/akka.git
|
||||||
|
|
||||||
Then you can navigate down to the tutorial::
|
Then you can navigate down to the tutorial::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ Build from sources
|
||||||
|
|
||||||
Akka uses Git and is hosted at `Github <http://github.com>`_.
|
Akka uses Git and is hosted at `Github <http://github.com>`_.
|
||||||
|
|
||||||
* Akka: clone the Akka repository from `<http://github.com/jboner/akka>`_
|
* Akka: clone the Akka repository from `<http://github.com/akka/akka>`_
|
||||||
|
|
||||||
Continue reading the page on :ref:`building-akka`
|
Continue reading the page on :ref:`building-akka`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ The classifiers presented here are part of the Akka distribution, but rolling
|
||||||
your own in case you do not find a perfect match is not difficult, check the
|
your own in case you do not find a perfect match is not difficult, check the
|
||||||
implementation of the existing ones on `github`_.
|
implementation of the existing ones on `github`_.
|
||||||
|
|
||||||
.. _github: https://github.com/jboner/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala
|
.. _github: https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala
|
||||||
|
|
||||||
Lookup Classification
|
Lookup Classification
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ Description of the Remoting Sample
|
||||||
|
|
||||||
There is a more extensive remote example that comes with the Akka distribution.
|
There is a more extensive remote example that comes with the Akka distribution.
|
||||||
Please have a look here for more information: `Remote Sample
|
Please have a look here for more information: `Remote Sample
|
||||||
<https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote>`_
|
<https://github.com/akka/akka/tree/master/akka-samples/akka-sample-remote>`_
|
||||||
This sample demonstrates both, remote deployment and look-up of remote actors.
|
This sample demonstrates both, remote deployment and look-up of remote actors.
|
||||||
First, let us have a look at the common setup for both scenarios (this is
|
First, let us have a look at the common setup for both scenarios (this is
|
||||||
``common.conf``):
|
``common.conf``):
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ from incoming sender/message to a ``List`` of ``Destination(sender, routee)``.
|
||||||
The sender is what "parent" the routee should see - changing this could be useful if you for example want
|
The sender is what "parent" the routee should see - changing this could be useful if you for example want
|
||||||
another actor than the original sender to intermediate the result of the routee (if there is a result).
|
another actor than the original sender to intermediate the result of the routee (if there is a result).
|
||||||
For more information about how to alter the original sender we refer to the source code of
|
For more information about how to alter the original sender we refer to the source code of
|
||||||
`ScatterGatherFirstCompletedRouter <https://github.com/jboner/akka/blob/master/akka-actor/src/main/scala/akka/routing/Routing.scala#L375>`_
|
`ScatterGatherFirstCompletedRouter <https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/Routing.scala#L375>`_
|
||||||
|
|
||||||
All in all the custom router looks like this:
|
All in all the custom router looks like this:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,4 +196,4 @@ Licenses for Dependency Libraries
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
Each dependency and its license can be seen in the project build file (the comment on the side of each dependency):
|
Each dependency and its license can be seen in the project build file (the comment on the side of each dependency):
|
||||||
`<https://github.com/jboner/akka/blob/master/project/build/AkkaProject.scala#L127>`_
|
`<https://github.com/akka/akka/blob/master/project/build/AkkaProject.scala#L127>`_
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ Akka is now part of the `Typesafe Stack <http://typesafe.com/stack>`_.
|
||||||
`<http://akka.io/downloads/>`_
|
`<http://akka.io/downloads/>`_
|
||||||
|
|
||||||
|
|
||||||
`Source Code <http://github.com/jboner/akka>`_
|
`Source Code <http://github.com/akka/akka>`_
|
||||||
==============================================
|
==============================================
|
||||||
|
|
||||||
Akka uses Git and is hosted at `Github <http://github.com>`_.
|
Akka uses Git and is hosted at `Github <http://github.com>`_.
|
||||||
|
|
||||||
* Akka: clone the Akka repository from `<http://github.com/jboner/akka>`_
|
* Akka: clone the Akka repository from `<http://github.com/akka/akka>`_
|
||||||
|
|
||||||
|
|
||||||
`Releases Repository <http://akka.io/releases/>`_
|
`Releases Repository <http://akka.io/releases/>`_
|
||||||
|
|
|
||||||
|
|
@ -567,7 +567,7 @@ The ``become`` method is useful for many different things, but a particular nice
|
||||||
example of it is in example where it is used to implement a Finite State Machine
|
example of it is in example where it is used to implement a Finite State Machine
|
||||||
(FSM): `Dining Hakkers`_.
|
(FSM): `Dining Hakkers`_.
|
||||||
|
|
||||||
.. _Dining Hakkers: http://github.com/jboner/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnBecome.scala
|
.. _Dining Hakkers: http://github.com/akka/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnBecome.scala
|
||||||
|
|
||||||
Here is another little cute example of ``become`` and ``unbecome`` in action:
|
Here is another little cute example of ``become`` and ``unbecome`` in action:
|
||||||
|
|
||||||
|
|
@ -576,7 +576,7 @@ Here is another little cute example of ``become`` and ``unbecome`` in action:
|
||||||
Encoding Scala Actors nested receives without accidentally leaking memory
|
Encoding Scala Actors nested receives without accidentally leaking memory
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
See this `Unnested receive example <https://github.com/jboner/akka/blob/master/akka-docs/scala/code/akka/docs/actor/UnnestedReceives.scala>`_.
|
See this `Unnested receive example <https://github.com/akka/akka/blob/master/akka-docs/scala/code/akka/docs/actor/UnnestedReceives.scala>`_.
|
||||||
|
|
||||||
|
|
||||||
Downgrade
|
Downgrade
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ The classifiers presented here are part of the Akka distribution, but rolling
|
||||||
your own in case you do not find a perfect match is not difficult, check the
|
your own in case you do not find a perfect match is not difficult, check the
|
||||||
implementation of the existing ones on `github`_.
|
implementation of the existing ones on `github`_.
|
||||||
|
|
||||||
.. _github: https://github.com/jboner/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala
|
.. _github: https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/event/EventBus.scala
|
||||||
|
|
||||||
Lookup Classification
|
Lookup Classification
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
||||||
|
|
@ -493,5 +493,5 @@ Examples
|
||||||
|
|
||||||
A bigger FSM example contrasted with Actor's :meth:`become`/:meth:`unbecome` can be found in the sources:
|
A bigger FSM example contrasted with Actor's :meth:`become`/:meth:`unbecome` can be found in the sources:
|
||||||
|
|
||||||
* `Dining Hakkers using FSM <https://github.com/jboner/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnFsm.scala#L1>`_
|
* `Dining Hakkers using FSM <https://github.com/akka/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnFsm.scala#L1>`_
|
||||||
* `Dining Hakkers using become <https://github.com/jboner/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnBecome.scala#L1>`_
|
* `Dining Hakkers using become <https://github.com/akka/akka/blob/master/akka-samples/akka-sample-fsm/src/main/scala/DiningHakkersOnBecome.scala#L1>`_
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ Description of the Remoting Sample
|
||||||
|
|
||||||
There is a more extensive remote example that comes with the Akka distribution.
|
There is a more extensive remote example that comes with the Akka distribution.
|
||||||
Please have a look here for more information: `Remote Sample
|
Please have a look here for more information: `Remote Sample
|
||||||
<https://github.com/jboner/akka/tree/master/akka-samples/akka-sample-remote>`_
|
<https://github.com/akka/akka/tree/master/akka-samples/akka-sample-remote>`_
|
||||||
This sample demonstrates both, remote deployment and look-up of remote actors.
|
This sample demonstrates both, remote deployment and look-up of remote actors.
|
||||||
First, let us have a look at the common setup for both scenarios (this is
|
First, let us have a look at the common setup for both scenarios (this is
|
||||||
``common.conf``):
|
``common.conf``):
|
||||||
|
|
|
||||||
|
|
@ -328,14 +328,14 @@ As you can see above what's returned in the partial function is a ``List`` of ``
|
||||||
The sender is what "parent" the routee should see - changing this could be useful if you for example want
|
The sender is what "parent" the routee should see - changing this could be useful if you for example want
|
||||||
another actor than the original sender to intermediate the result of the routee (if there is a result).
|
another actor than the original sender to intermediate the result of the routee (if there is a result).
|
||||||
For more information about how to alter the original sender we refer to the source code of
|
For more information about how to alter the original sender we refer to the source code of
|
||||||
`ScatterGatherFirstCompletedRouter <https://github.com/jboner/akka/blob/master/akka-actor/src/main/scala/akka/routing/Routing.scala#L375>`_
|
`ScatterGatherFirstCompletedRouter <https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/routing/Routing.scala#L375>`_
|
||||||
|
|
||||||
All in all the custom router looks like this:
|
All in all the custom router looks like this:
|
||||||
|
|
||||||
.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#CustomRouter
|
.. includecode:: ../../akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala#CustomRouter
|
||||||
|
|
||||||
If you are interested in how to use the VoteCountRouter you can have a look at the test class
|
If you are interested in how to use the VoteCountRouter you can have a look at the test class
|
||||||
`RoutingSpec <https://github.com/jboner/akka/blob/master/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala>`_
|
`RoutingSpec <https://github.com/akka/akka/blob/master/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala>`_
|
||||||
|
|
||||||
Configured Custom Router
|
Configured Custom Router
|
||||||
************************
|
************************
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue