[
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17702906#comment-17702906
]
Mark Payne commented on NIFI-7123:
----------------------------------
[~Nissim Shiman] I believe this has been encountered before. But we did not
change the way that it works, because we didn't want to break backward
compatibility. Often, the logic assumes that the {{onPropertyModified}} will be
called on startup. So, typically, the pattern that is followed is something
like this:
{code:java}
private volatile configurationRestored = false;
@OnConfigurationRestored
public void onConfigurationRestored() {
this.configurationRestored = true;
}
public void onPropertyModified(PropertyDescriptor descriptor, String oldValue,
String newValue) {
if (!configurationRestored) {
return;
}
}{code}
So effectively, ignore the call to {{onPropertyModified}} until the
configuration has been restored on startup.
> onPropertyModified() is called on nifi start up even when properties have
> never been modified
> ---------------------------------------------------------------------------------------------
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.11.0
> Reporter: Nissim Shiman
> Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller
> services, even for properties that are set to their defaults (i.e. have never
> been modified).
> [1]
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68
--
This message was sent by Atlassian Jira
(v8.20.10#820010)