[
https://issues.apache.org/jira/browse/ZOOKEEPER-3457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16894555#comment-16894555
]
Hudson commented on ZOOKEEPER-3457:
-----------------------------------
SUCCESS: Integrated in Jenkins build ZooKeeper-trunk #631 (See
[https://builds.apache.org/job/ZooKeeper-trunk/631/])
ZOOKEEPER-3457: Code optimization in QuorumCnxManager (andor: rev
83940b18ce70016de7400f6159ce2a2db5a0bbec)
* (edit)
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
> Code optimization in QuorumCnxManager
> -------------------------------------
>
> Key: ZOOKEEPER-3457
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3457
> Project: ZooKeeper
> Issue Type: Improvement
> Components: quorum
> Affects Versions: 3.5.5
> Reporter: tom.long
> Assignee: tom.long
> Priority: Trivial
> Labels: easyfix, pull-request-available
> Fix For: 3.6.0
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Dear developer:
> I think the following code in line 623 of the QuorumCnxManager class can be
> optimized:
> {code:java}
> ArrayBlockingQueue<ByteBuffer> bq = new ArrayBlockingQueue<ByteBuffer>(
> SEND_CAPACITY);
> ArrayBlockingQueue<ByteBuffer> oldq = queueSendMap.putIfAbsent(sid, bq);
> if (oldq != null) {
> addToSendQueue(oldq, b);
> } else {
> addToSendQueue(bq, b);
> }
> {code}
> The optimization is as follows:
> {code:java}
> ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.computeIfAbsent(sid,
> serverId
> -> new ArrayBlockingQueue<>(SEND_CAPACITY));
> addToSendQueue(bq, b);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)