Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine;
import org.apache.hadoop.ozone.container.common.statemachine.EndpointStateMachine;
Expand Down Expand Up @@ -97,9 +98,17 @@ public void execute(ExecutorService executor) {
} else {
heartbeatFrequency = context.getHeartbeatFrequency();
}
ecs.submit(() -> endpoint.getExecutorService()
.submit(endpointTask)
.get(heartbeatFrequency, TimeUnit.MILLISECONDS));
ecs.submit(() -> {
try {
return endpoint.getExecutorService()
.submit(endpointTask)
.get(context.getHeartbeatFrequency(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
TimeoutException timeoutEx = new TimeoutException("Timeout occurred on endpoint: " + endpoint.getAddress());
timeoutEx.initCause(e);
throw timeoutEx;
}
});
} else {
// This can happen if a task is taking more time than the timeOut
// specified for the task in await, and when it is completed the task
Expand Down Expand Up @@ -167,7 +176,12 @@ private Callable<EndPointStates> buildEndPointTask(
LOG.error("Error in executing end point task.", e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
LOG.error("Error in executing end point task.", e);
Throwable cause = e.getCause();
if (cause instanceof TimeoutException) {
LOG.warn("Detected timeout: {}", cause.getMessage());
} else {
LOG.error("Error in executing end point task.", e);
}
}
}
return DatanodeStateMachine.DatanodeStates.RUNNING;
Expand Down
Loading