You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by Randgalt <gi...@git.apache.org> on 2017/01/10 17:06:48 UTC

[GitHub] curator issue #193: [CURATOR-311] SharedValue could hold stall data when quo...

Github user Randgalt commented on the issue:

    https://github.com/apache/curator/pull/193
  
    I'm -1 on this PR overall. The purpose of `state` internally is not to hold the connection state. It's to hold the started state of the instanced. Mixing the two is bound to cause problems. 
    
    A simpler solution would be:
    
    ```java
        private final ConnectionStateListener connectionStateListener = new ConnectionStateListener()
        {
            @Override
            public void stateChanged(CuratorFramework client, ConnectionState newState)
            {
                notifyListenerOfStateChanged(newState);
                if ( newState == ConnectionState.RECONNECTED )
                {
                    try
                    {
                        readValueAndNotifyListenersInBackground();
                    }
                    catch ( Exception e )
                    {
                        log.error("Could not read value after reconnect", e);
                    }
                }
            }
        };
    ```



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---