Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/275#discussion_r56044999
--- Diff:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java
---
@@ -1382,21 +1372,16 @@ public void run() {
* be logged (WARN) informing a user so further actions could be taken.
* </p>
*/
- private void invokeTaskAsCancelableFuture(ScheduledExecutorService
taskScheduler, Callable<Void> task) {
- Future<Void> executionResult = taskScheduler.submit(task);
-
- String timeoutString =
NiFiProperties.getInstance().getProperty(NiFiProperties.PROCESSOR_SCHEDULING_TIMEOUT);
- long onScheduleTimeout = timeoutString == null ? Long.MAX_VALUE
- : FormatUtils.getTimeDuration(timeoutString.trim(),
TimeUnit.MILLISECONDS);
-
+ private <T> void invokeTaskAsCancelableFuture(SchedulingAgentCallback
callback, Callable<T> task) {
try {
- executionResult.get(onScheduleTimeout, TimeUnit.MILLISECONDS);
+ callback.invokeTaskAsCancelableFuture(task);
} catch (InterruptedException e) {
LOG.warn("Thread was interrupted while waiting for processor
'" + this.processor.getClass().getSimpleName()
+ "' lifecycle operation (OnScheduled or
OnUnscheduled) to finish.");
Thread.currentThread().interrupt();
+ throw new RuntimeException("Interrupted while executing one of
processor's lifecycle tasks (OnScheduled or OnUnscheduled).", e);
} catch (TimeoutException e) {
- executionResult.cancel(true);
+ //executionResult.cancel(true);
--- End diff --
If we don't need this line, can we remove it, instead of commenting it out?
---
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.
---