Skip to content

Commit

Permalink
pw_rpc: Temporarily provide default abandon() implementation
Browse files Browse the repository at this point in the history
The default implementation of abandon() allows users to update in a
non-breaking way. The default implementation will be removed once the
migration is complete.

Bug: b/235513314
Change-Id: Ib5748fc815c0e166913c9428e8c1e88d57641ca3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/97682
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
  • Loading branch information
255 authored and CQ Bot Account committed Jun 9, 2022
1 parent 8d399a8 commit c294be0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pw_rpc/java/main/dev/pigweed/pw_rpc/Call.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ public interface Call {
void cancel() throws ChannelOutputException;

/** Cancels the RPC as in cancel(), but does not send a cancellation packet to the server. */
void abandon();
default void abandon() {
// By default, call cancel() and ignore exceptions.
// TODO(b/235513314): Remove this default implementation once users have
// implemented abandon().
try {
cancel();
} catch (ChannelOutputException e) {
// Ignore the exception, since abandon() isn't supposed to send packets.
}
}

/** True if the RPC has not yet completed. */
default boolean active() {
Expand Down

0 comments on commit c294be0

Please sign in to comment.