Skip to content

Commit

Permalink
spotless, javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Nov 13, 2023
1 parent 1c35771 commit 6348c2e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1420,8 +1420,7 @@ public Promise<JsPartitionedTable> partitionBy(Object keys, @JsOptional Boolean
typedTicket.setType(JsVariableType.PARTITIONEDTABLE);
typedTicket.setTicket(partitionedTableTicket);
Promise<JsPartitionedTable> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@ final class Listener implements Consumer<JsVariableChanges> {
@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)
Expand Down Expand Up @@ -899,7 +900,8 @@ private TicketAndPromise<?> exportScopeTicket(JsVariableDefinition varDef) {
ExportRequest req = new ExportRequest();
req.setSourceId(createTypedTicket(varDef).getTicket());
req.setResultId(ticket);
return Callbacks.<ExportResponse, Object>grpcUnaryPromise(c -> sessionServiceClient().exportFromTicket(req, metadata(), c::apply));
return Callbacks.<ExportResponse, Object>grpcUnaryPromise(
c -> sessionServiceClient().exportFromTicket(req, metadata(), c::apply));
}), this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T> implements IThenable<T> {
private final Ticket ticket;
Expand Down Expand Up @@ -40,19 +40,23 @@ public <V> TicketAndPromise<V> then(ThenOnFulfilledCallbackFn<? super T, ? exten
}

/**
* Rather than waiting for the original promise to succeed, lets the caller start a new call based
* only on the original ticket.
* @param racedCall
* @return
* @param <V>
* 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 <V> type of the next call to perform
*/
public <V> TicketAndPromise<V> race(JsFunction<Ticket, IThenable<V>> racedCall) {
IThenable<V> raced = racedCall.apply(ticket);
return new TicketAndPromise<>(ticket, Promise.all(promise, raced).then(ignore -> raced), connection);
}

@Override
public <V> IThenable<V> then(ThenOnFulfilledCallbackFn<? super T, ? extends V> onFulfilled, ThenOnRejectedCallbackFn<? extends V> onRejected) {
public <V> IThenable<V> then(ThenOnFulfilledCallbackFn<? super T, ? extends V> onFulfilled,
ThenOnRejectedCallbackFn<? extends V> onRejected) {
return promise.then(onFulfilled, onRejected);
}

Expand Down

0 comments on commit 6348c2e

Please sign in to comment.