Dear developer:
I think the following code in line 623 of the QuorumCnxManager class can be
optimized:
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);
}
The optimization is as follows:
ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.computeIfAbsent(sid,
serverId -> new ArrayBlockingQueue<>(SEND_CAPACITY));
addToSendQueue(bq, b);
Thanks
| |
18779116352
邮箱:[email protected]
|
Signature is customized by Netease Mail Master