@@ -43,25 +43,44 @@ public interface ConfigurableComponent {
4343 PropertyDescriptor getPropertyDescriptor (String name );
4444
4545 /**
46+ * <p>
4647 * Hook method allowing subclasses to eagerly react to a configuration
4748 * change for the given property descriptor. This method will be invoked
4849 * regardless of property validity. As an alternative to using this method,
4950 * a component may simply get the latest value whenever it needs it and if
5051 * necessary lazily evaluate it. Any throwable that escapes this method will
5152 * simply be ignored.
53+ * </p>
5254 *
55+ * <p>
5356 * When NiFi is restarted, this method will be called for each 'dynamic' property that is
54- * added, as well as for each property that is not set to the default value. I.e., if the
55- * Properties are modified from the default values. If it is undesirable for your use case
57+ * added, as well as for each property that has a value. I.e., even if the
58+ * Properties are not modified from the default values. If it is undesirable for your use case
5659 * to react to properties being modified in this situation, you can add the {@link OnConfigurationRestored}
5760 * annotation to a method - this will allow the Processor to know when configuration has
5861 * been restored, so that it can determine whether or not to perform some action in the
59- * onPropertyModified method.
62+ * onPropertyModified method. This can be done as follows:
63+ * </p>
64+ *
65+ * <pre>{@code
66+ * private volatile boolean configurationRestored = false;
67+ *
68+ * @OnConfigurationRestored
69+ * public void onConfigurationRestored() {
70+ * this.configurationRestored = true;
71+ * }
72+ *
73+ * public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String newValue) {
74+ * if (!configurationRestored) {
75+ * return;
76+ * }
77+ * }
78+ * }</pre>
6079 *
6180 * @param descriptor the descriptor for the property being modified
62- * @param oldValue the value that was previously set, or null if no value
63- * was previously set for this property
64- * @param newValue the new property value or if null indicates the property
81+ * @param oldValue the value that was previously set. Will be <code> null</code> if no value
82+ * was previously set for this property, on NiFi startup or on first modification after component is added to graph
83+ * @param newValue the new property value or if <code> null</code> indicates the property
6584 * was removed
6685 */
6786 void onPropertyModified (PropertyDescriptor descriptor , String oldValue , String newValue );
0 commit comments