You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by he...@apache.org on 2024/11/28 15:35:56 UTC
(pekko-grpc) branch cancelHandler created (now 1c5ff0d4)
This is an automated email from the ASF dual-hosted git repository.
hepin pushed a change to branch cancelHandler
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
at 1c5ff0d4 chore: fuse handlers in CancellationBarrierGraphStage
This branch includes the following new commits:
new 1c5ff0d4 chore: fuse handlers in CancellationBarrierGraphStage
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org
(pekko-grpc) 01/01: chore: fuse handlers in CancellationBarrierGraphStage
Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
hepin pushed a commit to branch cancelHandler
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
commit 1c5ff0d452cb60ee6687c91bf0957c91b2be522e
Author: He-Pin(kerr) <he...@gmail.com>
AuthorDate: Thu Nov 28 23:35:29 2024 +0800
chore: fuse handlers in CancellationBarrierGraphStage
---
.../internal/CancellationBarrierGraphStage.scala | 42 +++++++++-------------
1 file changed, 17 insertions(+), 25 deletions(-)
diff --git a/runtime/src/main/scala/org/apache/pekko/grpc/internal/CancellationBarrierGraphStage.scala b/runtime/src/main/scala/org/apache/pekko/grpc/internal/CancellationBarrierGraphStage.scala
index a6cc7282..d59a98b8 100644
--- a/runtime/src/main/scala/org/apache/pekko/grpc/internal/CancellationBarrierGraphStage.scala
+++ b/runtime/src/main/scala/org/apache/pekko/grpc/internal/CancellationBarrierGraphStage.scala
@@ -30,31 +30,23 @@ class CancellationBarrierGraphStage[T] extends GraphStage[FlowShape[T, T]] {
override val shape: FlowShape[T, T] = FlowShape(in, out)
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic =
- new GraphStageLogic(shape) {
- setHandler(
- in,
- new InHandler {
- override def onPush(): Unit = emit(out, grab(in))
- })
-
- setHandler(
- out,
- new OutHandler {
- override def onPull(): Unit = pull(in)
-
- override def onDownstreamFinish(cause: Throwable): Unit = {
- if (!hasBeenPulled(in))
+ new GraphStageLogic(shape) with InHandler with OutHandler {
+ override def onPush(): Unit = emit(out, grab(in))
+ override def onPull(): Unit = pull(in)
+
+ override def onDownstreamFinish(cause: Throwable): Unit = {
+ if (!hasBeenPulled(in))
+ pull(in)
+
+ setHandler(
+ in,
+ new InHandler {
+ override def onPush(): Unit = {
+ grab(in)
pull(in)
-
- setHandler(
- in,
- new InHandler {
- override def onPush(): Unit = {
- grab(in)
- pull(in)
- }
- })
- }
- })
+ }
+ })
+ }
+ setHandlers(in, out, this)
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org