!pro #17380 Build with Java 8

* genjavadoc adjustments for java8
This commit is contained in:
Patrik Nordwall 2015-05-05 16:44:49 +02:00
parent 67a9e62254
commit 0953e7aee3
41 changed files with 156 additions and 368 deletions

View file

@ -32,7 +32,7 @@ in more depth.
For the sake of demonstration let us consider the following strategy:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: strategy
I have chosen a few well-known exception types in order to demonstrate the
@ -109,49 +109,49 @@ Test Application
The following section shows the effects of the different directives in practice,
wherefor a test setup is needed. First off, we need a suitable supervisor:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: supervisor
This supervisor will be used to create a child, with which we can experiment:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: child
The test is easier by using the utilities described in :ref:`akka-testkit`,
where ``TestProbe`` provides an actor ref useful for receiving and inspecting replies.
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: testkit
Let us create actors:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: create
The first test shall demonstrate the ``Resume`` directive, so we try it out by
setting some non-initial state in the actor and have it fail:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: resume
As you can see the value 42 survives the fault handling directive. Now, if we
change the failure to a more serious ``NullPointerException``, that will no
longer be the case:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: restart
And finally in case of the fatal ``IllegalArgumentException`` the child will be
terminated by the supervisor:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: stop
Up to now the supervisor was completely unaffected by the childs failure,
because the directives set did handle it. In case of an ``Exception``, this is not
true anymore and the supervisor escalates the failure.
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: escalate-kill
The supervisor itself is supervised by the top-level actor provided by the
@ -164,12 +164,12 @@ child not to survive this failure.
In case this is not desired (which depends on the use case), we need to use a
different supervisor which overrides this behavior.
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: supervisor2
With this parent, the child survives the escalated restart, as demonstrated in
the last test:
.. includecode:: ../../../akka-samples/akka-docs-java-lambda/src/test/java/docs/actor/FaultHandlingTest.java
.. includecode:: code/docs/actorlambda/FaultHandlingTest.java
:include: escalate-restart