Skip to content

Commit

Permalink
Fix the logic of checking of variables (apache#3979)
Browse files Browse the repository at this point in the history
  • Loading branch information
srkukarni authored and merlimat committed Apr 4, 2019
1 parent b7903fa commit 108c525
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,14 @@ public Throwable getDeathException() {
@Override
public CompletableFuture<FunctionStatus> getFunctionStatus(int instanceId) {
CompletableFuture<FunctionStatus> retval = new CompletableFuture<>();
if (instanceId < 0 || instanceId >= stub.length) {
if (stub == null) {
retval.completeExceptionally(new RuntimeException("Invalid InstanceId"));
return retval;
}
}
if (stub == null) {
retval.completeExceptionally(new RuntimeException("Not alive"));
return retval;
}
if (instanceId < 0 || instanceId >= stub.length) {
retval.completeExceptionally(new RuntimeException("Invalid InstanceId"));
return retval;
}
ListenableFuture<FunctionStatus> response = stub[instanceId].withDeadlineAfter(GRPC_TIMEOUT_SECS, TimeUnit.SECONDS).getFunctionStatus(Empty.newBuilder().build());
Futures.addCallback(response, new FutureCallback<FunctionStatus>() {
@Override
Expand Down

0 comments on commit 108c525

Please sign in to comment.