rdhabalia commented on a change in pull request #689: Netty 4.1
URL: https://github.com/apache/incubator-pulsar/pull/689#discussion_r153633906
 
 

 ##########
 File path: build/docker/protobuf.patch
 ##########
 @@ -161,30 +167,30 @@ index 4c087db..cd18e28 100644
          "classname", ClassName(descriptor_));
      }
    }
-@@ -760,9 +792,21 @@ void 
MessageGenerator::GenerateDescriptorMethods(io::Printer* printer) {
+@@ -760,9 +794,21 @@ void 
MessageGenerator::GenerateDescriptorMethods(io::Printer* printer) {
  void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
    printer->Print(
      "// Construct using $classname$.newBuilder()\n"
 -    "private Builder() {\n"
-+    "private final io.netty.util.Recycler.Handle handle;\n"
-+    "private Builder(io.netty.util.Recycler.Handle handle) {\n"
++    "private final io.netty.util.Recycler.Handle<Builder> handle;\n"
++    "private Builder(io.netty.util.Recycler.Handle<Builder> handle) {\n"
 +    "  this.handle = handle;\n"
      "  maybeForceBuilderInitialization();\n"
      "}\n"
 +    "private final static io.netty.util.Recycler<Builder> RECYCLER = new 
io.netty.util.Recycler<Builder>() {\n"
-+    "   protected Builder newObject(io.netty.util.Recycler.Handle handle) {\n"
++    "   protected Builder newObject(io.netty.util.Recycler.Handle<Builder> 
handle) {\n"
 +    "         return new Builder(handle);\n"
 +    "       }\n"
 +    "      };\n"
 +    "\n"
 +    " public void recycle() {\n"
 +    "          clear();\n"
-+    "          if (handle != null) {RECYCLER.recycle(this, handle);}\n"
-+    "      }\n"    
++    "          handle.recycle(this);\n"
 
 Review comment:
   I am not exactly sure, but if we remove null-check then can we have any 
scenario where we recycle objects whose handler is null.?

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


With regards,
Apache Git Services

Reply via email to