You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/19 11:29:45 UTC

[dubbo] branch 3.0.2.1-release created (now c8c30d1)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a change to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git.


      at c8c30d1  update 3.0.2.1 release

This branch includes the following new commits:

     new 598ffd0  Fix nacos group inviable in consumer side (#8533)
     new a1b6658  fix NPE on serialization checking when request timed out (#8547)
     new 2b4d457  Compact with dubbo-all without farbic-io (#8546)
     new c8c30d1  update 3.0.2.1 release

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[dubbo] 03/04: Compact with dubbo-all without farbic-io (#8546)

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit 2b4d4570dcdb8a57acd1e49e81e57b53157281e1
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Aug 19 19:00:55 2021 +0800

    Compact with dubbo-all without farbic-io (#8546)
---
 .../cluster/router/mesh/route/MeshEnvListener.java |  3 --
 ...nvListener.java => MeshEnvListenerFactory.java} | 18 ++--------
 .../cluster/router/mesh/route/MeshRuleManager.java |  5 ++-
 dubbo-distribution/dubbo-all/pom.xml               |  6 ++++
 .../KubernetesMeshEnvListenerFactory.java          | 42 ++++++++++++++++++++++
 ...uster.router.mesh.route.MeshEnvListenerFactory} |  2 +-
 6 files changed, 55 insertions(+), 21 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java
index 4b92457..6d98534 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java
@@ -17,13 +17,10 @@
 
 package org.apache.dubbo.rpc.cluster.router.mesh.route;
 
-import org.apache.dubbo.common.extension.SPI;
-
 /**
  * Mesh Rule Listener
  * Such as Kubernetes, Service Mesh (xDS) environment support define rule in env
  */
-@SPI
 public interface MeshEnvListener {
     /**
      * @return whether current environment support listen
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListenerFactory.java
similarity index 69%
copy from dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java
copy to dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListenerFactory.java
index 4b92457..5299506 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListener.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshEnvListenerFactory.java
@@ -14,25 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.dubbo.rpc.cluster.router.mesh.route;
 
 import org.apache.dubbo.common.extension.SPI;
 
-/**
- * Mesh Rule Listener
- * Such as Kubernetes, Service Mesh (xDS) environment support define rule in env
- */
 @SPI
-public interface MeshEnvListener {
-    /**
-     * @return whether current environment support listen
-     */
-    default boolean isEnable() {
-        return false;
-    }
-
-    void onSubscribe(String appName, MeshAppRuleListener listener);
-
-    void onUnSubscribe(String appName);
+public interface MeshEnvListenerFactory {
+    MeshEnvListener getListener();
 }
diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
index 87fdede..b07fede 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mesh/route/MeshRuleManager.java
@@ -24,8 +24,10 @@ import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.rpc.model.ApplicationModel;
 
 import java.util.Collection;
+import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.stream.Collectors;
 
 
 public final class MeshRuleManager {
@@ -43,7 +45,8 @@ public final class MeshRuleManager {
         DynamicConfiguration configuration = ApplicationModel.getEnvironment().getDynamicConfiguration()
             .orElse(null);
 
-        Set<MeshEnvListener> envListeners = ExtensionLoader.getExtensionLoader(MeshEnvListener.class).getSupportedExtensionInstances();
+        Set<MeshEnvListenerFactory> envListenerFactories = ExtensionLoader.getExtensionLoader(MeshEnvListenerFactory.class).getSupportedExtensionInstances();
+        Set<MeshEnvListener> envListeners = envListenerFactories.stream().map(MeshEnvListenerFactory::getListener).filter(Objects::nonNull).collect(Collectors.toSet());
 
         if (configuration == null && envListeners.stream().noneMatch(MeshEnvListener::isEnable)) {
             logger.warn("Doesn't support Configuration!");
diff --git a/dubbo-distribution/dubbo-all/pom.xml b/dubbo-distribution/dubbo-all/pom.xml
index be8d15d..1152748 100644
--- a/dubbo-distribution/dubbo-all/pom.xml
+++ b/dubbo-distribution/dubbo-all/pom.xml
@@ -777,6 +777,12 @@
                                         META-INF/dubbo/internal/org.apache.dubbo.common.url.component.param.DynamicParamSource
                                     </resource>
                                 </transformer>
+                                <transformer
+                                    implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                                    <resource>
+                                        META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListenerFactory
+                                    </resource>
+                                </transformer>
                             </transformers>
                             <filters>
                                 <filter>
diff --git a/dubbo-registry/dubbo-registry-kubernetes/src/main/java/org/apache/dubbo/registry/kubernetes/KubernetesMeshEnvListenerFactory.java b/dubbo-registry/dubbo-registry-kubernetes/src/main/java/org/apache/dubbo/registry/kubernetes/KubernetesMeshEnvListenerFactory.java
new file mode 100644
index 0000000..67b1b4c
--- /dev/null
+++ b/dubbo-registry/dubbo-registry-kubernetes/src/main/java/org/apache/dubbo/registry/kubernetes/KubernetesMeshEnvListenerFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.dubbo.registry.kubernetes;
+
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
+import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListener;
+import org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListenerFactory;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class KubernetesMeshEnvListenerFactory implements MeshEnvListenerFactory {
+    public static final Logger logger = LoggerFactory.getLogger(KubernetesMeshEnvListenerFactory.class);
+    private final AtomicBoolean initialized = new AtomicBoolean(false);
+    private MeshEnvListener listener = null;
+
+    @Override
+    public MeshEnvListener getListener() {
+        try {
+            if (initialized.compareAndSet(false, true)) {
+                listener = new KubernetesMeshEnvListener();
+            }
+        } catch (Throwable t) {
+            logger.info("Current Env not support Kubernetes.");
+        }
+        return listener;
+    }
+}
diff --git a/dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListener b/dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListenerFactory
similarity index 79%
rename from dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListener
rename to dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListenerFactory
index b44c869..4dfae84 100644
--- a/dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListener
+++ b/dubbo-registry/dubbo-registry-kubernetes/src/main/resources/META-INF/dubbo/internal/org.apache.dubbo.rpc.cluster.router.mesh.route.MeshEnvListenerFactory
@@ -1 +1 @@
-kubernetes=org.apache.dubbo.registry.kubernetes.KubernetesMeshEnvListener
+kubernetes=org.apache.dubbo.registry.kubernetes.KubernetesMeshEnvListenerFactory

[dubbo] 04/04: update 3.0.2.1 release

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit c8c30d13f99c5270278b8fdeb8c04af4e08bc7b0
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Aug 19 19:29:06 2021 +0800

    update 3.0.2.1 release
---
 dubbo-dependencies-bom/pom.xml                          | 2 +-
 dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml | 2 +-
 pom.xml                                                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml
index 9976a21..0aeeb87 100644
--- a/dubbo-dependencies-bom/pom.xml
+++ b/dubbo-dependencies-bom/pom.xml
@@ -169,7 +169,7 @@
         <mortbay_jetty_version>6.1.26</mortbay_jetty_version>
         <portlet_version>2.0</portlet_version>
         <maven_flatten_version>1.1.0</maven_flatten_version>
-        <revision>3.0.2-SNAPSHOT</revision>
+        <revision>3.0.2.1</revision>
     </properties>
 
     <dependencyManagement>
diff --git a/dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml b/dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml
index 38fcec7..76eb143 100644
--- a/dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml
+++ b/dubbo-dependencies/dubbo-dependencies-zookeeper/pom.xml
@@ -32,7 +32,7 @@
     <packaging>pom</packaging>
 
     <properties>
-        <revision>3.0.2-SNAPSHOT</revision>
+        <revision>3.0.2.1</revision>
         <maven_flatten_version>1.1.0</maven_flatten_version>
     </properties>
 
diff --git a/pom.xml b/pom.xml
index a0ed38e..e5f0227 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@
         <checkstyle_unix.skip>true</checkstyle_unix.skip>
         <rat.skip>true</rat.skip>
         <jacoco.skip>true</jacoco.skip>
-        <revision>3.0.2-SNAPSHOT</revision>
+        <revision>3.0.2.1</revision>
     </properties>
 
     <modules>

[dubbo] 01/04: Fix nacos group inviable in consumer side (#8533)

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit 598ffd04769fa2893ae1a7ccc1900b6c300bda0f
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Aug 19 17:40:25 2021 +0800

    Fix nacos group inviable in consumer side (#8533)
    
    * Fix nacos group inviable in consumer side
    
    * remove getGroup method
---
 .../registry/nacos/NacosNamingServiceWrapper.java  |  4 ++++
 .../registry/nacos/NacosServiceDiscovery.java      | 24 ++++++++++++++--------
 .../nacos/util/NacosNamingServiceUtils.java        | 15 --------------
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosNamingServiceWrapper.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosNamingServiceWrapper.java
index 536d9dc0..c2f817a 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosNamingServiceWrapper.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosNamingServiceWrapper.java
@@ -74,6 +74,10 @@ public class NacosNamingServiceWrapper {
         return namingService.selectInstances(handleInnerSymbol(serviceName), healthy);
     }
 
+    public List<Instance> selectInstances(String serviceName, String group, boolean healthy) throws NacosException {
+        return namingService.selectInstances(handleInnerSymbol(serviceName), group, healthy);
+    }
+
     public void shutdown() throws NacosException {
         this.namingService.shutDown();
     }
diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
index fecb8ef..67f4c89 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceDiscovery.java
@@ -27,6 +27,7 @@ import org.apache.dubbo.registry.client.event.ServiceInstancesChangedEvent;
 import org.apache.dubbo.registry.client.event.listener.ServiceInstancesChangedListener;
 import org.apache.dubbo.registry.nacos.util.NacosNamingServiceUtils;
 
+import com.alibaba.nacos.api.common.Constants;
 import com.alibaba.nacos.api.exception.NacosException;
 import com.alibaba.nacos.api.naming.listener.NamingEvent;
 import com.alibaba.nacos.api.naming.pojo.Instance;
@@ -39,7 +40,6 @@ import java.util.stream.Collectors;
 
 import static org.apache.dubbo.common.function.ThrowableConsumer.execute;
 import static org.apache.dubbo.registry.nacos.util.NacosNamingServiceUtils.createNamingService;
-import static org.apache.dubbo.registry.nacos.util.NacosNamingServiceUtils.getGroup;
 import static org.apache.dubbo.registry.nacos.util.NacosNamingServiceUtils.toInstance;
 
 /**
@@ -52,8 +52,6 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
 
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
-    private String group;
-
     private NacosNamingServiceWrapper namingService;
 
     private URL registryURL;
@@ -61,7 +59,6 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
     @Override
     public void doInitialize(URL registryURL) throws Exception {
         this.namingService = createNamingService(registryURL);
-        this.group = getGroup(registryURL);
         this.registryURL = registryURL;
     }
 
@@ -74,7 +71,10 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
     public void doRegister(ServiceInstance serviceInstance) {
         execute(namingService, service -> {
             Instance instance = toInstance(serviceInstance);
-            service.registerInstance(instance.getServiceName(), group, instance);
+            // Should not register real group for ServiceInstance
+            // Or will cause consumer unable to fetch all of the providers from every group
+            // Provider's group is invisible for consumer
+            service.registerInstance(instance.getServiceName(), Constants.DEFAULT_GROUP, instance);
         });
     }
 
@@ -89,14 +89,20 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
     public void doUnregister(ServiceInstance serviceInstance) throws RuntimeException {
         execute(namingService, service -> {
             Instance instance = toInstance(serviceInstance);
-            service.deregisterInstance(instance.getServiceName(), group, instance);
+            // Should not register real group for ServiceInstance
+            // Or will cause consumer unable to fetch all of the providers from every group
+            // Provider's group is invisible for consumer
+            service.deregisterInstance(instance.getServiceName(), Constants.DEFAULT_GROUP, instance);
         });
     }
 
     @Override
     public Set<String> getServices() {
         return ThrowableFunction.execute(namingService, service -> {
-            ListView<String> view = service.getServicesOfServer(0, Integer.MAX_VALUE, group);
+            // Should not register real group for ServiceInstance
+            // Or will cause consumer unable to fetch all of the providers from every group
+            // Provider's group is invisible for consumer
+            ListView<String> view = service.getServicesOfServer(0, Integer.MAX_VALUE, Constants.DEFAULT_GROUP);
             return new LinkedHashSet<>(view.getData());
         });
     }
@@ -104,7 +110,7 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
     @Override
     public List<ServiceInstance> getInstances(String serviceName) throws NullPointerException {
         return ThrowableFunction.execute(namingService, service ->
-                service.selectInstances(serviceName, true)
+                service.selectInstances(serviceName, Constants.DEFAULT_GROUP, true)
                         .stream().map(NacosNamingServiceUtils::toServiceInstance)
                         .collect(Collectors.toList())
         );
@@ -116,7 +122,7 @@ public class NacosServiceDiscovery extends AbstractServiceDiscovery {
         execute(namingService, service -> {
             listener.getServiceNames().forEach(serviceName -> {
                 try {
-                    service.subscribe(serviceName, e -> { // Register Nacos EventListener
+                    service.subscribe(serviceName, Constants.DEFAULT_GROUP, e -> { // Register Nacos EventListener
                         if (e instanceof NamingEvent) {
                             NamingEvent event = (NamingEvent) e;
                             handleEvent(event, listener);
diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java
index e9467cf..9136eee 100644
--- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java
+++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java
@@ -36,9 +36,7 @@ import java.util.Properties;
 
 import static com.alibaba.nacos.api.PropertyKeyConst.NAMING_LOAD_CACHE_AT_START;
 import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR;
-import static com.alibaba.nacos.api.common.Constants.DEFAULT_GROUP;
 import static com.alibaba.nacos.client.naming.utils.UtilAndComs.NACOS_NAMING_LOG_NAME;
-import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
 import static org.apache.dubbo.common.constants.RemotingConstants.BACKUP_KEY;
 import static org.apache.dubbo.common.utils.StringConstantFieldValuePredicate.of;
 
@@ -86,19 +84,6 @@ public class NacosNamingServiceUtils {
     }
 
     /**
-     * The group of {@link NamingService} to register
-     *
-     * @param connectionURL {@link URL connection url}
-     * @return non-null, "default" as default
-     * @since 2.7.5
-     */
-    public static String getGroup(URL connectionURL) {
-        // Compatible with nacos grouping via group.
-        String group = connectionURL.getParameter(GROUP_KEY, DEFAULT_GROUP);
-        return connectionURL.getParameter(NACOS_GROUP_KEY, group);
-    }
-
-    /**
      * Create an instance of {@link NamingService} from specified {@link URL connection url}
      *
      * @param connectionURL {@link URL connection url}

[dubbo] 02/04: fix NPE on serialization checking when request timed out (#8547)

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0.2.1-release
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit a1b6658be4bb6b04feb7f89509c78dddc5e5bccd
Author: ken.lj <ke...@gmail.com>
AuthorDate: Thu Aug 19 18:49:39 2021 +0800

    fix NPE on serialization checking when request timed out (#8547)
---
 .../apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
index cb7a41a..8c2f671 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DecodeableRpcResult.java
@@ -118,11 +118,13 @@ public class DecodeableRpcResult extends AppResponse implements Codec, Decodeabl
     public void decode() throws Exception {
         if (!hasDecoded && channel != null && inputStream != null) {
             try {
-                if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, true)) {
-                    Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
-                    if (serializationType_obj != null) {
-                        if ((byte) serializationType_obj != serializationType) {
-                            throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
+                if (invocation != null) {
+                    if (ConfigurationUtils.getSystemConfiguration().getBoolean(SERIALIZATION_SECURITY_CHECK_KEY, true)) {
+                        Object serializationType_obj = invocation.get(SERIALIZATION_ID_KEY);
+                        if (serializationType_obj != null) {
+                            if ((byte) serializationType_obj != serializationType) {
+                                throw new IOException("Unexpected serialization id:" + serializationType + " received from network, please check if the peer send the right id.");
+                            }
                         }
                     }
                 }