diff --git a/src/google/protobuf/compiler/java/java_enum.cc b/src/google/protobuf/compiler/java/java_enum.cc
index 9d7bcab6..71c4ab70 100644
--- a/src/google/protobuf/compiler/java/java_enum.cc
+++ b/src/google/protobuf/compiler/java/java_enum.cc
@@ -70,12 +70,12 @@ void EnumGenerator::Generate(io::Printer* printer) {
   if (HasDescriptorMethods(descriptor_)) {
     printer->Print(
       "public enum $classname$\n"
-      "    implements com.google.protobuf.ProtocolMessageEnum {\n",
+      "    implements org.apache.pulsar.shaded.com.google.protobuf.v241.ProtocolMessageEnum {\n",
       "classname", descriptor_->name());
   } else {
     printer->Print(
       "public enum $classname$\n"
-      "    implements com.google.protobuf.Internal.EnumLite {\n",
+      "    implements org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.EnumLite {\n",
       "classname", descriptor_->name());
   }
   printer->Indent();
@@ -139,13 +139,13 @@ void EnumGenerator::Generate(io::Printer* printer) {
     "  }\n"
     "}\n"
     "\n"
-    "public static com.google.protobuf.Internal.EnumLiteMap<$classname$>\n"
+    "public static org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.EnumLiteMap<$classname$>\n"
     "    internalGetValueMap() {\n"
     "  return internalValueMap;\n"
     "}\n"
-    "private static com.google.protobuf.Internal.EnumLiteMap<$classname$>\n"
+    "private static org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.EnumLiteMap<$classname$>\n"
     "    internalValueMap =\n"
-    "      new com.google.protobuf.Internal.EnumLiteMap<$classname$>() {\n"
+    "      new org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.EnumLiteMap<$classname$>() {\n"
     "        public $classname$ findValueByNumber(int number) {\n"
     "          return $classname$.valueOf(number);\n"
     "        }\n"
@@ -158,15 +158,15 @@ void EnumGenerator::Generate(io::Printer* printer) {
 
   if (HasDescriptorMethods(descriptor_)) {
     printer->Print(
-      "public final com.google.protobuf.Descriptors.EnumValueDescriptor\n"
+      "public final org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.EnumValueDescriptor\n"
       "    getValueDescriptor() {\n"
       "  return getDescriptor().getValues().get(index);\n"
       "}\n"
-      "public final com.google.protobuf.Descriptors.EnumDescriptor\n"
+      "public final org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.EnumDescriptor\n"
       "    getDescriptorForType() {\n"
       "  return getDescriptor();\n"
       "}\n"
-      "public static final com.google.protobuf.Descriptors.EnumDescriptor\n"
+      "public static final org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.EnumDescriptor\n"
       "    getDescriptor() {\n");
 
     // TODO(kenton):  Cache statically?  Note that we can't access descriptors
@@ -201,7 +201,7 @@ void EnumGenerator::Generate(io::Printer* printer) {
       "};\n"
       "\n"
       "public static $classname$ valueOf(\n"
-      "    com.google.protobuf.Descriptors.EnumValueDescriptor desc) {\n"
+      "    org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.EnumValueDescriptor desc) {\n"
       "  if (desc.getType() != getDescriptor()) {\n"
       "    throw new java.lang.IllegalArgumentException(\n"
       "      \"EnumValueDescriptor is not for this type.\");\n"
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc
index 72caa10b..fb7ef574 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field.cc
@@ -227,7 +227,7 @@ void EnumFieldGenerator::
 GenerateSerializedSizeCode(io::Printer* printer) const {
   printer->Print(variables_,
     "if ($get_has_field_bit_message$) {\n"
-    "  size += com.google.protobuf.CodedOutputStream\n"
+    "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .computeEnumSize($number$, $name$_.getNumber());\n"
     "}\n");
 }
@@ -484,7 +484,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
 
   printer->Print(variables_,
     "for (int i = 0; i < $name$_.size(); i++) {\n"
-    "  dataSize += com.google.protobuf.CodedOutputStream\n"
+    "  dataSize += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .computeEnumSizeNoTag($name$_.get(i).getNumber());\n"
     "}\n");
   printer->Print(
@@ -493,7 +493,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
     printer->Print(variables_,
       "if (!get$capitalized_name$List().isEmpty()) {"
       "  size += $tag_size$;\n"
-      "  size += com.google.protobuf.CodedOutputStream\n"
+      "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
       "    .computeRawVarint32Size(dataSize);\n"
       "}");
   } else {
diff --git a/src/google/protobuf/compiler/java/java_extension.cc b/src/google/protobuf/compiler/java/java_extension.cc
index 9b147c77..99846474 100644
--- a/src/google/protobuf/compiler/java/java_extension.cc
+++ b/src/google/protobuf/compiler/java/java_extension.cc
@@ -137,9 +137,9 @@ void ExtensionGenerator::Generate(io::Printer* printer) {
       printer->Print(
           vars,
           "public static final\n"
-          "  com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
+          "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.GeneratedExtension<\n"
           "    $containing_type$,\n"
-          "    $type$> $name$ = com.google.protobuf.GeneratedMessage\n"
+          "    $type$> $name$ = org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage\n"
           "        .newFileScopedGeneratedExtension(\n"
           "      $singular_type$.class,\n"
           "      $prototype$);\n");
@@ -148,9 +148,9 @@ void ExtensionGenerator::Generate(io::Printer* printer) {
       printer->Print(
           vars,
           "public static final\n"
-          "  com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
+          "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.GeneratedExtension<\n"
           "    $containing_type$,\n"
-          "    $type$> $name$ = com.google.protobuf.GeneratedMessage\n"
+          "    $type$> $name$ = org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage\n"
           "        .newMessageScopedGeneratedExtension(\n"
           "      $scope$.getDefaultInstance(),\n"
           "      $index$,\n"
@@ -163,30 +163,30 @@ void ExtensionGenerator::Generate(io::Printer* printer) {
       printer->Print(
           vars,
           "public static final\n"
-          "  com.google.protobuf.GeneratedMessageLite.GeneratedExtension<\n"
+          "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.GeneratedExtension<\n"
           "    $containing_type$,\n"
-          "    $type$> $name$ = com.google.protobuf.GeneratedMessageLite\n"
+          "    $type$> $name$ = org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite\n"
           "        .newRepeatedGeneratedExtension(\n"
           "      $containing_type$.getDefaultInstance(),\n"
           "      $prototype$,\n"
           "      $enum_map$,\n"
           "      $number$,\n"
-          "      com.google.protobuf.WireFormat.FieldType.$type_constant$,\n"
+          "      org.apache.pulsar.shaded.com.google.protobuf.v241.WireFormat.FieldType.$type_constant$,\n"
           "      $packed$);\n");
     } else {
       printer->Print(
           vars,
           "public static final\n"
-          "  com.google.protobuf.GeneratedMessageLite.GeneratedExtension<\n"
+          "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.GeneratedExtension<\n"
           "    $containing_type$,\n"
-          "    $type$> $name$ = com.google.protobuf.GeneratedMessageLite\n"
+          "    $type$> $name$ = org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite\n"
           "        .newSingularGeneratedExtension(\n"
           "      $containing_type$.getDefaultInstance(),\n"
           "      $default$,\n"
           "      $prototype$,\n"
           "      $enum_map$,\n"
           "      $number$,\n"
-          "      com.google.protobuf.WireFormat.FieldType.$type_constant$);\n");
+          "      org.apache.pulsar.shaded.com.google.protobuf.v241.WireFormat.FieldType.$type_constant$);\n");
     }
   }
 }
diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
index 8968069f..86620b74 100644
--- a/src/google/protobuf/compiler/java/java_file.cc
+++ b/src/google/protobuf/compiler/java/java_file.cc
@@ -155,7 +155,7 @@ void FileGenerator::Generate(io::Printer* printer) {
 
   printer->Print(
     "public static void registerAllExtensions(\n"
-    "    com.google.protobuf.ExtensionRegistry$lite$ registry) {\n",
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistry$lite$ registry) {\n",
     "lite", HasDescriptorMethods(file_) ? "" : "Lite");
 
   printer->Indent();
@@ -249,11 +249,11 @@ void FileGenerator::GenerateEmbeddedDescriptor(io::Printer* printer) {
   file_proto.SerializeToString(&file_data);
 
   printer->Print(
-    "public static com.google.protobuf.Descriptors.FileDescriptor\n"
+    "public static org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor\n"
     "    getDescriptor() {\n"
     "  return descriptor;\n"
     "}\n"
-    "private static com.google.protobuf.Descriptors.FileDescriptor\n"
+    "private static org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor\n"
     "    descriptor;\n"
     "static {\n"
     "  java.lang.String[] descriptorData = {\n");
@@ -283,12 +283,12 @@ void FileGenerator::GenerateEmbeddedDescriptor(io::Printer* printer) {
   // Create the InternalDescriptorAssigner.
 
   printer->Print(
-    "com.google.protobuf.Descriptors.FileDescriptor."
+    "org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor."
       "InternalDescriptorAssigner assigner =\n"
-    "  new com.google.protobuf.Descriptors.FileDescriptor."
+    "  new org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor."
       "InternalDescriptorAssigner() {\n"
-    "    public com.google.protobuf.ExtensionRegistry assignDescriptors(\n"
-    "        com.google.protobuf.Descriptors.FileDescriptor root) {\n"
+    "    public org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistry assignDescriptors(\n"
+    "        org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor root) {\n"
     "      descriptor = root;\n");
 
   printer->Indent();
@@ -310,8 +310,8 @@ void FileGenerator::GenerateEmbeddedDescriptor(io::Printer* printer) {
     // Must construct an ExtensionRegistry containing all possible extensions
     // and return it.
     printer->Print(
-      "com.google.protobuf.ExtensionRegistry registry =\n"
-      "  com.google.protobuf.ExtensionRegistry.newInstance();\n"
+      "org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistry registry =\n"
+      "  org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistry.newInstance();\n"
       "registerAllExtensions(registry);\n");
     for (int i = 0; i < file_->dependency_count(); i++) {
       if (ShouldIncludeDependency(file_->dependency(i))) {
@@ -339,9 +339,9 @@ void FileGenerator::GenerateEmbeddedDescriptor(io::Printer* printer) {
   // Invoke internalBuildGeneratedFileFrom() to build the file.
 
   printer->Print(
-    "com.google.protobuf.Descriptors.FileDescriptor\n"
+    "org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor\n"
     "  .internalBuildGeneratedFileFrom(descriptorData,\n"
-    "    new com.google.protobuf.Descriptors.FileDescriptor[] {\n");
+    "    new org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.FileDescriptor[] {\n");
 
   for (int i = 0; i < file_->dependency_count(); i++) {
     if (ShouldIncludeDependency(file_->dependency(i))) {
diff --git a/src/google/protobuf/compiler/java/java_helpers.cc b/src/google/protobuf/compiler/java/java_helpers.cc
index 1b6f1653..25a6e300 100644
--- a/src/google/protobuf/compiler/java/java_helpers.cc
+++ b/src/google/protobuf/compiler/java/java_helpers.cc
@@ -248,7 +248,7 @@ const char* BoxedPrimitiveTypeName(JavaType type) {
     case JAVATYPE_DOUBLE : return "java.lang.Double";
     case JAVATYPE_BOOLEAN: return "java.lang.Boolean";
     case JAVATYPE_STRING : return "java.lang.String";
-    case JAVATYPE_BYTES  : return "com.google.protobuf.ByteString";
+    case JAVATYPE_BYTES  : return "org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString";
     case JAVATYPE_ENUM   : return NULL;
     case JAVATYPE_MESSAGE: return NULL;
 
@@ -314,10 +314,10 @@ string DefaultValue(const FieldDescriptor* field) {
         if (field->has_default_value()) {
           // See comments in Internal.java for gory details.
           return strings::Substitute(
-            "com.google.protobuf.Internal.bytesDefaultValue(\"$0\")",
+            "org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.bytesDefaultValue(\"$0\")",
             CEscape(field->default_value_string()));
         } else {
-          return "com.google.protobuf.ByteString.EMPTY";
+          return "org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString.EMPTY";
         }
       } else {
         if (AllAscii(field->default_value_string())) {
@@ -326,7 +326,7 @@ string DefaultValue(const FieldDescriptor* field) {
         } else {
           // See comments in Internal.java for gory details.
           return strings::Substitute(
-            "com.google.protobuf.Internal.stringDefaultValue(\"$0\")",
+            "org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.stringDefaultValue(\"$0\")",
             CEscape(field->default_value_string()));
         }
       }
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc
index 4c087db5..3ae1c14c 100644
--- a/src/google/protobuf/compiler/java/java_message.cc
+++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -155,7 +155,7 @@ MessageGenerator::~MessageGenerator() {}
 
 void MessageGenerator::GenerateStaticVariables(io::Printer* printer) {
   if (HasDescriptorMethods(descriptor_)) {
-    // Because descriptor.proto (com.google.protobuf.DescriptorProtos) is
+    // Because descriptor.proto (org.apache.pulsar.shaded.com.google.protobuf.v241.DescriptorProtos) is
     // used in the construction of descriptors, we have a tricky bootstrapping
     // problem.  To help control static initialization order, we make sure all
     // descriptors and other static data that depends on them are members of
@@ -180,13 +180,13 @@ void MessageGenerator::GenerateStaticVariables(io::Printer* printer) {
 
     // The descriptor for this type.
     printer->Print(vars,
-      "$private$static com.google.protobuf.Descriptors.Descriptor\n"
+      "$private$static org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.Descriptor\n"
       "  internal_$identifier$_descriptor;\n");
 
     // And the FieldAccessorTable.
     printer->Print(vars,
       "$private$static\n"
-      "  com.google.protobuf.GeneratedMessage.FieldAccessorTable\n"
+      "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.FieldAccessorTable\n"
       "    internal_$identifier$_fieldAccessorTable;\n");
   }
 
@@ -224,7 +224,7 @@ void MessageGenerator::GenerateStaticVariableInitializers(
     // And the FieldAccessorTable.
     printer->Print(vars,
       "internal_$identifier$_fieldAccessorTable = new\n"
-      "  com.google.protobuf.GeneratedMessage.FieldAccessorTable(\n"
+      "  org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.FieldAccessorTable(\n"
       "    internal_$identifier$_descriptor,\n"
       "    new java.lang.String[] { ");
     for (int i = 0; i < descriptor_->field_count(); i++) {
@@ -255,13 +255,13 @@ void MessageGenerator::GenerateInterface(io::Printer* printer) {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public interface $classname$OrBuilder extends\n"
-        "    com.google.protobuf.GeneratedMessage.\n"
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.\n"
         "        ExtendableMessageOrBuilder<$classname$> {\n",
         "classname", descriptor_->name());
     } else {
       printer->Print(
         "public interface $classname$OrBuilder extends \n"
-        "     com.google.protobuf.GeneratedMessageLite.\n"
+        "     org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.\n"
         "          ExtendableMessageOrBuilder<$classname$> {\n",
         "classname", descriptor_->name());
     }
@@ -269,12 +269,12 @@ void MessageGenerator::GenerateInterface(io::Printer* printer) {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public interface $classname$OrBuilder\n"
-        "    extends com.google.protobuf.MessageOrBuilder {\n",
+        "    extends org.apache.pulsar.shaded.com.google.protobuf.v241.MessageOrBuilder {\n",
         "classname", descriptor_->name());
     } else {
       printer->Print(
         "public interface $classname$OrBuilder\n"
-        "    extends com.google.protobuf.MessageLiteOrBuilder {\n",
+        "    extends org.apache.pulsar.shaded.com.google.protobuf.v241.MessageLiteOrBuilder {\n",
         "classname", descriptor_->name());
     }
   }
@@ -302,15 +302,15 @@ void MessageGenerator::Generate(io::Printer* printer) {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public $static$ final class $classname$ extends\n"
-        "    com.google.protobuf.GeneratedMessage.ExtendableMessage<\n"
-        "      $classname$> implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.ExtendableMessage<\n"
+        "      $classname$> implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream.ByteBufGeneratedMessage {\n",
         "static", is_own_file ? "" : "static",
         "classname", descriptor_->name());
     } else {
       printer->Print(
         "public $static$ final class $classname$ extends\n"
-        "    com.google.protobuf.GeneratedMessageLite.ExtendableMessage<\n"
-        "      $classname$> implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.ExtendableMessage<\n"
+        "      $classname$> implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream.ByteBufGeneratedMessage  {\n",
         "static", is_own_file ? "" : "static",
         "classname", descriptor_->name());
     }
@@ -318,25 +318,57 @@ void MessageGenerator::Generate(io::Printer* printer) {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public $static$ final class $classname$ extends\n"
-        "    com.google.protobuf.GeneratedMessage\n"
-        "    implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage\n"
+        "    implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream.ByteBufGeneratedMessage  {\n",
         "static", is_own_file ? "" : "static",
         "classname", descriptor_->name());
     } else {
       printer->Print(
         "public $static$ final class $classname$ extends\n"
-        "    com.google.protobuf.GeneratedMessageLite\n"
-        "    implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite\n"
+        "    implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream.ByteBufGeneratedMessage  {\n",
         "static", is_own_file ? "" : "static",
         "classname", descriptor_->name());
     }
   }
+
+  // Integers for bit fields.
+  int totalBits = 0;
+  for (int i = 0; i < descriptor_->field_count(); i++) {
+    totalBits += field_generators_.get(descriptor_->field(i))
+        .GetNumBitsForMessage();
+  }
+  int totalInts = (totalBits + 31) / 32;
+
   printer->Indent();
   printer->Print(
     "// Use $classname$.newBuilder() to construct.\n"
-    "private $classname$(Builder builder) {\n"
-    "  super(builder);\n"
+    "private io.netty.util.Recycler.Handle handle;\n"
+    "private $classname$(io.netty.util.Recycler.Handle handle) {\n"
+    "  this.handle = handle;\n"
     "}\n"
+    "\n"
+    " private static final io.netty.util.Recycler<$classname$> RECYCLER = new io.netty.util.Recycler<$classname$>() {\n"
+  "        protected $classname$ newObject(Handle handle) {\n"
+  "          return new $classname$(handle);\n"
+  "        }\n"
+  "      };\n"
+  "    \n"
+  "    public void recycle() {\n"
+  "        this.initFields();\n"
+  "        this.memoizedIsInitialized = -1;\n",
+    "classname", descriptor_->name());
+
+    for (int i = 0; i < totalInts; i++) {
+      printer->Print("        this.$bit_field_name$ = 0;\n",
+        "bit_field_name", GetBitFieldName(i));
+    }
+
+    printer->Print(
+  "        this.memoizedSerializedSize = -1;\n"
+  "        if (handle != null) { RECYCLER.recycle(this, handle); }\n"
+  "    }\n"
+   "     \n"
     // Used when constructing the default instance, which cannot be initialized
     // immediately because it may cyclically refer to other default instances.
     "private $classname$(boolean noInit) {}\n"
@@ -365,13 +397,6 @@ void MessageGenerator::Generate(io::Printer* printer) {
     messageGenerator.Generate(printer);
   }
 
-  // Integers for bit fields.
-  int totalBits = 0;
-  for (int i = 0; i < descriptor_->field_count(); i++) {
-    totalBits += field_generators_.get(descriptor_->field(i))
-        .GetNumBitsForMessage();
-  }
-  int totalInts = (totalBits + 31) / 32;
   for (int i = 0; i < totalInts; i++) {
     printer->Print("private int $bit_field_name$;\n",
       "bit_field_name", GetBitFieldName(i));
@@ -450,7 +475,12 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
        ExtensionRangeOrdering());
 
   printer->Print(
-    "public void writeTo(com.google.protobuf.CodedOutputStream output)\n"
+      "public void writeTo(org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream output)\n"
+      "                    throws java.io.IOException {\n"
+          "    throw new RuntimeException(\"Cannot use CodedOutputStream\");\n"
+          "}\n\n"
+
+    "public void writeTo(org.apache.pulsar.common.util.protobuf.ByteBufCodedOutputStream output)\n"
     "                    throws java.io.IOException {\n");
   printer->Indent();
   // writeTo(CodedOutputStream output) might be invoked without
@@ -465,14 +495,14 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
   if (descriptor_->extension_range_count() > 0) {
     if (descriptor_->options().message_set_wire_format()) {
       printer->Print(
-        "com.google.protobuf.GeneratedMessage$lite$\n"
+        "org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage$lite$\n"
         "  .ExtendableMessage<$classname$>.ExtensionWriter extensionWriter =\n"
         "    newMessageSetExtensionWriter();\n",
         "lite", HasDescriptorMethods(descriptor_) ? "" : "Lite",
         "classname", ClassName(descriptor_));
     } else {
       printer->Print(
-        "com.google.protobuf.GeneratedMessage$lite$\n"
+        "org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage$lite$\n"
         "  .ExtendableMessage<$classname$>.ExtensionWriter extensionWriter =\n"
         "    newExtensionWriter();\n",
         "lite", HasDescriptorMethods(descriptor_) ? "" : "Lite",
@@ -565,25 +595,27 @@ GenerateParseFromMethods(io::Printer* printer) {
   //   for code size.
   printer->Print(
     "public static $classname$ parseFrom(\n"
-    "    com.google.protobuf.ByteString data)\n"
-    "    throws com.google.protobuf.InvalidProtocolBufferException {\n"
-    "  return newBuilder().mergeFrom(data).buildParsed();\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString data)\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.InvalidProtocolBufferException {\n"
+    // "  return newBuilder().mergeFrom(data).buildParsed();\n"
+    "     throw new RuntimeException(\"Disabled\");\n"
     "}\n"
     "public static $classname$ parseFrom(\n"
-    "    com.google.protobuf.ByteString data,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
-    "    throws com.google.protobuf.InvalidProtocolBufferException {\n"
-    "  return newBuilder().mergeFrom(data, extensionRegistry)\n"
-    "           .buildParsed();\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString data,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.InvalidProtocolBufferException {\n"
+    // "  return newBuilder().mergeFrom(data, extensionRegistry)\n"
+    // "           .buildParsed();\n"
+    "     throw new RuntimeException(\"Disabled\");\n"
     "}\n"
     "public static $classname$ parseFrom(byte[] data)\n"
-    "    throws com.google.protobuf.InvalidProtocolBufferException {\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.InvalidProtocolBufferException {\n"
     "  return newBuilder().mergeFrom(data).buildParsed();\n"
     "}\n"
     "public static $classname$ parseFrom(\n"
     "    byte[] data,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
-    "    throws com.google.protobuf.InvalidProtocolBufferException {\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.InvalidProtocolBufferException {\n"
     "  return newBuilder().mergeFrom(data, extensionRegistry)\n"
     "           .buildParsed();\n"
     "}\n"
@@ -593,7 +625,7 @@ GenerateParseFromMethods(io::Printer* printer) {
     "}\n"
     "public static $classname$ parseFrom(\n"
     "    java.io.InputStream input,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
     "    throws java.io.IOException {\n"
     "  return newBuilder().mergeFrom(input, extensionRegistry)\n"
     "           .buildParsed();\n"
@@ -609,7 +641,7 @@ GenerateParseFromMethods(io::Printer* printer) {
     "}\n"
     "public static $classname$ parseDelimitedFrom(\n"
     "    java.io.InputStream input,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
     "    throws java.io.IOException {\n"
     "  Builder builder = newBuilder();\n"
     "  if (builder.mergeDelimitedFrom(input, extensionRegistry)) {\n"
@@ -619,13 +651,13 @@ GenerateParseFromMethods(io::Printer* printer) {
     "  }\n"
     "}\n"
     "public static $classname$ parseFrom(\n"
-    "    com.google.protobuf.CodedInputStream input)\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.CodedInputStream input)\n"
     "    throws java.io.IOException {\n"
     "  return newBuilder().mergeFrom(input).buildParsed();\n"
     "}\n"
     "public static $classname$ parseFrom(\n"
-    "    com.google.protobuf.CodedInputStream input,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.CodedInputStream input,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
     "    throws java.io.IOException {\n"
     "  return newBuilder().mergeFrom(input, extensionRegistry)\n"
     "           .buildParsed();\n"
@@ -663,7 +695,7 @@ void MessageGenerator::GenerateBuilder(io::Printer* printer) {
      printer->Print(
       "@java.lang.Override\n"
       "protected Builder newBuilderForType(\n"
-      "    com.google.protobuf.GeneratedMessage.BuilderParent parent) {\n"
+      "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.BuilderParent parent) {\n"
       "  Builder builder = new Builder(parent);\n"
       "  return builder;\n"
       "}\n");
@@ -673,29 +705,29 @@ void MessageGenerator::GenerateBuilder(io::Printer* printer) {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public static final class Builder extends\n"
-        "    com.google.protobuf.GeneratedMessage.ExtendableBuilder<\n"
-        "      $classname$, Builder> implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.ExtendableBuilder<\n"
+        "      $classname$, Builder> implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedInputStream.ByteBufMessageBuilder  {\n",
         "classname", ClassName(descriptor_));
     } else {
       printer->Print(
         "public static final class Builder extends\n"
-        "    com.google.protobuf.GeneratedMessageLite.ExtendableBuilder<\n"
-        "      $classname$, Builder> implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.ExtendableBuilder<\n"
+        "      $classname$, Builder> implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedInputStream.ByteBufMessageBuilder  {\n",
         "classname", ClassName(descriptor_));
     }
   } else {
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
         "public static final class Builder extends\n"
-        "    com.google.protobuf.GeneratedMessage.Builder<Builder>\n"
-         "   implements $classname$OrBuilder {\n",
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.Builder<Builder>\n"
+         "   implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedInputStream.ByteBufMessageBuilder {\n",
         "classname", ClassName(descriptor_));
     } else {
       printer->Print(
         "public static final class Builder extends\n"
-        "    com.google.protobuf.GeneratedMessageLite.Builder<\n"
+        "    org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessageLite.Builder<\n"
         "      $classname$, Builder>\n"
-        "    implements $classname$OrBuilder {\n",
+        "    implements $classname$OrBuilder, org.apache.pulsar.common.util.protobuf.ByteBufCodedInputStream.ByteBufMessageBuilder  {\n",
         "classname", ClassName(descriptor_));
     }
   }
@@ -740,12 +772,12 @@ void MessageGenerator::GenerateBuilder(io::Printer* printer) {
 void MessageGenerator::GenerateDescriptorMethods(io::Printer* printer) {
   if (HasDescriptorMethods(descriptor_)) {
     printer->Print(
-      "public static final com.google.protobuf.Descriptors.Descriptor\n"
+      "public static final org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.Descriptor\n"
       "    getDescriptor() {\n"
       "  return $fileclass$.internal_$identifier$_descriptor;\n"
       "}\n"
       "\n"
-      "protected com.google.protobuf.GeneratedMessage.FieldAccessorTable\n"
+      "protected org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.FieldAccessorTable\n"
       "    internalGetFieldAccessorTable() {\n"
       "  return $fileclass$.internal_$identifier$_fieldAccessorTable;\n"
       "}\n"
@@ -760,9 +792,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"
+    "  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"
+    "         return new Builder(handle);\n"
+    "       }\n"
+    "      };\n"
+    "\n"
+    " public void recycle() {\n"
+    "          clear();\n"
+    "          if (handle != null) {RECYCLER.recycle(this, handle);}\n"
+    "      }\n"
     "\n",
     "classname", ClassName(descriptor_));
 
@@ -779,7 +823,7 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
   if (HasNestedBuilders(descriptor_)) {
     printer->Print(
       "private void maybeForceBuilderInitialization() {\n"
-      "  if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {\n");
+      "  if (org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.alwaysUseFieldBuilders) {\n");
 
     printer->Indent();
     printer->Indent();
@@ -801,7 +845,8 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
 
   printer->Print(
     "private static Builder create() {\n"
-    "  return new Builder();\n"
+    "  return RECYCLER.get();\n"
+        // "  return new Builder(null);\n"
     "}\n"
     "\n"
     "public Builder clear() {\n"
@@ -828,7 +873,7 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
     "classname", ClassName(descriptor_));
   if (HasDescriptorMethods(descriptor_)) {
     printer->Print(
-      "public com.google.protobuf.Descriptors.Descriptor\n"
+      "public org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.Descriptor\n"
       "    getDescriptorForType() {\n"
       "  return $classname$.getDescriptor();\n"
       "}\n"
@@ -854,7 +899,7 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
     "}\n"
     "\n"
     "private $classname$ buildParsed()\n"
-    "    throws com.google.protobuf.InvalidProtocolBufferException {\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.InvalidProtocolBufferException {\n"
     "  $classname$ result = buildPartial();\n"
     "  if (!result.isInitialized()) {\n"
     "    throw newUninitializedMessageException(\n"
@@ -864,7 +909,8 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
     "}\n"
     "\n"
     "public $classname$ buildPartial() {\n"
-    "  $classname$ result = new $classname$(this);\n",
+    "  $classname$ result = $classname$.RECYCLER.get();\n",
+        // "  $classname$ result = new $classname$(null);\n",
     "classname", ClassName(descriptor_));
 
   printer->Indent();
@@ -922,7 +968,7 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
     // messages type by its descriptor.
     if (HasDescriptorMethods(descriptor_)) {
       printer->Print(
-        "public Builder mergeFrom(com.google.protobuf.Message other) {\n"
+        "public Builder mergeFrom(org.apache.pulsar.shaded.com.google.protobuf.v241.Message other) {\n"
         "  if (other instanceof $classname$) {\n"
         "    return mergeFrom(($classname$)other);\n"
         "  } else {\n"
@@ -973,16 +1019,21 @@ void MessageGenerator::GenerateBuilderParsingMethods(io::Printer* printer) {
     SortFieldsByNumber(descriptor_));
 
   printer->Print(
+    "public Builder mergeFrom(org.apache.pulsar.shaded.com.google.protobuf.v241.CodedInputStream input,\n"
+    "                        org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
+    "                        throws java.io.IOException {\n"
+    "   throw new java.io.IOException(\"Merge from CodedInputStream is disabled\");\n"
+    "                        }\n"
     "public Builder mergeFrom(\n"
-    "    com.google.protobuf.CodedInputStream input,\n"
-    "    com.google.protobuf.ExtensionRegistryLite extensionRegistry)\n"
+    "    org.apache.pulsar.common.util.protobuf.ByteBufCodedInputStream input,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ExtensionRegistryLite extensionRegistry)\n"
     "    throws java.io.IOException {\n");
   printer->Indent();
 
   if (HasUnknownFields(descriptor_)) {
     printer->Print(
-      "com.google.protobuf.UnknownFieldSet.Builder unknownFields =\n"
-      "  com.google.protobuf.UnknownFieldSet.newBuilder(\n"
+      "org.apache.pulsar.shaded.com.google.protobuf.v241.UnknownFieldSet.Builder unknownFields =\n"
+      "  org.apache.pulsar.shaded.com.google.protobuf.v241.UnknownFieldSet.newBuilder(\n"
       "    this.getUnknownFields());\n");
   }
 
@@ -1017,7 +1068,7 @@ void MessageGenerator::GenerateBuilderParsingMethods(io::Printer* printer) {
       "  $on_changed$\n"
       "  return this;\n"
       "default: {\n"
-      "  if (!parseUnknownField(input, extensionRegistry, tag)) {\n"
+      "  if (!input.skipField(tag)) {\n"
       "    $on_changed$\n"
       "    return this;\n"   // it's an endgroup tag
       "  }\n"
diff --git a/src/google/protobuf/compiler/java/java_message_field.cc b/src/google/protobuf/compiler/java/java_message_field.cc
index 251945af..e19cfa58 100644
--- a/src/google/protobuf/compiler/java/java_message_field.cc
+++ b/src/google/protobuf/compiler/java/java_message_field.cc
@@ -199,7 +199,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
     printer->Print(variables_,
       // If this builder is non-null, it is used and the other fields are
       // ignored.
-      "private com.google.protobuf.SingleFieldBuilder<\n"
+      "private org.apache.pulsar.shaded.com.google.protobuf.v241.SingleFieldBuilder<\n"
       "    $type$, $type$.Builder, $type$OrBuilder> $name$Builder_;"
       "\n");
   }
@@ -295,11 +295,11 @@ GenerateBuilderMembers(io::Printer* printer) const {
       "    return $name$_;\n"
       "  }\n"
       "}\n"
-      "private com.google.protobuf.SingleFieldBuilder<\n"
+      "private org.apache.pulsar.shaded.com.google.protobuf.v241.SingleFieldBuilder<\n"
       "    $type$, $type$.Builder, $type$OrBuilder> \n"
       "    get$capitalized_name$FieldBuilder() {\n"
       "  if ($name$Builder_ == null) {\n"
-      "    $name$Builder_ = new com.google.protobuf.SingleFieldBuilder<\n"
+      "    $name$Builder_ = new org.apache.pulsar.shaded.com.google.protobuf.v241.SingleFieldBuilder<\n"
       "        $type$, $type$.Builder, $type$OrBuilder>(\n"
       "            $name$_,\n"
       "            getParentForChildren(),\n"
@@ -371,7 +371,8 @@ GenerateParsingCode(io::Printer* printer) const {
   }
 
   printer->Print(variables_,
-    "set$capitalized_name$(subBuilder.buildPartial());\n");
+    "set$capitalized_name$(subBuilder.buildPartial());\n"
+    "subBuilder.recycle();\n");
 }
 
 void MessageFieldGenerator::
@@ -386,7 +387,7 @@ void MessageFieldGenerator::
 GenerateSerializedSizeCode(io::Printer* printer) const {
   printer->Print(variables_,
     "if ($get_has_field_bit_message$) {\n"
-    "  size += com.google.protobuf.CodedOutputStream\n"
+    "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .compute$group_or_message$Size($number$, $name$_);\n"
     "}\n");
 }
@@ -543,7 +544,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
     printer->Print(variables_,
       // If this builder is non-null, it is used and the other fields are
       // ignored.
-      "private com.google.protobuf.RepeatedFieldBuilder<\n"
+      "private org.apache.pulsar.shaded.com.google.protobuf.v241.RepeatedFieldBuilder<\n"
       "    $type$, $type$.Builder, $type$OrBuilder> $name$Builder_;\n"
       "\n");
   }
@@ -738,11 +739,11 @@ GenerateBuilderMembers(io::Printer* printer) const {
       "     get$capitalized_name$BuilderList() {\n"
       "  return get$capitalized_name$FieldBuilder().getBuilderList();\n"
       "}\n"
-      "private com.google.protobuf.RepeatedFieldBuilder<\n"
+      "private org.apache.pulsar.shaded.com.google.protobuf.v241.RepeatedFieldBuilder<\n"
       "    $type$, $type$.Builder, $type$OrBuilder> \n"
       "    get$capitalized_name$FieldBuilder() {\n"
       "  if ($name$Builder_ == null) {\n"
-      "    $name$Builder_ = new com.google.protobuf.RepeatedFieldBuilder<\n"
+      "    $name$Builder_ = new org.apache.pulsar.shaded.com.google.protobuf.v241.RepeatedFieldBuilder<\n"
       "        $type$, $type$.Builder, $type$OrBuilder>(\n"
       "            $name$_,\n"
       "            $get_mutable_bit_builder$,\n"
@@ -801,7 +802,7 @@ GenerateMergingCode(io::Printer* printer) const {
     "    $name$_ = other.$name$_;\n"
     "    $clear_mutable_bit_builder$;\n"
     "    $name$Builder_ = \n"
-    "      com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?\n"
+    "      org.apache.pulsar.shaded.com.google.protobuf.v241.GeneratedMessage.alwaysUseFieldBuilders ?\n"
     "         get$capitalized_name$FieldBuilder() : null;\n"
     "  } else {\n"
     "    $name$Builder_.addAllMessages(other.$name$_);\n"
@@ -853,7 +854,7 @@ void RepeatedMessageFieldGenerator::
 GenerateSerializedSizeCode(io::Printer* printer) const {
   printer->Print(variables_,
     "for (int i = 0; i < $name$_.size(); i++) {\n"
-    "  size += com.google.protobuf.CodedOutputStream\n"
+    "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .compute$group_or_message$Size($number$, $name$_.get(i));\n"
     "}\n");
 }
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.cc b/src/google/protobuf/compiler/java/java_primitive_field.cc
index addb8819..3d72a15d 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field.cc
@@ -60,7 +60,7 @@ const char* PrimitiveTypeName(JavaType type) {
     case JAVATYPE_DOUBLE : return "double";
     case JAVATYPE_BOOLEAN: return "boolean";
     case JAVATYPE_STRING : return "java.lang.String";
-    case JAVATYPE_BYTES  : return "com.google.protobuf.ByteString";
+    case JAVATYPE_BYTES  : return "org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString";
     case JAVATYPE_ENUM   : return NULL;
     case JAVATYPE_MESSAGE: return NULL;
 
@@ -351,7 +351,7 @@ void PrimitiveFieldGenerator::
 GenerateSerializedSizeCode(io::Printer* printer) const {
   printer->Print(variables_,
     "if ($get_has_field_bit_message$) {\n"
-    "  size += com.google.protobuf.CodedOutputStream\n"
+    "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .compute$capitalized_type$Size($number$, $name$_);\n"
     "}\n");
 }
@@ -660,7 +660,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
   if (FixedSize(GetType(descriptor_)) == -1) {
     printer->Print(variables_,
       "for (int i = 0; i < $name$_.size(); i++) {\n"
-      "  dataSize += com.google.protobuf.CodedOutputStream\n"
+      "  dataSize += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
       "    .compute$capitalized_type$SizeNoTag($name$_.get(i));\n"
       "}\n");
   } else {
@@ -675,7 +675,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
     printer->Print(variables_,
       "if (!get$capitalized_name$List().isEmpty()) {\n"
       "  size += $tag_size$;\n"
-      "  size += com.google.protobuf.CodedOutputStream\n"
+      "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
       "      .computeInt32SizeNoTag(dataSize);\n"
       "}\n");
   } else {
diff --git a/src/google/protobuf/compiler/java/java_service.cc b/src/google/protobuf/compiler/java/java_service.cc
index 1ae4f461..831aec03 100644
--- a/src/google/protobuf/compiler/java/java_service.cc
+++ b/src/google/protobuf/compiler/java/java_service.cc
@@ -52,7 +52,7 @@ void ServiceGenerator::Generate(io::Printer* printer) {
   bool is_own_file = descriptor_->file()->options().java_multiple_files();
   printer->Print(
     "public $static$ abstract class $classname$\n"
-    "    implements com.google.protobuf.Service {\n",
+    "    implements org.apache.pulsar.shaded.com.google.protobuf.v241.Service {\n",
     "static", is_own_file ? "" : "static",
     "classname", descriptor_->name());
   printer->Indent();
@@ -71,7 +71,7 @@ void ServiceGenerator::Generate(io::Printer* printer) {
   // Generate getDescriptor() and getDescriptorForType().
   printer->Print(
     "public static final\n"
-    "    com.google.protobuf.Descriptors.ServiceDescriptor\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.ServiceDescriptor\n"
     "    getDescriptor() {\n"
     "  return $file$.getDescriptor().getServices().get($index$);\n"
     "}\n",
@@ -92,7 +92,7 @@ void ServiceGenerator::Generate(io::Printer* printer) {
 
 void ServiceGenerator::GenerateGetDescriptorForType(io::Printer* printer) {
   printer->Print(
-    "public final com.google.protobuf.Descriptors.ServiceDescriptor\n"
+    "public final org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.ServiceDescriptor\n"
     "    getDescriptorForType() {\n"
     "  return getDescriptor();\n"
     "}\n");
@@ -109,7 +109,7 @@ void ServiceGenerator::GenerateInterface(io::Printer* printer) {
 void ServiceGenerator::GenerateNewReflectiveServiceMethod(
     io::Printer* printer) {
   printer->Print(
-    "public static com.google.protobuf.Service newReflectiveService(\n"
+    "public static org.apache.pulsar.shaded.com.google.protobuf.v241.Service newReflectiveService(\n"
     "    final Interface impl) {\n"
     "  return new $classname$() {\n",
     "classname", descriptor_->name());
@@ -136,9 +136,9 @@ void ServiceGenerator::GenerateNewReflectiveServiceMethod(
 void ServiceGenerator::GenerateNewReflectiveBlockingServiceMethod(
     io::Printer* printer) {
   printer->Print(
-    "public static com.google.protobuf.BlockingService\n"
+    "public static org.apache.pulsar.shaded.com.google.protobuf.v241.BlockingService\n"
     "    newReflectiveBlockingService(final BlockingInterface impl) {\n"
-    "  return new com.google.protobuf.BlockingService() {\n");
+    "  return new org.apache.pulsar.shaded.com.google.protobuf.v241.BlockingService() {\n");
   printer->Indent();
   printer->Indent();
 
@@ -166,11 +166,11 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) {
   printer->Print(
     "\n"
     "public final void callMethod(\n"
-    "    com.google.protobuf.Descriptors.MethodDescriptor method,\n"
-    "    com.google.protobuf.RpcController controller,\n"
-    "    com.google.protobuf.Message request,\n"
-    "    com.google.protobuf.RpcCallback<\n"
-    "      com.google.protobuf.Message> done) {\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.MethodDescriptor method,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcController controller,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Message request,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcCallback<\n"
+    "      org.apache.pulsar.shaded.com.google.protobuf.v241.Message> done) {\n"
     "  if (method.getService() != getDescriptor()) {\n"
     "    throw new java.lang.IllegalArgumentException(\n"
     "      \"Service.callMethod() given method descriptor for wrong \" +\n"
@@ -190,7 +190,7 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) {
     printer->Print(vars,
       "case $index$:\n"
       "  this.$method$(controller, ($input$)request,\n"
-      "    com.google.protobuf.RpcUtil.<$output$>specializeCallback(\n"
+      "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcUtil.<$output$>specializeCallback(\n"
       "      done));\n"
       "  return;\n");
   }
@@ -211,11 +211,11 @@ void ServiceGenerator::GenerateCallMethod(io::Printer* printer) {
 void ServiceGenerator::GenerateCallBlockingMethod(io::Printer* printer) {
   printer->Print(
     "\n"
-    "public final com.google.protobuf.Message callBlockingMethod(\n"
-    "    com.google.protobuf.Descriptors.MethodDescriptor method,\n"
-    "    com.google.protobuf.RpcController controller,\n"
-    "    com.google.protobuf.Message request)\n"
-    "    throws com.google.protobuf.ServiceException {\n"
+    "public final org.apache.pulsar.shaded.com.google.protobuf.v241.Message callBlockingMethod(\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.MethodDescriptor method,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcController controller,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Message request)\n"
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.ServiceException {\n"
     "  if (method.getService() != getDescriptor()) {\n"
     "    throw new java.lang.IllegalArgumentException(\n"
     "      \"Service.callBlockingMethod() given method descriptor for \" +\n"
@@ -257,9 +257,9 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which,
    * "BlockingService.foo."  Consider fixing.
    */
   printer->Print(
-    "public final com.google.protobuf.Message\n"
+    "public final org.apache.pulsar.shaded.com.google.protobuf.v241.Message\n"
     "    get$request_or_response$Prototype(\n"
-    "    com.google.protobuf.Descriptors.MethodDescriptor method) {\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.Descriptors.MethodDescriptor method) {\n"
     "  if (method.getService() != getDescriptor()) {\n"
     "    throw new java.lang.IllegalArgumentException(\n"
     "      \"Service.get$request_or_response$Prototype() given method \" +\n"
@@ -297,7 +297,7 @@ void ServiceGenerator::GenerateGetPrototype(RequestOrResponse which,
 void ServiceGenerator::GenerateStub(io::Printer* printer) {
   printer->Print(
     "public static Stub newStub(\n"
-    "    com.google.protobuf.RpcChannel channel) {\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcChannel channel) {\n"
     "  return new Stub(channel);\n"
     "}\n"
     "\n"
@@ -307,13 +307,13 @@ void ServiceGenerator::GenerateStub(io::Printer* printer) {
   printer->Indent();
 
   printer->Print(
-    "private Stub(com.google.protobuf.RpcChannel channel) {\n"
+    "private Stub(org.apache.pulsar.shaded.com.google.protobuf.v241.RpcChannel channel) {\n"
     "  this.channel = channel;\n"
     "}\n"
     "\n"
-    "private final com.google.protobuf.RpcChannel channel;\n"
+    "private final org.apache.pulsar.shaded.com.google.protobuf.v241.RpcChannel channel;\n"
     "\n"
-    "public com.google.protobuf.RpcChannel getChannel() {\n"
+    "public org.apache.pulsar.shaded.com.google.protobuf.v241.RpcChannel getChannel() {\n"
     "  return channel;\n"
     "}\n");
 
@@ -333,7 +333,7 @@ void ServiceGenerator::GenerateStub(io::Printer* printer) {
       "  controller,\n"
       "  request,\n"
       "  $output$.getDefaultInstance(),\n"
-      "  com.google.protobuf.RpcUtil.generalizeCallback(\n"
+      "  org.apache.pulsar.shaded.com.google.protobuf.v241.RpcUtil.generalizeCallback(\n"
       "    done,\n"
       "    $output$.class,\n"
       "    $output$.getDefaultInstance()));\n");
@@ -351,7 +351,7 @@ void ServiceGenerator::GenerateStub(io::Printer* printer) {
 void ServiceGenerator::GenerateBlockingStub(io::Printer* printer) {
   printer->Print(
     "public static BlockingInterface newBlockingStub(\n"
-    "    com.google.protobuf.BlockingRpcChannel channel) {\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.BlockingRpcChannel channel) {\n"
     "  return new BlockingStub(channel);\n"
     "}\n"
     "\n");
@@ -376,11 +376,11 @@ void ServiceGenerator::GenerateBlockingStub(io::Printer* printer) {
   printer->Indent();
 
   printer->Print(
-    "private BlockingStub(com.google.protobuf.BlockingRpcChannel channel) {\n"
+    "private BlockingStub(org.apache.pulsar.shaded.com.google.protobuf.v241.BlockingRpcChannel channel) {\n"
     "  this.channel = channel;\n"
     "}\n"
     "\n"
-    "private final com.google.protobuf.BlockingRpcChannel channel;\n");
+    "private final org.apache.pulsar.shaded.com.google.protobuf.v241.BlockingRpcChannel channel;\n");
 
   for (int i = 0; i < descriptor_->method_count(); i++) {
     const MethodDescriptor* method = descriptor_->method(i);
@@ -418,9 +418,9 @@ void ServiceGenerator::GenerateMethodSignature(io::Printer* printer,
   vars["abstract"] = (is_abstract == IS_ABSTRACT) ? "abstract" : "";
   printer->Print(vars,
     "public $abstract$ void $name$(\n"
-    "    com.google.protobuf.RpcController controller,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcController controller,\n"
     "    $input$ request,\n"
-    "    com.google.protobuf.RpcCallback<$output$> done)");
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcCallback<$output$> done)");
 }
 
 void ServiceGenerator::GenerateBlockingMethodSignature(
@@ -433,9 +433,9 @@ void ServiceGenerator::GenerateBlockingMethodSignature(
   printer->Print(vars,
     "\n"
     "public $output$ $method$(\n"
-    "    com.google.protobuf.RpcController controller,\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.RpcController controller,\n"
     "    $input$ request)\n"
-    "    throws com.google.protobuf.ServiceException");
+    "    throws org.apache.pulsar.shaded.com.google.protobuf.v241.ServiceException");
 }
 
 }  // namespace java
diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc
index 4f1fb14c..f52a1120 100644
--- a/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/src/google/protobuf/compiler/java/java_string_field.cc
@@ -63,7 +63,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
     UnderscoresToCapitalizedCamelCase(descriptor);
   (*variables)["constant_name"] = FieldConstantName(descriptor);
   (*variables)["number"] = SimpleItoa(descriptor->number());
-  (*variables)["empty_list"] = "com.google.protobuf.LazyStringArrayList.EMPTY";
+  (*variables)["empty_list"] = "org.apache.pulsar.shaded.com.google.protobuf.v241.LazyStringArrayList.EMPTY";
 
   (*variables)["default"] = DefaultValue(descriptor);
   (*variables)["default_init"] = ("= " + DefaultValue(descriptor));
@@ -179,24 +179,24 @@ GenerateMembers(io::Printer* printer) const {
     "  if (ref instanceof String) {\n"
     "    return (String) ref;\n"
     "  } else {\n"
-    "    com.google.protobuf.ByteString bs = \n"
-    "        (com.google.protobuf.ByteString) ref;\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString bs = \n"
+    "        (org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString) ref;\n"
     "    String s = bs.toStringUtf8();\n"
-    "    if (com.google.protobuf.Internal.isValidUtf8(bs)) {\n"
+    "    if (org.apache.pulsar.shaded.com.google.protobuf.v241.Internal.isValidUtf8(bs)) {\n"
     "      $name$_ = s;\n"
     "    }\n"
     "    return s;\n"
     "  }\n"
     "}\n"
-    "private com.google.protobuf.ByteString get$capitalized_name$Bytes() {\n"
+    "private org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString get$capitalized_name$Bytes() {\n"
     "  java.lang.Object ref = $name$_;\n"
     "  if (ref instanceof String) {\n"
-    "    com.google.protobuf.ByteString b = \n"
-    "        com.google.protobuf.ByteString.copyFromUtf8((String) ref);\n"
+    "    org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString b = \n"
+    "        org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString.copyFromUtf8((String) ref);\n"
     "    $name$_ = b;\n"
     "    return b;\n"
     "  } else {\n"
-    "    return (com.google.protobuf.ByteString) ref;\n"
+    "    return (org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString) ref;\n"
     "  }\n"
     "}\n");
 }
@@ -213,7 +213,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
     "$deprecation$public String get$capitalized_name$() {\n"
     "  java.lang.Object ref = $name$_;\n"
     "  if (!(ref instanceof String)) {\n"
-    "    String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();\n"
+    "    String s = ((org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString) ref).toStringUtf8();\n"
     "    $name$_ = s;\n"
     "    return s;\n"
     "  } else {\n"
@@ -241,7 +241,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
     "}\n");
 
   printer->Print(variables_,
-    "void set$capitalized_name$(com.google.protobuf.ByteString value) {\n"
+    "void set$capitalized_name$(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {\n"
     "  $set_has_field_bit_builder$;\n"
     "  $name$_ = value;\n"
     "  $on_changed$\n"
@@ -301,7 +301,7 @@ void StringFieldGenerator::
 GenerateSerializedSizeCode(io::Printer* printer) const {
   printer->Print(variables_,
     "if ($get_has_field_bit_message$) {\n"
-    "  size += com.google.protobuf.CodedOutputStream\n"
+    "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .computeBytesSize($number$, get$capitalized_name$Bytes());\n"
     "}\n");
 }
@@ -360,7 +360,7 @@ GenerateInterfaceMembers(io::Printer* printer) const {
 void RepeatedStringFieldGenerator::
 GenerateMembers(io::Printer* printer) const {
   printer->Print(variables_,
-    "private com.google.protobuf.LazyStringList $name$_;\n"
+    "private org.apache.pulsar.shaded.com.google.protobuf.v241.LazyStringList $name$_;\n"
     "$deprecation$public java.util.List<String>\n"
     "    get$capitalized_name$List() {\n"
     "  return $name$_;\n"   // note:  unmodifiable list
@@ -391,12 +391,12 @@ GenerateBuilderMembers(io::Printer* printer) const {
   // just that the list cannot be modified via the reference but that the
   // list can never be modified.
   printer->Print(variables_,
-    "private com.google.protobuf.LazyStringList $name$_ = $empty_list$;\n");
+    "private org.apache.pulsar.shaded.com.google.protobuf.v241.LazyStringList $name$_ = $empty_list$;\n");
 
   printer->Print(variables_,
     "private void ensure$capitalized_name$IsMutable() {\n"
     "  if (!$get_mutable_bit_builder$) {\n"
-    "    $name$_ = new com.google.protobuf.LazyStringArrayList($name$_);\n"
+    "    $name$_ = new org.apache.pulsar.shaded.com.google.protobuf.v241.LazyStringArrayList($name$_);\n"
     "    $set_mutable_bit_builder$;\n"
     "   }\n"
     "}\n");
@@ -446,7 +446,7 @@ GenerateBuilderMembers(io::Printer* printer) const {
     "}\n");
 
   printer->Print(variables_,
-    "void add$capitalized_name$(com.google.protobuf.ByteString value) {\n"
+    "void add$capitalized_name$(org.apache.pulsar.shaded.com.google.protobuf.v241.ByteString value) {\n"
     "  ensure$capitalized_name$IsMutable();\n"
     "  $name$_.add(value);\n"
     "  $on_changed$\n"
@@ -497,7 +497,7 @@ GenerateBuildingCode(io::Printer* printer) const {
 
   printer->Print(variables_,
     "if ($get_mutable_bit_builder$) {\n"
-    "  $name$_ = new com.google.protobuf.UnmodifiableLazyStringList(\n"
+    "  $name$_ = new org.apache.pulsar.shaded.com.google.protobuf.v241.UnmodifiableLazyStringList(\n"
     "      $name$_);\n"
     "  $clear_mutable_bit_builder$;\n"
     "}\n"
@@ -550,7 +550,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
 
   printer->Print(variables_,
     "for (int i = 0; i < $name$_.size(); i++) {\n"
-    "  dataSize += com.google.protobuf.CodedOutputStream\n"
+    "  dataSize += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
     "    .computeBytesSizeNoTag($name$_.getByteString(i));\n"
     "}\n");
 
@@ -561,7 +561,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const {
     printer->Print(variables_,
       "if (!get$capitalized_name$List().isEmpty()) {\n"
       "  size += $tag_size$;\n"
-      "  size += com.google.protobuf.CodedOutputStream\n"
+      "  size += org.apache.pulsar.shaded.com.google.protobuf.v241.CodedOutputStream\n"
       "      .computeInt32SizeNoTag(dataSize);\n"
       "}\n");
   } else {
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index 91e6878e..cfee3832 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -32,6 +32,7 @@
 //  Based on original Protocol Buffers design by
 //  Sanjay Ghemawat, Jeff Dean, and others.
 
+#include <iostream>
 #include <stack>
 #include <google/protobuf/stubs/hash.h>
 
