Skip to content

Commit

Permalink
Replace ExtendedSettableFuture with SettableFuture
Browse files Browse the repository at this point in the history
Airlift's `ExtendedSettableFuture` is meant to be a drop-in replacement
of `SettableFuture`, adding `setAync` method allowing to complete one
future once another is done (and propagating cancellations).

`SettableFuture` now has `setFuture` method for that purpose.
  • Loading branch information
findepi committed Jan 13, 2022
1 parent b804fa0 commit 1b0d119
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.ListenableFuture;
import io.airlift.concurrent.ExtendedSettableFuture;
import com.google.common.util.concurrent.SettableFuture;
import io.airlift.slice.Slice;
import io.airlift.units.DataSize;
import io.trino.execution.StateMachine;
Expand Down Expand Up @@ -351,7 +351,7 @@ private static class PendingRead
private final long startingSequenceId;
private final DataSize maxSize;

private final ExtendedSettableFuture<BufferResult> futureResult = ExtendedSettableFuture.create();
private final SettableFuture<BufferResult> futureResult = SettableFuture.create();

public PendingRead(OutputBufferId bufferId, long startingSequenceId, DataSize maxSize)
{
Expand All @@ -360,7 +360,7 @@ public PendingRead(OutputBufferId bufferId, long startingSequenceId, DataSize ma
this.maxSize = requireNonNull(maxSize, "maxSize is null");
}

public ExtendedSettableFuture<BufferResult> getFutureResult()
public SettableFuture<BufferResult> getFutureResult()
{
return futureResult;
}
Expand All @@ -373,7 +373,7 @@ public void process(OutputBuffer delegate)

try {
ListenableFuture<BufferResult> result = delegate.get(bufferId, startingSequenceId, maxSize);
futureResult.setAsync(result);
futureResult.setFuture(result);
}
catch (Exception e) {
futureResult.setException(e);
Expand Down

0 comments on commit 1b0d119

Please sign in to comment.