Github user joewitt commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1478#discussion_r100958624
  
    --- Diff: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java
 ---
    @@ -284,7 +251,7 @@ public boolean isRunning() {
     
         @Override
         public void start() throws LifeCycleStartException {
    -        writeLock.lock();
    +       dao.writeProtectFlow();
    --- End diff --
    
    this is leaking responsibilities.  The 'dao' should either be said to be 
thread safe or not.  The previous approach was not thread safe and thus we had 
locking around it as was in the previous implementation.  Here we have some 
cases guarded and some not but we're actually invoking a lock within the 
non-thread safe class now.  This approach is harder to reason over in my 
opinion.  We should either make the class thread safe and the caller does not 
need to do anything special or it should be not thread safe and the calling 
class should protect it (as it was).  Though this method shows we need to have 
some of that logic external so it makes sense to keep the locking as it was 
(controlled by the caller with the callee/dao being not thread safe by design)


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

Reply via email to