From 6348c2ed168d5e8197c549e8e1a0d680d9a3e25d Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Mon, 13 Nov 2023 10:35:56 -0600 Subject: [PATCH] spotless, javadoc --- .../io/deephaven/web/client/api/JsTable.java | 3 +-- .../web/client/api/WorkerConnection.java | 6 ++++-- .../web/client/api/impl/TicketAndPromise.java | 20 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/JsTable.java b/web/client-api/src/main/java/io/deephaven/web/client/api/JsTable.java index 6c7c0fe2670..fcd9f450af7 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/JsTable.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/JsTable.java @@ -1420,8 +1420,7 @@ public Promise partitionBy(Object keys, @JsOptional Boolean typedTicket.setType(JsVariableType.PARTITIONEDTABLE); typedTicket.setTicket(partitionedTableTicket); Promise fetchPromise = new JsWidget(workerConnection, typedTicket).refetch().then( - widget -> Promise.resolve(new JsPartitionedTable(workerConnection, widget)) - ); + widget -> Promise.resolve(new JsPartitionedTable(workerConnection, widget))); // Ensure that the partition failure propagates first, but the result of the fetch will be returned - both // are running concurrently. diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/WorkerConnection.java b/web/client-api/src/main/java/io/deephaven/web/client/api/WorkerConnection.java index d8765df4d93..f9611a1bc57 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/WorkerConnection.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/WorkerConnection.java @@ -704,7 +704,8 @@ final class Listener implements Consumer { @Override public void accept(JsVariableChanges changes) { JsVariableDefinition foundField = changes.getCreated() - .find((field, p1, p2) -> field.getTitle().equals(name) && field.getType().equalsIgnoreCase(type)); + .find((field, p1, p2) -> field.getTitle().equals(name) + && field.getType().equalsIgnoreCase(type)); if (foundField == null) { foundField = changes.getUpdated().find((field, p1, p2) -> field.getTitle().equals(name) @@ -899,7 +900,8 @@ private TicketAndPromise exportScopeTicket(JsVariableDefinition varDef) { ExportRequest req = new ExportRequest(); req.setSourceId(createTypedTicket(varDef).getTicket()); req.setResultId(ticket); - return Callbacks.grpcUnaryPromise(c -> sessionServiceClient().exportFromTicket(req, metadata(), c::apply)); + return Callbacks.grpcUnaryPromise( + c -> sessionServiceClient().exportFromTicket(req, metadata(), c::apply)); }), this); } diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/impl/TicketAndPromise.java b/web/client-api/src/main/java/io/deephaven/web/client/api/impl/TicketAndPromise.java index 6bf180f9c3c..4f850da0a9f 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/impl/TicketAndPromise.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/impl/TicketAndPromise.java @@ -7,8 +7,8 @@ import io.deephaven.web.shared.fu.JsFunction; /** - * Pair of ticket and the promise that indicates it has been resolved. Tickets are usable before they are resolved, - * but to ensure that all operations completed successfully, the promise should be used to handle errors. + * Pair of ticket and the promise that indicates it has been resolved. Tickets are usable before they are resolved, but + * to ensure that all operations completed successfully, the promise should be used to handle errors. */ public class TicketAndPromise implements IThenable { private final Ticket ticket; @@ -40,11 +40,14 @@ public TicketAndPromise then(ThenOnFulfilledCallbackFn + * Rather than waiting for the original promise to succeed, lets the caller start a new call based only on the + * original ticket. The intent of "race" here is unlike Promise.race(), where the first to succeed should resolve - + * instead, this raced call will be sent to the server even though the previous call has not successfully returned, + * and the server is responsible for ensuring they happen in the correct order. + * + * @param racedCall the call to perform at the same time that any pending call is happening + * @return a new TicketAndPromise that will resolve when all work is successful + * @param type of the next call to perform */ public TicketAndPromise race(JsFunction> racedCall) { IThenable raced = racedCall.apply(ticket); @@ -52,7 +55,8 @@ public TicketAndPromise race(JsFunction> racedCall) } @Override - public IThenable then(ThenOnFulfilledCallbackFn onFulfilled, ThenOnRejectedCallbackFn onRejected) { + public IThenable then(ThenOnFulfilledCallbackFn onFulfilled, + ThenOnRejectedCallbackFn onRejected) { return promise.then(onFulfilled, onRejected); }