File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,26 @@ public ExecutorService workflowExecutorService() {
70
70
return workflowExecutor ;
71
71
}
72
72
73
+ /**
74
+ * Runs the specified I/O-bound task and waits for its completion using the ExecutorService
75
+ * provided by {@link #workflowExecutorService()}
76
+ *
77
+ * @param task task to run concurrently
78
+ */
73
79
public static void executeAndWaitForCompletion (Runnable task ) {
80
+ executeAndWaitForCompletion (task , instance ().workflowExecutorService ());
81
+ }
82
+
83
+ /**
84
+ * Executes the specified I/O-bound task using the specified ExecutorService and waits for its
85
+ * completion for at most {@link #terminationTimeoutSeconds} seconds.
86
+ *
87
+ * @param task task to run concurrently
88
+ * @param executor ExecutorService used to run the task
89
+ */
90
+ public static void executeAndWaitForCompletion (Runnable task , ExecutorService executor ) {
74
91
try {
75
- instance ().workflowExecutorService ().submit (task )
76
- .get (instance ().terminationTimeoutSeconds , TimeUnit .SECONDS );
92
+ executor .submit (task ).get (instance ().terminationTimeoutSeconds , TimeUnit .SECONDS );
77
93
} catch (InterruptedException | ExecutionException | TimeoutException e ) {
78
94
throw new OperatorException ("Couldn't execute task" , e );
79
95
}
You can’t perform that action at this time.
0 commit comments