BELUGABEHR commented on a change in pull request #870: ZOOKEEPER-3335: Prefer 
ArrayList over LinkedList
URL: https://github.com/apache/zookeeper/pull/870#discussion_r269381061
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZKDatabase.java
 ##########
 @@ -281,8 +287,8 @@ public void addCommittedProposal(Request request) {
         try {
             wl.lock();
             if (committedLog.size() > commitLogCount) {
-                committedLog.removeFirst();
-                minCommittedLog = committedLog.getFirst().packet.getZxid();
+                committedLog.remove();
+                minCommittedLog = committedLog.peek().packet.getZxid();
 
 Review comment:
   FYI.  There is a slight difference between getFirst() and peek().  
getFirst() will throw a NoSuchElementException if the queue is empty.  The 
peek() method will return a null. So, the change here will subsequently throw a 
NullPointerException instead.  Note it's a bit of a moot point since it should 
never be empty at his point.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to