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/05 14:57:14 UTC

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

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



##########
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:
       you need a space after the 'if' statement to fix the checkstyle error.
   (btw you can run checkstyle locally by: `mvn verify spotbugs:check checkstyle:check -DskipTests` )




----------------------------------------------------------------
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