From f4955bed3e36bd694f0c87e6f7cc3af684e3a633 Mon Sep 17 00:00:00 2001 From: gregw Date: Wed, 5 Jun 2024 21:14:48 +1000 Subject: [PATCH] Experiment for aborting callbacks WIP --- .../java/org/eclipse/jetty/util/Callback.java | 8 ++--- .../jetty/util/IteratingCallback_State.puml | 36 +++++++++---------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java index 141e51501e31..e163517b97d0 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/Callback.java @@ -81,8 +81,8 @@ default void succeeded() * {@link #failed(Throwable)}

* * @param cause the reason for the operation failure - * @return {@code} if the call to cancel was prior to a call to either {@link #succeeded()}, {@link #failed(Throwable)} - * or another call to {@code cancel(Throwable)}. + * @return {@code true} if the call to abort was prior to a call to either {@link #succeeded()}, {@link #failed(Throwable)} + * or another call to {@code abort(Throwable)}. * @see Completing */ default boolean abort(Throwable cause) @@ -369,9 +369,9 @@ public void succeeded() } @Override - public boolean abort(Throwable cancelCause) + public boolean abort(Throwable abortCause) { - ExceptionUtil.addSuppressedIfNotAssociated(cause, cancelCause); + ExceptionUtil.addSuppressedIfNotAssociated(cause, abortCause); return callback.abort(cause); } diff --git a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback_State.puml b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback_State.puml index 51af87d82c45..6cb76ebf786a 100644 --- a/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback_State.puml +++ b/jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/IteratingCallback_State.puml @@ -2,12 +2,11 @@ IDLE: PROCESSING: -PROCESSING_SUCCESS_CALLED: -PROCESSING_FAILED_CALLED: +PROCESSING_CALLED: PROCESSING_ABORT: -PROCESSING_ABORT_CALLED: +PROCESSING_CALLED_ABORT: PENDING: -PENDING_ABORT_CALLED: +PENDING_ABORT: FINISHED: [*] --> IDLE @@ -18,32 +17,29 @@ IDLE --> FINISHED: abort(x) PROCESSING --> IDLE: a=IDLE PROCESSING --> FINISHED: a=SUCCEEDED PROCESSING --> PENDING: a=SCHEDULED -PROCESSING --> PROCESSING_SUCCESS_CALLED: succeeded() -PROCESSING --> PROCESSING_FAILED_CALLED: failed(x) +PROCESSING --> PROCESSING_CALLED: succeeded() +PROCESSING --> PROCESSING_CALLED: failed(x) PROCESSING --> PROCESSING_ABORT: abort(x) PENDING --> PROCESSING: succeeded() PENDING --> FINISHED: failed(x) -PENDING --> PENDING_ABORT_CALLED: abort(x) +PENDING --> PENDING_ABORT: abort(x) -PROCESSING_SUCCESS_CALLED --> PROCESSING: a=SCHEDULED -PROCESSING_SUCCESS_CALLED --> PROCESSING_ABORT_CALLED: abort(x) - -PROCESSING_FAILED_CALLED --> FINISHED: a=SCHEDULED -PROCESSING_FAILED_CALLED --> PROCESSING_ABORT_CALLED: abort(x) +PROCESSING_CALLED --> PROCESSING: a=SCHEDULED +PROCESSING_CALLED --> PROCESSING_CALLED_ABORT: abort(x) PROCESSING_ABORT --> FINISHED: a=IDLE PROCESSING_ABORT --> FINISHED: a=SUCCEEDED -PROCESSING_ABORT --> PENDING_ABORT_CALLED: a=SCHEDULED -PROCESSING_ABORT --> PROCESSING_ABORT_CALLED: succeeded() -PROCESSING_ABORT --> PROCESSING_ABORT_CALLED: failed(x) +PROCESSING_ABORT --> PENDING_ABORT: a=SCHEDULED +PROCESSING_ABORT --> PROCESSING_CALLED_ABORT: succeeded() +PROCESSING_ABORT --> PROCESSING_CALLED_ABORT: failed(x) PROCESSING_ABORT --> PROCESSING_ABORT: abort(x) -PENDING_ABORT_CALLED --> FINISHED: succeeded() -PENDING_ABORT_CALLED --> FINISHED: failed(x) -PENDING_ABORT_CALLED --> PENDING_ABORT_CALLED: abort(x) +PENDING_ABORT --> FINISHED: succeeded() +PENDING_ABORT --> FINISHED: failed(x) +PENDING_ABORT --> PENDING_ABORT: abort(x) -PROCESSING_ABORT_CALLED -> FINISHED: a=* -PROCESSING_ABORT_CALLED -> ABORTING: abort(x) +PROCESSING_CALLED_ABORT -> FINISHED: a=* +PROCESSING_CALLED_ABORT -> PROCESSING_CALLED_ABORT: abort(x) @enduml \ No newline at end of file