Merge pull request #19736 from akka/wip-there-is-no-try-√

=str - removing superfluous try-catch in stream-customize.rst
This commit is contained in:
Roland Kuhn 2016-02-11 15:49:05 +01:00
commit 4f237c8eff
2 changed files with 17 additions and 16 deletions

View file

@ -80,7 +80,7 @@ public class GraphStageDocTest {
{ {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
push(out, counter); push(out, counter);
counter += 1; counter += 1;
} }
@ -140,17 +140,13 @@ public class GraphStageDocTest {
{ {
setHandler(in, new AbstractInHandler() { setHandler(in, new AbstractInHandler() {
@Override @Override
public void onPush() { public void onPush() throws Exception {
try { push(out, f.apply(grab(in)));
push(out, f.apply(grab(in)));
} catch (Exception ex) {
failStage(ex);
}
} }
}); });
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -217,7 +213,7 @@ public class GraphStageDocTest {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -282,7 +278,7 @@ public class GraphStageDocTest {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
if (lastElem.isDefined()) { if (lastElem.isDefined()) {
push(out, lastElem.get()); push(out, lastElem.get());
lastElem = Option.none(); lastElem = Option.none();
@ -342,7 +338,7 @@ public class GraphStageDocTest {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -417,7 +413,7 @@ public class GraphStageDocTest {
}); });
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -492,7 +488,7 @@ public class GraphStageDocTest {
{ {
setHandler(in, new AbstractInHandler() { setHandler(in, new AbstractInHandler() {
@Override @Override
public void onPush() { public void onPush() throws Exception {
A elem = grab(in); A elem = grab(in);
if (open) pull(in); if (open) pull(in);
else { else {
@ -504,7 +500,7 @@ public class GraphStageDocTest {
}); });
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -570,7 +566,7 @@ public class GraphStageDocTest {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
pull(in); pull(in);
} }
}); });
@ -655,7 +651,7 @@ public class GraphStageDocTest {
setHandler(out, new AbstractOutHandler() { setHandler(out, new AbstractOutHandler() {
@Override @Override
public void onPull() { public void onPull() throws Exception {
if (buffer.isEmpty()) { if (buffer.isEmpty()) {
downstreamWaiting = true; downstreamWaiting = true;
} else { } else {

View file

@ -1211,16 +1211,19 @@ trait InHandler {
* Called when the input port has a new element available. The actual element can be retrieved via the * Called when the input port has a new element available. The actual element can be retrieved via the
* [[GraphStageLogic.grab()]] method. * [[GraphStageLogic.grab()]] method.
*/ */
@throws(classOf[Exception])
def onPush(): Unit def onPush(): Unit
/** /**
* Called when the input port is finished. After this callback no other callbacks will be called for this port. * Called when the input port is finished. After this callback no other callbacks will be called for this port.
*/ */
@throws(classOf[Exception])
def onUpstreamFinish(): Unit = GraphInterpreter.currentInterpreter.activeStage.completeStage() def onUpstreamFinish(): Unit = GraphInterpreter.currentInterpreter.activeStage.completeStage()
/** /**
* Called when the input port has failed. After this callback no other callbacks will be called for this port. * Called when the input port has failed. After this callback no other callbacks will be called for this port.
*/ */
@throws(classOf[Exception])
def onUpstreamFailure(ex: Throwable): Unit = GraphInterpreter.currentInterpreter.activeStage.failStage(ex) def onUpstreamFailure(ex: Throwable): Unit = GraphInterpreter.currentInterpreter.activeStage.failStage(ex)
} }
@ -1232,12 +1235,14 @@ trait OutHandler {
* Called when the output port has received a pull, and therefore ready to emit an element, i.e. [[GraphStageLogic.push()]] * Called when the output port has received a pull, and therefore ready to emit an element, i.e. [[GraphStageLogic.push()]]
* is now allowed to be called on this port. * is now allowed to be called on this port.
*/ */
@throws(classOf[Exception])
def onPull(): Unit def onPull(): Unit
/** /**
* Called when the output port will no longer accept any new elements. After this callback no other callbacks will * Called when the output port will no longer accept any new elements. After this callback no other callbacks will
* be called for this port. * be called for this port.
*/ */
@throws(classOf[Exception])
def onDownstreamFinish(): Unit = { def onDownstreamFinish(): Unit = {
GraphInterpreter GraphInterpreter
.currentInterpreter .currentInterpreter