Github user rbnks commented on a diff in the pull request:
https://github.com/apache/incubator-streams/pull/66#discussion_r16263298
--- Diff:
streams-util/src/main/java/org/apache/streams/util/ComponentUtils.java ---
@@ -58,21 +83,23 @@ public static String pollUntilStringNotEmpty(Queue
queue) {
return result;
}
+ /**
+ * Attempts to safely {@link
java.util.concurrent.ExecutorService#shutdown()} and {@link
java.util.concurrent.ExecutorService#awaitTermination(long,
java.util.concurrent.TimeUnit)}
+ * of an {@link java.util.concurrent.ExecutorService}.
+ * @param stream service to be shutdown
+ * @param initialWait time in seconds to wait for currently running
threads to finish execution
+ * @param secondaryWait time in seconds to wait for running threads
that did not terminate in the first wait to acknowledge their forced termination
+ */
public static void shutdownExecutor(ExecutorService stream, int
initialWait, int secondaryWait) {
- stream.shutdown(); // Disable new tasks from being submitted
+ stream.shutdown();
try {
- // Wait a while for existing tasks to terminate
if (!stream.awaitTermination(initialWait, TimeUnit.SECONDS)) {
- stream.shutdownNow(); // Cancel currently executing tasks
--- End diff --
I thought I only removed the comment.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---