[
https://issues.apache.org/jira/browse/FLINK-6665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16071330#comment-16071330
]
ASF GitHub Bot commented on FLINK-6665:
---------------------------------------
Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/4220#discussion_r125165262
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/ExecutionGraphRestarter.java
---
@@ -42,4 +48,23 @@ public Object call() throws Exception {
}
};
}
-}
\ No newline at end of file
+
+ public static void scheduleRestartWithDelay(final ExecutionGraph
executionGraph, final long delayBetweenRestartAttemptsInMillis,
+
final ScheduledExecutorService executorService) {
+ ScheduledFuture<Object> future = executorService.schedule(
+ new Callable<Object>() {
+ @Override
+ public Object call() throws Exception {
+ executionGraph.restart();
+ return null;
+ }
+ }, delayBetweenRestartAttemptsInMillis,
TimeUnit.MILLISECONDS
+ );
+
+ try {
+ future.get();
--- End diff --
This `get()` operation voids the idea of the executor service because it
blocks the calling thread.
> Pass a ScheduledExecutorService to the RestartStrategy
> ------------------------------------------------------
>
> Key: FLINK-6665
> URL: https://issues.apache.org/jira/browse/FLINK-6665
> Project: Flink
> Issue Type: Sub-task
> Components: Distributed Coordination
> Reporter: Stephan Ewen
> Assignee: Fang Yong
> Fix For: 1.4.0
>
>
> Currently, the {{RestartStrategy}} is called when the {{ExecutionGraph}}
> should be restarted.
> To facilitate delays before restarting, the strategy simply sleeps, blocking
> the thread that runs the ExecutionGraph's recovery method.
> I suggest to pass {{ScheduledExecutorService}}) to the {{RestartStrategy}}
> and let it schedule the restart call that way, avoiding any sleeps.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)