pvillard31 commented on code in PR #11935:
URL: https://github.com/apache/nifi/pull/11935#discussion_r4606569072
##########
nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java:
##########
@@ -2305,12 +2305,13 @@ private void monitorAsyncTask(final Future<?>
taskFuture, final Future<?> monito
monitoringFuture.cancel(false);
final Processor processor = processorRef.get().getProcessor();
- LOG.warn("Timed out while waiting for OnScheduled of "
- + processor + " to finish. An attempt is made to cancel the
task via Thread.interrupt(). However it does not "
- + "guarantee that the task will be canceled since the code
inside current OnScheduled operation may "
- + "have been written to ignore interrupts which may result in
a runaway thread. This could lead to more issues, "
- + "eventually requiring NiFi to be restarted. This is usually
a bug in the target Processor '"
- + processor + "' that needs to be documented, reported and
eventually fixed.");
+ LOG.warn("Timed out while waiting for OnScheduled of {} to finish.
An attempt is made to cancel the task via Thread.interrupt(). {} {} {} '{}' {}",
Review Comment:
Could we keep the fixed text in one template and use `{}` only for
`processor`, so the message stays readable?
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/monitor/LongRunningTaskMonitor.java:
##########
@@ -62,8 +62,8 @@ public void run() {
String taskSeconds = String.format("%,d seconds",
activeThread.getActiveMillis() / 1000);
- getLogger().warn(String.format("Long running task detected
on processor [id=%s, name=%s, type=%s]. Task time: %s. Stack trace:\n%s",
- processorNode.getIdentifier(),
processorNode.getName(), processorNode.getComponentType(), taskSeconds,
activeThread.getStackTrace()));
+ getLogger().warn("Long running task detected on processor
[id={}, name={}, type={}]. Task time: {}. Stack trace:\n{}",
Review Comment:
About the multi-line messages in `PutS3Object`: since joining string
literals with `+` gives a compile-time constant, do we need to change those at
all, or can we keep this PR limited to concatenation with runtime values?
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/LongRunningTaskMonitorTest.java:
##########
@@ -85,12 +86,25 @@ protected ThreadDetails captureThreadDetails() {
longRunningTaskMonitor.run();
- ArgumentCaptor<String> logMessages =
ArgumentCaptor.forClass(String.class);
- verify(longRunningTaskMonitorLogger,
times(2)).warn(logMessages.capture());
+ ArgumentCaptor<String> logMessageTemplates =
ArgumentCaptor.forClass(String.class);
Review Comment:
Could we assert on the bulletin messages or the processor details instead of
rebuilding the log text with `MessageFormatter`, so the test does not depend on
the logging format?
##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java:
##########
@@ -973,8 +973,8 @@ private ConnectionResponse connect(final boolean
retryOnCommsFailure, final bool
// if response indicates we should try later, then coordinator
was unable to service our request. Just load local flow and move on.
// when the cluster coordinator is able to service requests,
this node's heartbeat will trigger the cluster coordinator to reach
// out to this node and re-connect to the cluster.
- logger.info("Received a 'try again' response from Cluster
Coordinator when attempting to connect to cluster with explanation '"
- + response.getRejectionReason() + "'. However, the maximum
number of retries have already completed. Will load local flow and connect to
the cluster when able.");
+ logger.info("Received a 'try again' response from Cluster
Coordinator when attempting to connect to cluster with explanation '{}'. {}",
Review Comment:
Should the second sentence be part of the template instead of a `{}`
argument, since it is a fixed string?
##########
nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/ListHDFS.java:
##########
@@ -245,8 +245,8 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
final long legacyLatestEmittedTimestamp =
Long.parseLong(legacyLatestEmittedTimestampString);
latestTimestamp = legacyLatestListingTimestamp ==
legacyLatestEmittedTimestamp ? legacyLatestListingTimestamp + 1 :
legacyLatestListingTimestamp;
latestFiles = new ArrayList<>();
- getLogger().debug("Transitioned from legacy state to new
state. 'legacyLatestListingTimestamp': {}, 'legacyLatestEmittedTimeStamp':
{}'," +
- "'latestTimestamp': {}", legacyLatestListingTimestamp,
legacyLatestEmittedTimestamp, latestTimestamp);
+ getLogger().debug("Transitioned from legacy state to new
state. 'legacyLatestListingTimestamp': {}, 'legacyLatestEmittedTimeStamp': {}',
'latestTimestamp': {}",
Review Comment:
Can we also remove the extra `'` after the second `{}` while this line is
being changed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]