You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/10/15 11:04:13 UTC

[incubator-servicecomb-java-chassis] 01/02: [SCB-957] delete too old protobuf map compatible flag

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

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git

commit c847eac82cf8fb180bcf8457d890307619cbf148
Author: wujimin <wu...@huawei.com>
AuthorDate: Thu Oct 11 10:48:52 2018 +0800

    [SCB-957] delete too old protobuf map compatible flag
---
 .../io/protostuff/runtime/ProtobufFeature.java     | 33 -----------------
 .../protostuff/runtime/ProtobufFeatureUtils.java   | 41 ----------------------
 .../runtime/RuntimeMapFieldProtobuf.java           | 12 +------
 .../codec/protobuf/utils/WrapSchema.java           | 20 ++---------
 .../runtime/TestProtobufCompatibleUtils.java       |  4 ---
 .../transport/highway/HighwayClient.java           |  3 +-
 .../transport/highway/HighwayClientConnection.java | 11 +-----
 .../transport/highway/HighwayClientPackage.java    |  2 +-
 .../transport/highway/HighwayCodec.java            | 26 +++++++-------
 .../transport/highway/HighwayOutputStream.java     | 10 ++----
 .../transport/highway/HighwayServerConnection.java | 11 ++----
 .../transport/highway/HighwayServerInvoke.java     | 12 +++----
 .../transport/highway/message/LoginRequest.java    | 15 +++-----
 .../transport/highway/message/LoginResponse.java   | 15 +++-----
 .../transport/highway/message/RequestHeader.java   |  5 ++-
 .../transport/highway/message/ResponseHeader.java  |  5 ++-
 .../servicecomb/transport/common/MockUtil.java     |  5 ++-
 .../transport/highway/TestHighwayClient.java       |  7 ++--
 .../transport/highway/TestHighwayCodec.java        | 15 ++++----
 19 files changed, 52 insertions(+), 200 deletions(-)

diff --git a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeature.java b/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeature.java
deleted file mode 100644
index e62b783..0000000
--- a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeature.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 io.protostuff.runtime;
-
-public class ProtobufFeature {
-  // 历史版本中的protoStuff实现的protobuf的map编码与标准的protobuf不兼容
-  // 为保持highway的兼容,旧的不兼容编码也要保留
-  // 所以这里默认为false
-  // 只有LoginRequest/LoginResponse同时为true时,才使用标准protobuf编码
-  private boolean useProtobufMapCodec = false;
-
-  public boolean isUseProtobufMapCodec() {
-    return useProtobufMapCodec;
-  }
-
-  public void setUseProtobufMapCodec(boolean useProtobufMapCodec) {
-    this.useProtobufMapCodec = useProtobufMapCodec;
-  }
-}
diff --git a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeatureUtils.java b/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeatureUtils.java
deleted file mode 100644
index fa540d7..0000000
--- a/common/common-protobuf/src/main/java/io/protostuff/runtime/ProtobufFeatureUtils.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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 io.protostuff.runtime;
-
-public final class ProtobufFeatureUtils {
-  private static ThreadLocal<ProtobufFeature> local = new ThreadLocal<>();
-
-  private ProtobufFeatureUtils() {
-  }
-
-  static boolean isUseProtobufMapCodec() {
-    ProtobufFeature protobufFeature = local.get();
-    return protobufFeature != null && protobufFeature.isUseProtobufMapCodec();
-  }
-
-  public static ProtobufFeature getProtobufFeature() {
-    return local.get();
-  }
-
-  public static void setProtobufFeature(ProtobufFeature protobufFeature) {
-    local.set(protobufFeature);
-  }
-
-  public static void removeProtobufFeature() {
-    local.remove();
-  }
-}
diff --git a/common/common-protobuf/src/main/java/io/protostuff/runtime/RuntimeMapFieldProtobuf.java b/common/common-protobuf/src/main/java/io/protostuff/runtime/RuntimeMapFieldProtobuf.java
index dae706e..4489cbf 100644
--- a/common/common-protobuf/src/main/java/io/protostuff/runtime/RuntimeMapFieldProtobuf.java
+++ b/common/common-protobuf/src/main/java/io/protostuff/runtime/RuntimeMapFieldProtobuf.java
@@ -63,11 +63,6 @@ public class RuntimeMapFieldProtobuf<T> extends RuntimeMapField<T, Object, Objec
   @SuppressWarnings("unchecked")
   @Override
   protected void mergeFrom(Input input, T message) throws IOException {
-    if (!ProtobufFeatureUtils.isUseProtobufMapCodec()) {
-      runtimeMapField.mergeFrom(input, message);
-      return;
-    }
-
     Map<Object, Object> value = null;
     try {
       value = (Map<Object, Object>) field.get(message);
@@ -95,7 +90,7 @@ public class RuntimeMapFieldProtobuf<T> extends RuntimeMapField<T, Object, Objec
       throw new ProtostuffException(
           "The map was incorrectly serialized, expect key number 1, but be " + keyNumber);
     }
-    Object key = kFrom(input, null);
+    Object key = kFrom(input, mapWrapper);
 
     int valueNumber = input.readFieldNumber(schema);
     if (valueNumber != 2) {
@@ -108,11 +103,6 @@ public class RuntimeMapFieldProtobuf<T> extends RuntimeMapField<T, Object, Objec
   @Override
   @SuppressWarnings("unchecked")
   protected void writeTo(Output output, T message) throws IOException {
-    if (!ProtobufFeatureUtils.isUseProtobufMapCodec()) {
-      runtimeMapField.writeTo(output, message);
-      return;
-    }
-
     final Map<Object, Object> existing;
     try {
       existing = (Map<Object, Object>) field.get(message);
diff --git a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java
index c24b5c2..6778330 100644
--- a/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java
+++ b/common/common-protobuf/src/main/java/org/apache/servicecomb/codec/protobuf/utils/WrapSchema.java
@@ -22,13 +22,11 @@ import java.nio.ByteBuffer;
 import io.protostuff.ByteBufferInput;
 import io.protostuff.Input;
 import io.protostuff.Output;
-import io.protostuff.runtime.ProtobufFeature;
-import io.protostuff.runtime.ProtobufFeatureUtils;
 import io.vertx.core.buffer.Buffer;
 
 public interface WrapSchema {
   @SuppressWarnings("unchecked")
-  default <T> T readObject(Buffer buffer, ProtobufFeature protobufFeature) throws Exception {
+  default <T> T readObject(Buffer buffer) throws Exception {
     if (buffer == null || buffer.length() == 0) {
       // void以及函数入参为null的场景
       // 空串时,protobuf至少为编码为1字节
@@ -38,21 +36,7 @@ public interface WrapSchema {
     ByteBuffer nioBuffer = buffer.getByteBuf().nioBuffer();
     Input input = new ByteBufferInput(nioBuffer, false);
 
-    ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
-    try {
-      return (T) readObject(input);
-    } finally {
-      ProtobufFeatureUtils.removeProtobufFeature();
-    }
-  }
-
-  default void writeObject(Output output, Object value, ProtobufFeature protobufFeature) throws Exception {
-    ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
-    try {
-      writeObject(output, value);
-    } finally {
-      ProtobufFeatureUtils.removeProtobufFeature();
-    }
+    return (T) readObject(input);
   }
 
   Object readFromEmpty();
diff --git a/common/common-protobuf/src/test/java/io/protostuff/runtime/TestProtobufCompatibleUtils.java b/common/common-protobuf/src/test/java/io/protostuff/runtime/TestProtobufCompatibleUtils.java
index d49b9f0..22192c2 100644
--- a/common/common-protobuf/src/test/java/io/protostuff/runtime/TestProtobufCompatibleUtils.java
+++ b/common/common-protobuf/src/test/java/io/protostuff/runtime/TestProtobufCompatibleUtils.java
@@ -72,10 +72,7 @@ public class TestProtobufCompatibleUtils {
 
     LinkedBuffer linkedBuffer = LinkedBuffer.allocate();
     ProtobufOutput output = new ProtobufOutput(linkedBuffer);
-    ProtobufFeature protobufFeature = new ProtobufFeature();
-    protobufFeature.setUseProtobufMapCodec(true);
 
-    ProtobufFeatureUtils.setProtobufFeature(protobufFeature);
     schema.writeTo(output, model);
 
     ByteArrayOutputStream s = new ByteArrayOutputStream();
@@ -87,7 +84,6 @@ public class TestProtobufCompatibleUtils {
 
     schema.mergeFrom(bai, newModel);
 
-    ProtobufFeatureUtils.removeProtobufFeature();
     Assert.assertEquals("v1", newModel.getContext().get("k1"));
     Assert.assertEquals("v2", newModel.getContext().get("k2"));
     Assert.assertEquals("n1", newModel.getUserMap().get("u1").getName());
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClient.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClient.java
index 8cfd0cc..730a29c 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClient.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClient.java
@@ -119,8 +119,7 @@ public class HighwayClient {
           Response response =
               HighwayCodec.decodeResponse(invocation,
                   operationProtobuf,
-                  ar.result(),
-                  tcpClient.getProtobufFeature());
+                  ar.result());
           invocation.getInvocationStageTrace().finishClientFiltersResponse();
           asyncResp.complete(response);
         } catch (Throwable e) {
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientConnection.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientConnection.java
index b08d99c..6a64291 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientConnection.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientConnection.java
@@ -27,24 +27,17 @@ import org.apache.servicecomb.transport.highway.message.RequestHeader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.Context;
 import io.vertx.core.buffer.Buffer;
 
 public class HighwayClientConnection extends TcpClientConnection {
   private static final Logger LOGGER = LoggerFactory.getLogger(HighwayClientConnection.class);
 
-  private ProtobufFeature protobufFeature = new ProtobufFeature();
-
   public HighwayClientConnection(Context context, NetClientWrapper netClientWrapper, String endpoint) {
     super(context, netClientWrapper, endpoint);
     setLocalSupportLogin(true);
   }
 
-  public ProtobufFeature getProtobufFeature() {
-    return protobufFeature;
-  }
-
   @Override
   protected TcpOutputStream createLogin() {
     try {
@@ -53,9 +46,8 @@ public class HighwayClientConnection extends TcpClientConnection {
 
       LoginRequest login = new LoginRequest();
       login.setProtocol(Const.HIGHWAY);
-      login.setUseProtobufMapCodec(true);
 
-      HighwayOutputStream os = new HighwayOutputStream(AbstractTcpClientPackage.getAndIncRequestId(), null);
+      HighwayOutputStream os = new HighwayOutputStream(AbstractTcpClientPackage.getAndIncRequestId());
       os.write(header, LoginRequest.getLoginRequestSchema(), login);
       return os;
     } catch (Throwable e) {
@@ -67,7 +59,6 @@ public class HighwayClientConnection extends TcpClientConnection {
   protected boolean onLoginResponse(Buffer bodyBuffer) {
     try {
       LoginResponse response = LoginResponse.readObject(bodyBuffer);
-      protobufFeature.setUseProtobufMapCodec(response.isUseProtobufMapCodec());
       return true;
     } catch (Throwable e) {
       LOGGER.error("decode login response failed.", e);
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientPackage.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientPackage.java
index 230b862..e978757 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientPackage.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayClientPackage.java
@@ -38,7 +38,7 @@ public class HighwayClientPackage extends AbstractTcpClientPackage {
   @Override
   public TcpOutputStream createStream() {
     try {
-      return HighwayCodec.encodeRequest(msgId, invocation, operationProtobuf, tcpClient.getProtobufFeature());
+      return HighwayCodec.encodeRequest(msgId, invocation, operationProtobuf);
     } catch (Exception e) {
       String msg = String.format("encode request failed. appid=%s, qualifiedName=%s",
           invocation.getAppId(),
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayCodec.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayCodec.java
index fc5a148..a51210a 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayCodec.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayCodec.java
@@ -26,7 +26,6 @@ import org.apache.servicecomb.swagger.invocation.Response;
 import org.apache.servicecomb.transport.highway.message.RequestHeader;
 import org.apache.servicecomb.transport.highway.message.ResponseHeader;
 
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 
 public final class HighwayCodec {
@@ -34,7 +33,7 @@ public final class HighwayCodec {
   }
 
   public static TcpOutputStream encodeRequest(long msgId, Invocation invocation,
-      OperationProtobuf operationProtobuf, ProtobufFeature protobufFeature) throws Exception {
+      OperationProtobuf operationProtobuf) throws Exception {
     // 写header
     RequestHeader header = new RequestHeader();
     header.setMsgType(MsgType.REQUEST);
@@ -44,42 +43,41 @@ public final class HighwayCodec {
     header.setOperationName(invocation.getOperationName());
     header.setContext(invocation.getContext());
 
-    HighwayOutputStream os = new HighwayOutputStream(msgId, protobufFeature);
+    HighwayOutputStream os = new HighwayOutputStream(msgId);
     os.write(header, operationProtobuf.getRequestSchema(), invocation.getArgs());
     return os;
   }
 
   public static void decodeRequest(Invocation invocation, RequestHeader header, OperationProtobuf operationProtobuf,
-      Buffer bodyBuffer, ProtobufFeature protobufFeature) throws Exception {
+      Buffer bodyBuffer) throws Exception {
     WrapSchema schema = operationProtobuf.getRequestSchema();
-    Object[] args = schema.readObject(bodyBuffer, protobufFeature);
+    Object[] args = schema.readObject(bodyBuffer);
 
     invocation.setSwaggerArguments(args);
     invocation.setContext(header.getContext());
   }
 
-  public static RequestHeader readRequestHeader(Buffer headerBuffer,
-      ProtobufFeature protobufFeature) throws Exception {
-    return RequestHeader.readObject(headerBuffer, protobufFeature);
+  public static RequestHeader readRequestHeader(Buffer headerBuffer) throws Exception {
+    return RequestHeader.readObject(headerBuffer);
   }
 
   public static Buffer encodeResponse(long msgId, ResponseHeader header, WrapSchema bodySchema,
-      Object body, ProtobufFeature protobufFeature) throws Exception {
-    try (HighwayOutputStream os = new HighwayOutputStream(msgId, protobufFeature)) {
+      Object body) throws Exception {
+    try (HighwayOutputStream os = new HighwayOutputStream(msgId)) {
       os.write(header, bodySchema, body);
       return os.getBuffer();
     }
   }
 
-  public static Response decodeResponse(Invocation invocation, OperationProtobuf operationProtobuf,
-      TcpData tcpData, ProtobufFeature protobufFeature) throws Exception {
-    ResponseHeader header = ResponseHeader.readObject(tcpData.getHeaderBuffer(), protobufFeature);
+  public static Response decodeResponse(Invocation invocation, OperationProtobuf operationProtobuf, TcpData tcpData)
+      throws Exception {
+    ResponseHeader header = ResponseHeader.readObject(tcpData.getHeaderBuffer());
     if (header.getContext() != null) {
       invocation.getContext().putAll(header.getContext());
     }
 
     WrapSchema bodySchema = operationProtobuf.findResponseSchema(header.getStatusCode());
-    Object body = bodySchema.readObject(tcpData.getBodyBuffer(), protobufFeature);
+    Object body = bodySchema.readObject(tcpData.getBodyBuffer());
 
     Response response = Response.create(header.getStatusCode(), header.getReasonPhrase(), body);
     response.setHeaders(header.getHeaders());
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayOutputStream.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayOutputStream.java
index 0cb8812..90e1341 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayOutputStream.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayOutputStream.java
@@ -23,14 +23,10 @@ import org.apache.servicecomb.transport.highway.message.ResponseHeader;
 
 import io.protostuff.LinkedBuffer;
 import io.protostuff.ProtobufOutput;
-import io.protostuff.runtime.ProtobufFeature;
 
 public class HighwayOutputStream extends TcpOutputStream {
-  private ProtobufFeature protobufFeature;
-
-  public HighwayOutputStream(long msgId, ProtobufFeature protobufFeature) {
+  public HighwayOutputStream(long msgId) {
     super(msgId);
-    this.protobufFeature = protobufFeature;
   }
 
   public void write(RequestHeader header, WrapSchema bodySchema, Object body) throws Exception {
@@ -48,14 +44,14 @@ public class HighwayOutputStream extends TcpOutputStream {
 
     // 写header
     if (headerSchema != null) {
-      headerSchema.writeObject(output, header, protobufFeature);
+      headerSchema.writeObject(output, header);
     }
     int headerSize = output.getSize();
 
     // 写body
     // void时bodySchema为null
     if (bodySchema != null) {
-      bodySchema.writeObject(output, body, protobufFeature);
+      bodySchema.writeObject(output, body);
     }
 
     writeLength(output.getSize(), headerSize);
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerConnection.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerConnection.java
index 1f5a759..36b80fa 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerConnection.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerConnection.java
@@ -31,7 +31,6 @@ import org.apache.servicecomb.transport.highway.message.ResponseHeader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 import io.vertx.core.net.NetSocket;
 
@@ -40,8 +39,6 @@ public class HighwayServerConnection extends TcpServerConnection implements TcpB
 
   private Endpoint endpoint;
 
-  private ProtobufFeature protobufFeature = new ProtobufFeature();
-
   public HighwayServerConnection(Endpoint endpoint) {
     this.endpoint = endpoint;
   }
@@ -75,7 +72,7 @@ public class HighwayServerConnection extends TcpServerConnection implements TcpB
   protected RequestHeader decodeRequestHeader(long msgId, Buffer headerBuffer) {
     RequestHeader requestHeader = null;
     try {
-      requestHeader = HighwayCodec.readRequestHeader(headerBuffer, protobufFeature);
+      requestHeader = HighwayCodec.readRequestHeader(headerBuffer);
     } catch (Exception e) {
       String msg = String.format("decode request header error, msgId=%d",
           msgId);
@@ -103,15 +100,13 @@ public class HighwayServerConnection extends TcpServerConnection implements TcpB
     if (request != null) {
       this.setProtocol(request.getProtocol());
       this.setZipName(request.getZipName());
-      this.protobufFeature.setUseProtobufMapCodec(request.isUseProtobufMapCodec());
     }
 
-    try (HighwayOutputStream os = new HighwayOutputStream(msgId, protobufFeature)) {
+    try (HighwayOutputStream os = new HighwayOutputStream(msgId)) {
       ResponseHeader responseHeader = new ResponseHeader();
       responseHeader.setStatusCode(Status.OK.getStatusCode());
 
       LoginResponse response = new LoginResponse();
-      response.setUseProtobufMapCodec(protobufFeature.isUseProtobufMapCodec());
 
       os.write(ResponseHeader.getResponseHeaderSchema(),
           responseHeader,
@@ -124,7 +119,7 @@ public class HighwayServerConnection extends TcpServerConnection implements TcpB
   }
 
   protected void onRequest(long msgId, RequestHeader header, Buffer bodyBuffer) {
-    HighwayServerInvoke invoke = new HighwayServerInvoke(endpoint, protobufFeature);
+    HighwayServerInvoke invoke = new HighwayServerInvoke(endpoint);
     if (invoke.init(this, msgId, header, bodyBuffer)) {
       invoke.execute();
     }
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
index 290b75b..20e8e08 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerInvoke.java
@@ -40,14 +40,11 @@ import org.apache.servicecomb.transport.highway.message.ResponseHeader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 
 public class HighwayServerInvoke {
   private static final Logger LOGGER = LoggerFactory.getLogger(HighwayServerInvoke.class);
 
-  private ProtobufFeature protobufFeature;
-
   private RequestHeader header;
 
   private OperationMeta operationMeta;
@@ -67,13 +64,12 @@ public class HighwayServerInvoke {
   protected long start;
 
   public HighwayServerInvoke() {
-    this(null, null);
+    this(null);
   }
 
-  public HighwayServerInvoke(Endpoint endpoint, ProtobufFeature protobufFeature) {
+  public HighwayServerInvoke(Endpoint endpoint) {
     this.start = System.nanoTime();
     this.endpoint = endpoint;
-    this.protobufFeature = protobufFeature;
   }
 
   public boolean init(TcpConnection connection, long msgId,
@@ -134,7 +130,7 @@ public class HighwayServerInvoke {
     invocation.onExecuteStart();
 
     invocation.getInvocationStageTrace().startServerFiltersRequest();
-    HighwayCodec.decodeRequest(invocation, header, operationProtobuf, bodyBuffer, protobufFeature);
+    HighwayCodec.decodeRequest(invocation, header, operationProtobuf, bodyBuffer);
     invocation.getHandlerContext().put(Const.REMOTE_ADDRESS, this.connection.getNetSocket().remoteAddress());
 
     invocation.getInvocationStageTrace().startHandlersRequest();
@@ -159,7 +155,7 @@ public class HighwayServerInvoke {
     }
 
     try {
-      Buffer respBuffer = HighwayCodec.encodeResponse(msgId, header, bodySchema, body, protobufFeature);
+      Buffer respBuffer = HighwayCodec.encodeResponse(msgId, header, bodySchema, body);
       invocation.getInvocationStageTrace().finishServerFiltersResponse();
       connection.write(respBuffer.getByteBuf());
     } catch (Exception e) {
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginRequest.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginRequest.java
index c70bb21..1154566 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginRequest.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginRequest.java
@@ -32,7 +32,7 @@ public class LoginRequest {
   }
 
   public static LoginRequest readObject(Buffer bodyBuffer) throws Exception {
-    return loginRequestSchema.readObject(bodyBuffer, null);
+    return loginRequestSchema.readObject(bodyBuffer);
   }
 
   @Tag(1)
@@ -42,11 +42,12 @@ public class LoginRequest {
   @Tag(2)
   private String zipName;
 
+  // no need this flag any more, but tag(3) should be reserved
   // 历史版本中的protoStuff实现的protobuf的map编码与标准的protobuf不兼容
   // 为保持highway的兼容,旧的不兼容编码也要保留
   // 只有LoginRequest/LoginResponse同时为true时,才使用标准protobuf编码
-  @Tag(3)
-  private boolean useProtobufMapCodec;
+  //@Tag(3)
+  //private boolean useProtobufMapCodec;
 
   public String getProtocol() {
     return protocol;
@@ -64,14 +65,6 @@ public class LoginRequest {
     this.zipName = zipName;
   }
 
-  public boolean isUseProtobufMapCodec() {
-    return useProtobufMapCodec;
-  }
-
-  public void setUseProtobufMapCodec(boolean useProtobufMapCodec) {
-    this.useProtobufMapCodec = useProtobufMapCodec;
-  }
-
   public void writeObject(ProtobufOutput output) throws Exception {
     loginRequestSchema.writeObject(output, this);
   }
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginResponse.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginResponse.java
index c1e897d..3e5d482 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginResponse.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/LoginResponse.java
@@ -32,7 +32,7 @@ public class LoginResponse {
   }
 
   public static LoginResponse readObject(Buffer bodyBuffer) throws Exception {
-    return loginResponseSchema.readObject(bodyBuffer, null);
+    return loginResponseSchema.readObject(bodyBuffer);
   }
 
   @Tag(1)
@@ -42,11 +42,12 @@ public class LoginResponse {
   @Tag(2)
   private String zipName;
 
+  // no need this flag any more, but tag(3) should be reserved
   // 历史版本中的protoStuff实现的protobuf的map编码与标准的protobuf不兼容
   // 为保持highway的兼容,旧的不兼容编码也要保留
   // 只有LoginRequest/LoginResponse同时为true时,才使用标准protobuf编码
-  @Tag(3)
-  private boolean useProtobufMapCodec;
+  //@Tag(3)
+  //private boolean useProtobufMapCodec;
 
   public String getProtocol() {
     return protocol;
@@ -64,14 +65,6 @@ public class LoginResponse {
     this.zipName = zipName;
   }
 
-  public boolean isUseProtobufMapCodec() {
-    return useProtobufMapCodec;
-  }
-
-  public void setUseProtobufMapCodec(boolean useProtobufMapCodec) {
-    this.useProtobufMapCodec = useProtobufMapCodec;
-  }
-
   public void writeObject(ProtobufOutput output) throws Exception {
     loginResponseSchema.writeObject(output, this);
   }
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/RequestHeader.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/RequestHeader.java
index 2587695..41e1114 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/RequestHeader.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/RequestHeader.java
@@ -24,7 +24,6 @@ import org.apache.servicecomb.codec.protobuf.utils.WrapSchema;
 
 import io.protostuff.ProtobufOutput;
 import io.protostuff.Tag;
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 
 /**
@@ -39,8 +38,8 @@ public class RequestHeader {
     return requestHeaderSchema;
   }
 
-  public static RequestHeader readObject(Buffer bodyBuffer, ProtobufFeature protobufFeature) throws Exception {
-    return requestHeaderSchema.readObject(bodyBuffer, protobufFeature);
+  public static RequestHeader readObject(Buffer bodyBuffer) throws Exception {
+    return requestHeaderSchema.readObject(bodyBuffer);
   }
 
   //CHECKSTYLE:OFF: magicnumber
diff --git a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/ResponseHeader.java b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/ResponseHeader.java
index e0824b2..9200385 100644
--- a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/ResponseHeader.java
+++ b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/message/ResponseHeader.java
@@ -25,7 +25,6 @@ import org.apache.servicecomb.swagger.invocation.response.Headers;
 
 import io.protostuff.ProtobufOutput;
 import io.protostuff.Tag;
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 
 public class ResponseHeader {
@@ -36,8 +35,8 @@ public class ResponseHeader {
     return responseHeaderSchema;
   }
 
-  public static ResponseHeader readObject(Buffer bodyBuffer, ProtobufFeature protobufFeature) throws Exception {
-    return responseHeaderSchema.readObject(bodyBuffer, protobufFeature);
+  public static ResponseHeader readObject(Buffer bodyBuffer) throws Exception {
+    return responseHeaderSchema.readObject(bodyBuffer);
   }
 
   // 运行时必须的数据,比如body是否压缩
diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/common/MockUtil.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/common/MockUtil.java
index 785b2cb..07d87c9 100644
--- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/common/MockUtil.java
+++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/common/MockUtil.java
@@ -24,7 +24,6 @@ import org.apache.servicecomb.transport.highway.HighwayConfig;
 import org.apache.servicecomb.transport.highway.message.RequestHeader;
 import org.mockito.Mockito;
 
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 import mockit.Mock;
 import mockit.MockUp;
@@ -64,8 +63,8 @@ public class MockUtil {
       }
 
       @Mock
-      public Invocation decodeRequest(RequestHeader header, OperationProtobuf operationProtobuf,
-          Buffer bodyBuffer, ProtobufFeature protobufFeature) throws Exception {
+      public Invocation decodeRequest(RequestHeader header, OperationProtobuf operationProtobuf, Buffer bodyBuffer)
+          throws Exception {
         if (decodeRequestSucc) {
           return Mockito.mock(Invocation.class);
         }
diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayClient.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayClient.java
index 447af35..f8d23fc 100644
--- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayClient.java
+++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayClient.java
@@ -52,7 +52,6 @@ import com.netflix.config.DynamicPropertyFactory;
 
 import io.netty.buffer.ByteBuf;
 import io.protostuff.runtime.ProtobufCompatibleUtils;
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.AbstractVerticle;
 import io.vertx.core.DeploymentOptions;
 import io.vertx.core.Vertx;
@@ -156,8 +155,8 @@ public class TestHighwayClient {
       }
 
       @Mock
-      Response decodeResponse(Invocation invocation, OperationProtobuf operationProtobuf,
-          TcpData tcpData, ProtobufFeature protobufFeature) throws Throwable {
+      Response decodeResponse(Invocation invocation, OperationProtobuf operationProtobuf, TcpData tcpData)
+          throws Throwable {
         if (decodedResponse instanceof Response) {
           return (Response) decodedResponse;
         }
@@ -272,7 +271,7 @@ public class TestHighwayClient {
     start += headerLen;
     Buffer bodyBuffer = os.getBuffer().slice(start, end);
 
-    RequestHeader header = RequestHeader.readObject(headerBuffer, connection.getProtobufFeature());
+    RequestHeader header = RequestHeader.readObject(headerBuffer);
     Assert.assertEquals(MsgType.LOGIN, header.getMsgType());
 
     LoginRequest login = LoginRequest.readObject(bodyBuffer);
diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java
index 28a7cc3..97282c5 100644
--- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java
+++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java
@@ -49,7 +49,6 @@ import org.mockito.Mockito;
 import io.netty.buffer.ByteBuf;
 import io.protostuff.Input;
 import io.protostuff.runtime.ProtobufCompatibleUtils;
-import io.protostuff.runtime.ProtobufFeature;
 import io.vertx.core.buffer.Buffer;
 import mockit.Mock;
 import mockit.MockUp;
@@ -132,11 +131,11 @@ public class TestHighwayCodec {
     commonMock();
     Mockito.when(schemaMeta.getProviderHandlerChain()).thenReturn(Collections.emptyList());
     Object[] args = new Object[] {};
-    Mockito.when(schema.readObject(bodyBuffer, null)).thenReturn(args);
+    Mockito.when(schema.readObject(bodyBuffer)).thenReturn(args);
 
     Invocation invocation = new Invocation(endpoint, operationMeta, null);
 
-    HighwayCodec.decodeRequest(invocation, header, operationProtobuf, bodyBuffer, null);
+    HighwayCodec.decodeRequest(invocation, header, operationProtobuf, bodyBuffer);
 
     Assert.assertSame(args, invocation.getSwaggerArguments());
   }
@@ -158,10 +157,10 @@ public class TestHighwayCodec {
     header.setStatusCode(200);
     header.setContext(new HashMap<>());
     header.getContext().put("a", "10");
-    Buffer responseBuf = HighwayCodec.encodeResponse(0, header, null, null, new ProtobufFeature());
+    Buffer responseBuf = HighwayCodec.encodeResponse(0, header, null, null);
 
     TcpData tcp = new TcpData(responseBuf.slice(23, responseBuf.length()), null);
-    Response response = HighwayCodec.decodeResponse(invocation, operationProtobuf, tcp, null);
+    Response response = HighwayCodec.decodeResponse(invocation, operationProtobuf, tcp);
     Assert.assertEquals("10", invocation.getContext().get("a"));
     Assert.assertEquals(200, response.getStatusCode());
   }
@@ -172,7 +171,7 @@ public class TestHighwayCodec {
     WrapSchema bodySchema = Mockito.mock(WrapSchema.class);
     try {
       commonMock();
-      HighwayCodec.encodeResponse(23432142, null, bodySchema, new Object(), new ProtobufFeature());
+      HighwayCodec.encodeResponse(23432142, null, bodySchema, new Object());
     } catch (Exception e) {
       status = false;
     }
@@ -184,7 +183,7 @@ public class TestHighwayCodec {
     boolean status = true;
     try {
       commonMock();
-      TcpOutputStream os = HighwayCodec.encodeRequest(0, invocation, operationProtobuf, null);
+      TcpOutputStream os = HighwayCodec.encodeRequest(0, invocation, operationProtobuf);
       Assert.assertNotNull(os);
       Assert.assertArrayEquals(TcpParser.TCP_MAGIC, os.getBuffer().getBytes(0, 7));
     } catch (Exception e) {
@@ -204,7 +203,7 @@ public class TestHighwayCodec {
         }
       };
       bodyBuffer = Buffer.buffer("\"abc\"");
-      RequestHeader requestHeader = HighwayCodec.readRequestHeader(bodyBuffer, null);
+      RequestHeader requestHeader = HighwayCodec.readRequestHeader(bodyBuffer);
       Assert.assertNotNull(requestHeader);
       Assert.assertEquals(0, requestHeader.getFlags());
     } catch (Exception e) {