[hotfix] Remove redundant FutureUtils#getFailedFuture

FutureUtils#completedExceptionally does exactly the same.
上级 152f6c9a
......@@ -169,7 +169,7 @@ public class KvStateClientProxyHandler extends AbstractServerHandler<KvStateRequ
final InetSocketAddress serverAddress = location.getKvStateServerAddress(keyGroupIndex);
if (serverAddress == null) {
return FutureUtils.getFailedFuture(new UnknownKvStateKeyGroupLocationException(getServerName()));
return FutureUtils.completedExceptionally(new UnknownKvStateKeyGroupLocationException(getServerName()));
} else {
// Query server
final KvStateID kvStateId = location.getKvStateID(keyGroupIndex);
......
......@@ -43,7 +43,7 @@ import java.util.concurrent.CompletableFuture;
public class KvStateClientProxyImpl extends AbstractServerBase<KvStateRequest, KvStateResponse> implements KvStateClientProxy {
private static final CompletableFuture<ActorGateway> UNKNOWN_JOB_MANAGER =
FutureUtils.getFailedFuture(new UnknownJobManagerException());
FutureUtils.completedExceptionally(new UnknownJobManagerException());
/** Number of threads used to process incoming requests. */
private final int queryExecutorThreads;
......
......@@ -445,20 +445,4 @@ public class FutureUtils {
return result;
}
// ------------------------------------------------------------------------
// Future Completed with an exception.
// ------------------------------------------------------------------------
/**
* Returns a {@link CompletableFuture} that has failed with the exception
* provided as argument.
* @param throwable the exception to fail the future with.
* @return The failed future.
*/
public static <T> CompletableFuture<T> getFailedFuture(Throwable throwable) {
CompletableFuture<T> failedAttempt = new CompletableFuture<>();
failedAttempt.completeExceptionally(throwable);
return failedAttempt;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册