exceptionfactory commented on a change in pull request #4852:
URL: https://github.com/apache/nifi/pull/4852#discussion_r583908315



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessDataflowFactory.java
##########
@@ -148,7 +149,19 @@ public StatelessDataflow createDataflow(final 
StatelessEngineConfiguration engin
                 narClassLoaders, extensionClients);
 
             final VariableRegistry variableRegistry = 
VariableRegistry.EMPTY_REGISTRY;
-            final PropertyEncryptor encryptor = 
getPropertyEncryptor(engineConfiguration.getSensitivePropsKey());
+            final Supplier<PropertyEncryptor> encryptorFactory = new 
Supplier<PropertyEncryptor>() {
+                private PropertyEncryptor created = null;
+
+                @Override
+                public synchronized PropertyEncryptor get() {

Review comment:
       Is it worth considering a more optimized locking strategy than 
method-level synchronization since this may get called multiple times?  Some 
options include checking the `PropertyEncryptor` instance for null and then 
synchronizing around that object, or leveraging Apache Commons 
`AtomicInitializer`, or implementing something along the lines of that class.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to