You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/07/06 18:50:26 UTC

[GitHub] [zookeeper] kaansonmezoz commented on a change in pull request #1350: ZOOKEEPER-3709: Pre-defined the size of ByteArrayOutputStream

kaansonmezoz commented on a change in pull request #1350:
URL: https://github.com/apache/zookeeper/pull/1350#discussion_r450416031



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java
##########
@@ -246,18 +246,23 @@ void request(Request request) throws IOException {
             LOG.error("Throttled request sent to leader: {}. Exiting", request);
             ServiceUtils.requestSystemExit(ExitCode.UNEXPECTED_ERROR.getValue());
         }
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        // size of sessionId, cxId and type in bytes
+        int size = Long.BYTES + 2 * Integer.BYTES;
+        byte[] bytes = null;
+        if(request.request != null) {

Review comment:
       Oh man thanks a lot. I thought I fixed that one but it turns out there is another one out there :( 




----------------------------------------------------------------
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:
users@infra.apache.org