Skip to content

Commit

Permalink
timeout on waitfor
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Dec 5, 2023
1 parent 85124fb commit acd6875
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Optional;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOutboundHandlerAdapter;
Expand Down Expand Up @@ -450,8 +451,15 @@ else if (aop.aggOp.increOp.fn instanceof Builtin &&

public static void waitFor(List<Future<FederatedResponse>> responses) {
try {
for(Future<FederatedResponse> fr : responses)
fr.get();
final int timeout = ConfigurationManager.getFederatedTimeout();
if(timeout > 0){
for(Future<FederatedResponse> fr : responses)
fr.get(timeout, TimeUnit.SECONDS);
}
else {
for(Future<FederatedResponse> fr : responses)
fr.get();
}
}
catch(Exception ex) {
throw new DMLRuntimeException(ex);
Expand Down

0 comments on commit acd6875

Please sign in to comment.