zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "yangkun (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ZOOKEEPER-3134) NIOServerCnxnFactory#run() method should remove synchronized (this)
Date Wed, 29 Aug 2018 13:35:00 GMT
yangkun created ZOOKEEPER-3134:
----------------------------------

             Summary: NIOServerCnxnFactory#run() method should remove synchronized (this)
                 Key: ZOOKEEPER-3134
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3134
             Project: ZooKeeper
          Issue Type: Improvement
            Reporter: yangkun


Now NIOServerCnxnFactory#run() method is:

 
{code:java}
while (!ss.socket().isClosed()) {
    try {
        selector.select(1000);
        Set<SelectionKey> selected;
        // should remove synchronized?
        synchronized (this) {
           selected = selector.selectedKeys();
        }
       ArrayList<SelectionKey> selectedList = new ArrayList<SelectionKey>(selected);
       ...
    }
}
{code}
It seems like no need to use synchronized (this)  statement, here is thread safe, should
remove this statement?

Or is any of this statement  making sense?

 

 



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

Mime
View raw message