Paul Millar created ZOOKEEPER-2991:
--------------------------------------

             Summary: Server logs error on shutdown
                 Key: ZOOKEEPER-2991
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2991
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
    Affects Versions: 3.4.11, 3.4.10
            Reporter: Paul Millar


Commit d497aac4 introduced the ZooKeeperServer#registerServerShutdownHandler 
method and corresponding ZooKeeperServerShutdownHandler class.  Both the method 
and class are package-protected, resulting in the expectation that non-ZK code 
should not use either.

However, if registerServerShutdownHandler is *not* called, then ZK will log an 
error:
{quote}ZKShutdownHandler is not registered, so ZooKeeper server won't take any 
action on ERROR or SHUTDOWN server state changes
{quote}
There are several problems here.  In order of importance (for me, at least!)

First, (most important) this certainly should not be logged as an error.  
Depending on usage, there may be no need for a shutdown handler.  Always 
logging an error (with no opportunity to silence it) is therefore wrong.

Second, the ability to learn of state changes may be of general interest 
(monitoring, etc); however, this is not possible if the method is protected.

Third, the method accepts a concrete class that is designed to use a 
CountDownLatch. This is not appropriate in all cases.  The method should be 
updated to accept an interface.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to