From f3d862c4d0c600a91cc4aaa6a718bf3659f15838 Mon Sep 17 00:00:00 2001 From: zhengyangyong Date: Thu, 19 Jul 2018 16:42:07 +0800 Subject: [PATCH 1/2] SCB-687 add highway server connection protection Signed-off-by: zhengyangyong --- .../foundation/vertx/ClientClosedEvent.java | 37 ++++++++++ .../vertx/ClientConnectedEvent.java | 39 +++++++++++ .../foundation/vertx/server/TcpServer.java | 26 ++++++- .../vertx/server/TcpServerConnection.java | 9 ++- .../vertx/server/TestTcpServer.java | 5 +- .../vertx/server/TestTcpServerConnection.java | 4 +- integration-tests/pom.xml | 1 + .../spring-pojo-connection-limit-test/pom.xml | 68 +++++++++++++++++++ ...oSpringConnectionLimitIntegrationTest.java | 47 +++++++++++++ .../demo/pojo/test/PojoSpringMain.java | 31 +++++++++ .../src/test/resources/log4j.properties | 20 ++++++ .../src/test/resources/microservice.yaml | 29 ++++++++ .../pojo/test/ConnectionEventWatcher.java | 44 ++++++++++++ .../pojo/test/PojoSpringIntegrationTest.java | 13 ++++ .../highway/HighwayServerConnection.java | 6 +- .../highway/TestHighwayServerConnection.java | 3 +- 16 files changed, 373 insertions(+), 9 deletions(-) create mode 100644 foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientClosedEvent.java create mode 100644 foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientConnectedEvent.java create mode 100644 integration-tests/spring-pojo-connection-limit-test/pom.xml create mode 100644 integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringConnectionLimitIntegrationTest.java create mode 100644 integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringMain.java create mode 100644 integration-tests/spring-pojo-connection-limit-test/src/test/resources/log4j.properties create mode 100644 integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml create mode 100644 integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientClosedEvent.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientClosedEvent.java new file mode 100644 index 00000000000..9a2ba4dc581 --- /dev/null +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientClosedEvent.java @@ -0,0 +1,37 @@ +/* + * 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.foundation.vertx; + +public class ClientClosedEvent { + private final String address; + + private final int totalConnectedCount; + + public String getAddress() { + return address; + } + + public int getTotalConnectedCount() { + return totalConnectedCount; + } + + public ClientClosedEvent(String address, int totalConnectedCount) { + this.address = address; + this.totalConnectedCount = totalConnectedCount; + } +} \ No newline at end of file diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientConnectedEvent.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientConnectedEvent.java new file mode 100644 index 00000000000..9c2d3a31063 --- /dev/null +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/ClientConnectedEvent.java @@ -0,0 +1,39 @@ +/* + * 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.foundation.vertx; + +import io.vertx.core.net.NetSocket; + +public class ClientConnectedEvent { + private final NetSocket netSocket; + + private final int totalConnectedCount; + + public NetSocket getNetSocket() { + return netSocket; + } + + public int getTotalConnectedCount() { + return totalConnectedCount; + } + + public ClientConnectedEvent(NetSocket netSocket, int totalConnectedCount) { + this.netSocket = netSocket; + this.totalConnectedCount = totalConnectedCount; + } +} \ No newline at end of file diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java index a4fd6902ea3..936f1715118 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java @@ -18,14 +18,19 @@ package org.apache.servicecomb.foundation.vertx.server; import java.net.InetSocketAddress; +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.servicecomb.foundation.common.event.EventManager; import org.apache.servicecomb.foundation.common.net.URIEndpointObject; import org.apache.servicecomb.foundation.ssl.SSLCustom; import org.apache.servicecomb.foundation.ssl.SSLOption; import org.apache.servicecomb.foundation.ssl.SSLOptionFactory; import org.apache.servicecomb.foundation.vertx.AsyncResultCallback; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; import org.apache.servicecomb.foundation.vertx.VertxTLSBuilder; +import com.netflix.config.DynamicPropertyFactory; + import io.vertx.core.Vertx; import io.vertx.core.net.NetServer; import io.vertx.core.net.NetServerOptions; @@ -33,8 +38,15 @@ public class TcpServer { private URIEndpointObject endpointObject; + private final AtomicInteger connectedCounter; + + private final int connectionLimit; + public TcpServer(URIEndpointObject endpointObject) { this.endpointObject = endpointObject; + this.connectedCounter = new AtomicInteger(0); + this.connectionLimit = DynamicPropertyFactory.getInstance() + .getIntProperty("servicecomb.highway.server.connection-limit", Integer.MAX_VALUE).get(); } public void init(Vertx vertx, String sslKey, AsyncResultCallback callback) { @@ -57,8 +69,18 @@ public void init(Vertx vertx, String sslKey, AsyncResultCallback { - TcpServerConnection connection = createTcpServerConnection(); - connection.init(netSocket); + if (connectedCounter.get() < connectionLimit) { + int connectedCount = connectedCounter.incrementAndGet(); + if (connectedCount <= connectionLimit) { + TcpServerConnection connection = createTcpServerConnection(); + connection.init(netSocket, connectedCounter); + EventManager.post(new ClientConnectedEvent(netSocket, connectedCount)); + return; + } else { + connectedCounter.decrementAndGet(); + } + } + netSocket.close(); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServerConnection.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServerConnection.java index 348a3f8437a..5c47100ee1e 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServerConnection.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServerConnection.java @@ -16,6 +16,10 @@ */ package org.apache.servicecomb.foundation.vertx.server; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.apache.servicecomb.foundation.vertx.ClientClosedEvent; import org.apache.servicecomb.foundation.vertx.tcp.TcpConnection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,7 +32,7 @@ public class TcpServerConnection extends TcpConnection { protected TcpParser splitter; - public void init(NetSocket netSocket) { + public void init(NetSocket netSocket, AtomicInteger connectedCounter) { // currently, socket always be NetSocketImpl this.initNetSocket((NetSocketImpl) netSocket); @@ -46,6 +50,9 @@ public void init(NetSocket netSocket) { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); + + int connectedCount = connectedCounter.decrementAndGet(); + EventManager.post(new ClientClosedEvent(remoteAddress, connectedCount)); }); netSocket.handler(splitter); diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java index 403b73105e8..47029053d2d 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java @@ -18,6 +18,7 @@ package org.apache.servicecomb.foundation.vertx.server; import java.net.InetSocketAddress; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.foundation.common.net.URIEndpointObject; import org.apache.servicecomb.foundation.vertx.AsyncResultCallback; @@ -41,8 +42,8 @@ public TcpServerForTest(URIEndpointObject endpointObject) { protected TcpServerConnection createTcpServerConnection() { return new TcpServerConnection() { @Override - public void init(NetSocket netSocket) { - super.init(netSocket); + public void init(NetSocket netSocket, AtomicInteger connectedCounter) { + super.init(netSocket, connectedCounter); } }; } diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServerConnection.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServerConnection.java index 3047042f2ff..08b39780b73 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServerConnection.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServerConnection.java @@ -16,6 +16,8 @@ */ package org.apache.servicecomb.foundation.vertx.server; +import java.util.concurrent.atomic.AtomicInteger; + import org.junit.Assert; import org.junit.Test; @@ -29,7 +31,7 @@ public void test(@Mocked NetSocketImpl netSocket) { connection.setProtocol("p"); connection.setZipName("z"); - connection.init(netSocket); + connection.init(netSocket, new AtomicInteger()); Assert.assertEquals(netSocket, connection.getNetSocket()); } diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index a50b494b409..3c449b72d1d 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -41,6 +41,7 @@ spring-zuul-tracing-tests spring-pojo-tests dynamic-config-tests + spring-pojo-connection-limit-test diff --git a/integration-tests/spring-pojo-connection-limit-test/pom.xml b/integration-tests/spring-pojo-connection-limit-test/pom.xml new file mode 100644 index 00000000000..c0da88edad5 --- /dev/null +++ b/integration-tests/spring-pojo-connection-limit-test/pom.xml @@ -0,0 +1,68 @@ + + + + + + integration-tests + org.apache.servicecomb.tests + 1.0.0-SNAPSHOT + + 4.0.0 + + spring-pojo-connection-limit-test + Java Chassis::Integration Tests::Spring POJO Connection Limit + + + + org.apache.servicecomb.tests + pojo-test + 1.0.0-SNAPSHOT + test-jar + + + org.apache.servicecomb.demo + demo-signature + + + + + org.springframework.boot + spring-boot-autoconfigure + + + org.apache.servicecomb + spring-boot-starter-provider + + + org.springframework.boot + spring-boot-test + + + org.springframework + spring-test + + + org.hibernate + hibernate-validator + + + + + \ No newline at end of file diff --git a/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringConnectionLimitIntegrationTest.java b/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringConnectionLimitIntegrationTest.java new file mode 100644 index 00000000000..69015c8ceba --- /dev/null +++ b/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringConnectionLimitIntegrationTest.java @@ -0,0 +1,47 @@ +/* + * 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.pojo.test; + +import static org.apache.servicecomb.serviceregistry.client.LocalServiceRegistryClientImpl.LOCAL_REGISTRY_FILE_KEY; +import static org.junit.Assert.fail; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = PojoSpringMain.class) +public class PojoSpringConnectionLimitIntegrationTest { + @BeforeClass + public static void setUpClass() { + System.setProperty(LOCAL_REGISTRY_FILE_KEY, "notExistJustForceLocal"); + } + + @Test + public void remoteHelloPojo_sayHello() { + try { + PojoService.hello.SayHello("whatever"); + fail("connection limit failed"); + } catch (Exception e) { + Assert.assertEquals("java.io.IOException: socket closed", e.getCause().toString()); + } + } +} \ No newline at end of file diff --git a/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringMain.java b/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringMain.java new file mode 100644 index 00000000000..13755713acd --- /dev/null +++ b/integration-tests/spring-pojo-connection-limit-test/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringMain.java @@ -0,0 +1,31 @@ +/* + * 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.pojo.test; + +import org.apache.servicecomb.springboot.starter.provider.EnableServiceComb; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +@EnableServiceComb +public class PojoSpringMain { + + public static void main(final String[] args) { + SpringApplication.run(PojoSpringMain.class, args); + } +} \ No newline at end of file diff --git a/integration-tests/spring-pojo-connection-limit-test/src/test/resources/log4j.properties b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/log4j.properties new file mode 100644 index 00000000000..e18648a8112 --- /dev/null +++ b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/log4j.properties @@ -0,0 +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. +# +log4j.rootLogger=INFO, stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n \ No newline at end of file diff --git a/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml new file mode 100644 index 00000000000..3935df68d8a --- /dev/null +++ b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml @@ -0,0 +1,29 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +APPLICATION_ID: pojotest-it +service_description: + name: pojo-connection-limit + version: 0.0.4 +servicecomb: + service: + registry: + address: http://127.0.0.1:30100 + highway: + address: 0.0.0.0:7070 + server: + connection-limit: 0 \ No newline at end of file diff --git a/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java b/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java new file mode 100644 index 00000000000..68e58ccf0ff --- /dev/null +++ b/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/ConnectionEventWatcher.java @@ -0,0 +1,44 @@ +/* + * 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.pojo.test; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.servicecomb.foundation.vertx.ClientClosedEvent; +import org.apache.servicecomb.foundation.vertx.ClientConnectedEvent; + +import com.google.common.eventbus.Subscribe; + +public class ConnectionEventWatcher { + private final List counters = new ArrayList<>(); + + public List getCounters() { + return counters; + } + + @Subscribe + public void onConnected(ClientConnectedEvent event) { + counters.add(event.getTotalConnectedCount()); + } + + @Subscribe + public void onClosed(ClientClosedEvent event) { + counters.add(event.getTotalConnectedCount()); + } +} diff --git a/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringIntegrationTest.java b/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringIntegrationTest.java index 29f1c97c705..749a4e52559 100644 --- a/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringIntegrationTest.java +++ b/integration-tests/spring-pojo-tests/src/test/java/org/apache/servicecomb/demo/pojo/test/PojoSpringIntegrationTest.java @@ -17,6 +17,10 @@ package org.apache.servicecomb.demo.pojo.test; +import org.apache.servicecomb.core.SCBEngine; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.junit.AfterClass; +import org.junit.Assert; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -26,8 +30,17 @@ @SpringBootTest(classes = PojoSpringMain.class) public class PojoSpringIntegrationTest extends PojoIntegrationTestBase { + private static final ConnectionEventWatcher watcher = new ConnectionEventWatcher(); + @BeforeClass public static void setUpClass() { setUpLocalRegistry(); + EventManager.register(watcher); + } + + @AfterClass + public static void teardownClass() { + SCBEngine.getInstance().destroy(); + Assert.assertArrayEquals("check connection count change", new Integer[] {1, 0}, watcher.getCounters().toArray()); } } 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 79b5e02c695..1f5a7593b82 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 @@ -16,6 +16,8 @@ */ package org.apache.servicecomb.transport.highway; +import java.util.concurrent.atomic.AtomicInteger; + import javax.ws.rs.core.Response.Status; import org.apache.servicecomb.core.Endpoint; @@ -45,9 +47,9 @@ public HighwayServerConnection(Endpoint endpoint) { } @Override - public void init(NetSocket netSocket) { + public void init(NetSocket netSocket, AtomicInteger connectedCounter) { splitter = new TcpParser(this); - super.init(netSocket); + super.init(netSocket, connectedCounter); } @Override diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayServerConnection.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayServerConnection.java index e951b97a752..4f49fbc6f16 100644 --- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayServerConnection.java +++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayServerConnection.java @@ -17,6 +17,7 @@ package org.apache.servicecomb.transport.highway; import java.net.InetSocketAddress; +import java.util.concurrent.atomic.AtomicInteger; import javax.xml.ws.Holder; @@ -75,7 +76,7 @@ public void init() { } }; connection = new HighwayServerConnection(endpoint); - connection.init(netSocket); + connection.init(netSocket, new AtomicInteger()); header = new RequestHeader(); } From 2bf89b0a4b2ea14af9862990e4bad5da0d56651a Mon Sep 17 00:00:00 2001 From: zhengyangyong Date: Thu, 19 Jul 2018 17:11:15 +0800 Subject: [PATCH 2/2] SCB-687 fix test case Signed-off-by: zhengyangyong --- .../src/test/resources/microservice.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml index 3935df68d8a..d1333f0c150 100644 --- a/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml +++ b/integration-tests/spring-pojo-connection-limit-test/src/test/resources/microservice.yaml @@ -17,7 +17,7 @@ APPLICATION_ID: pojotest-it service_description: - name: pojo-connection-limit + name: pojo version: 0.0.4 servicecomb: service: