[
https://issues.apache.org/jira/browse/SCB-957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16650076#comment-16650076
]
ASF GitHub Bot commented on SCB-957:
------------------------------------
liubao68 closed pull request #949: [SCB-957] delete too old protobuf map
compatible flag
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/949
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 e62b783aa..000000000
---
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 fa540d7df..000000000
---
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 dae706eeb..4489cbf81 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 RuntimeMapFieldProtobuf(RuntimeMapField<T, Object,
Object> runtimeMapFiel
@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 @@ protected void mergeFrom(Input input, T message) throws
IOException {
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 @@ protected void mergeFrom(Input input, T message) throws
IOException {
@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 c24b5c2ea..677833001 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 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 @@
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 d49b9f0fe..22192c292 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 void test() throws IOException {
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 void test() throws IOException {
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/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
index c074693a7..325f59f24 100644
---
a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
+++
b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestBizkeeper.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.demo.springmvc.client;
import java.util.concurrent.TimeoutException;
diff --git
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
index 8f8e71df7..47026122f 100644
---
a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
+++
b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/BizkeeperTest.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.demo.springmvc.server;
import org.apache.servicecomb.provider.rest.common.RestSchema;
diff --git a/integration-tests/it-common-service/enable-it-jar
b/integration-tests/it-common-service/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-common-service/enable-it-jar
+++ b/integration-tests/it-common-service/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git a/integration-tests/it-common/enable-it-jar
b/integration-tests/it-common/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-common/enable-it-jar
+++ b/integration-tests/it-common/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodJaxrsSchema.java
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodJaxrsSchema.java
index 74ed1c6ba..568d1eea4 100644
---
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodJaxrsSchema.java
+++
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodJaxrsSchema.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.it.schema;
import javax.ws.rs.GET;
diff --git
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodPojoSchema.java
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodPojoSchema.java
index f84b56fa5..c10692c9b 100644
---
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodPojoSchema.java
+++
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodPojoSchema.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.it.schema;
import org.apache.servicecomb.provider.pojo.RpcSchema;
diff --git
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodSpringmvcSchema.java
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodSpringmvcSchema.java
index 5c46082a5..3515038bb 100644
---
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodSpringmvcSchema.java
+++
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/schema/IgnoreStaticMethodSpringmvcSchema.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.it.schema;
import org.apache.servicecomb.provider.rest.common.RestSchema;
diff --git
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestIgnoreStaticMethod.java
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestIgnoreStaticMethod.java
index a25f6cca4..cfa613d32 100644
---
a/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestIgnoreStaticMethod.java
+++
b/integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/TestIgnoreStaticMethod.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.it.testcase;
import org.apache.servicecomb.core.SCBEngine;
diff --git a/integration-tests/it-edge/enable-it-jar
b/integration-tests/it-edge/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-edge/enable-it-jar
+++ b/integration-tests/it-edge/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git
a/integration-tests/it-producer-deploy-springboot2-servlet/enable-it-jar
b/integration-tests/it-producer-deploy-springboot2-servlet/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-producer-deploy-springboot2-servlet/enable-it-jar
+++ b/integration-tests/it-producer-deploy-springboot2-servlet/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git
a/integration-tests/it-producer-deploy-springboot2-standalone/enable-it-jar
b/integration-tests/it-producer-deploy-springboot2-standalone/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-producer-deploy-springboot2-standalone/enable-it-jar
+++ b/integration-tests/it-producer-deploy-springboot2-standalone/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git a/integration-tests/it-producer/enable-it-jar
b/integration-tests/it-producer/enable-it-jar
index e69de29bb..2944f9819 100644
--- a/integration-tests/it-producer/enable-it-jar
+++ b/integration-tests/it-producer/enable-it-jar
@@ -0,0 +1,16 @@
+/*
+ * 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.
+ */
diff --git
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/EdgeMeters.java
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/EdgeMeters.java
index b04a031ae..8efc1419d 100644
---
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/EdgeMeters.java
+++
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/EdgeMeters.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.metrics.core.meter;
import
org.apache.servicecomb.metrics.core.meter.invocation.AbstractInvocationMeters;
diff --git
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeter.java
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeter.java
index ce32457e4..ac9716757 100644
---
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeter.java
+++
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeter.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.metrics.core.meter.invocation;
import java.util.concurrent.TimeUnit;
diff --git
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeters.java
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeters.java
index f962a1527..70c5c203c 100644
---
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeters.java
+++
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/meter/invocation/EdgeInvocationMeters.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.metrics.core.meter.invocation;
import org.apache.servicecomb.core.Invocation;
diff --git
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/model/EdgePublishModel.java
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/model/EdgePublishModel.java
index ee309293e..836223c43 100644
---
a/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/model/EdgePublishModel.java
+++
b/metrics/metrics-core/src/main/java/org/apache/servicecomb/metrics/core/publish/model/EdgePublishModel.java
@@ -1,3 +1,20 @@
+/*
+ * 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.servicecomb.metrics.core.publish.model;
import
org.apache.servicecomb.metrics.core.publish.model.invocation.OperationPerfGroups;
diff --git a/pom.xml b/pom.xml
index 1aedd7e00..f08145b7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,6 +159,9 @@
<exclude>**/src/release/licenses/**</exclude>
<!-- Skip the demo log files -->
<exclude>**/logs/**.log</exclude>
+ <exclude>**/**.log</exclude>
+ <!-- Skip the target files -->
+ <exclude>**/target/**</exclude>
<!-- Skip the source files which are forked from vertx -->
<exclude>**/io/vertx/ext/web/impl/MimeTypesUtils.java</exclude>
<exclude>**/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java</exclude>
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 8cfd0ccb7..730a29c99 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 void send(Invocation invocation, AsyncResponse
asyncResp) throws Exceptio
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 b08d99c5b..6a642912f 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.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 @@ protected TcpOutputStream createLogin() {
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 @@ protected TcpOutputStream createLogin() {
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 230b8623b..e97875790 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 HighwayClientPackage(Invocation invocation,
OperationProtobuf operationPr
@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 fc5a1483a..a51210a60 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.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 @@ private 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 static TcpOutputStream encodeRequest(long msgId,
Invocation invocation,
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 0cb8812c9..90e13414c 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 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 void write(WrapSchema headerSchema, Object header,
WrapSchema bodySchema,
// 写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 1f5a7593b..36b80fa5f 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.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 @@
private Endpoint endpoint;
- private ProtobufFeature protobufFeature = new ProtobufFeature();
-
public HighwayServerConnection(Endpoint endpoint) {
this.endpoint = endpoint;
}
@@ -75,7 +72,7 @@ public void handle(long msgId, Buffer headerBuffer, Buffer
bodyBuffer) {
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 @@ protected void onLogin(long msgId, RequestHeader header,
Buffer bodyBuffer) {
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 @@ protected void onLogin(long msgId, RequestHeader header,
Buffer bodyBuffer) {
}
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 290b75bf3..20e8e0828 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.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 @@
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 @@ private void doRunInExecutor() throws Exception {
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 @@ private void sendResponse(Map<String, String> context,
Response response) {
}
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 c70bb21dd..115456618 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 static WrapSchema getLoginRequestSchema() {
}
public static LoginRequest readObject(Buffer bodyBuffer) throws Exception {
- return loginRequestSchema.readObject(bodyBuffer, null);
+ return loginRequestSchema.readObject(bodyBuffer);
}
@Tag(1)
@@ -42,11 +42,12 @@ public static LoginRequest readObject(Buffer bodyBuffer)
throws Exception {
@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 void setZipName(String zipName) {
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 c1e897d5c..3e5d48230 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 static WrapSchema getLoginResponseSchema() {
}
public static LoginResponse readObject(Buffer bodyBuffer) throws Exception {
- return loginResponseSchema.readObject(bodyBuffer, null);
+ return loginResponseSchema.readObject(bodyBuffer);
}
@Tag(1)
@@ -42,11 +42,12 @@ public static LoginResponse readObject(Buffer bodyBuffer)
throws Exception {
@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 void setZipName(String zipName) {
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 258769518..41e111405 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 io.protostuff.ProtobufOutput;
import io.protostuff.Tag;
-import io.protostuff.runtime.ProtobufFeature;
import io.vertx.core.buffer.Buffer;
/**
@@ -39,8 +38,8 @@ public static WrapSchema getRequestHeaderSchema() {
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 e0824b21a..92003855a 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 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 static WrapSchema getResponseHeaderSchema() {
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 785b2cbc5..07d87c9dd 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.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 @@ RequestHeader readRequestHeader(Buffer headerBuffer) throws
Exception {
}
@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 447af3587..f8d23fc20 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 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 Buffer encodeRequest(Invocation invocation,
OperationProtobuf operationPr
}
@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 void testCreateLogin(@Mocked NetClientWrapper
netClientWrapper) throws Ex
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 28a7cc32d..97282c5b6 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 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 void testDecodeRequest(@Mocked Endpoint endpoint)
throws Exception {
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 void testDecodeResponse() throws Exception {
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 void testEncodeResponse() {
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 void testEncodeRequest() {
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 Object readObject(Input input) throws IOException {
}
};
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) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> delete too old protobuf map compatible flag
> -------------------------------------------
>
> Key: SCB-957
> URL: https://issues.apache.org/jira/browse/SCB-957
> Project: Apache ServiceComb
> Issue Type: Task
> Components: Java-Chassis
> Reporter: wujimin
> Assignee: wujimin
> Priority: Major
> Fix For: java-chassis-1.1.0
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)