diff --git a/ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java b/ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java index 5e01ac7094..e32275c0ea 100644 --- a/ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java +++ b/ratis-client/src/main/java/org/apache/ratis/client/api/DataStreamOutput.java @@ -81,10 +81,15 @@ default CompletableFuture writeAsync(File src, long position, l * The server state machine may handle the command via its data-stream command hook * instead of writing bytes to the data channel. * + * This is an optional API. Implementations that do not support stream commands + * may rely on this default, which throws {@link UnsupportedOperationException}. + * * @param command the command payload * @return a future of the reply */ - CompletableFuture commandAsync(ByteBuffer command); + default CompletableFuture commandAsync(ByteBuffer command) { + throw new UnsupportedOperationException(getClass() + " does not support commandAsync"); + } /** * Return the future of the {@link RaftClientReply}