This is an automated email from the ASF dual-hosted git repository.
wujimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 8d34751 [SCB-1205] improve edge forward http2 request
8d34751 is described below
commit 8d347513f7dad6b368e3f19a98f6b4f160e8fbdf
Author: wujimin <[email protected]>
AuthorDate: Tue Mar 19 08:49:07 2019 +0800
[SCB-1205] improve edge forward http2 request
---
.../servicecomb/edge/core/EdgeRestTransportClient.java | 4 +++-
.../transport/rest/client/RestTransportClient.java | 16 ++++++----------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git
a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeRestTransportClient.java
b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeRestTransportClient.java
index bfac386..f09cf93 100644
---
a/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeRestTransportClient.java
+++
b/edge/edge-core/src/main/java/org/apache/servicecomb/edge/core/EdgeRestTransportClient.java
@@ -17,6 +17,7 @@
package org.apache.servicecomb.edge.core;
import org.apache.servicecomb.core.Invocation;
+import org.apache.servicecomb.foundation.vertx.client.ClientPoolManager;
import
org.apache.servicecomb.foundation.vertx.client.http.HttpClientWithContext;
import org.apache.servicecomb.transport.rest.client.RestTransportClient;
@@ -24,7 +25,8 @@ import io.vertx.core.Context;
public class EdgeRestTransportClient extends RestTransportClient {
@Override
- protected HttpClientWithContext findHttpClientPool(Invocation invocation) {
+ protected HttpClientWithContext
findHttpClientPool(ClientPoolManager<HttpClientWithContext> clientMgr,
+ Invocation invocation) {
Context invocationContext = (Context)
invocation.getHandlerContext().get(EdgeInvocation.EDGE_INVOCATION_CONTEXT);
return clientMgr.findClientPool(invocation.isSync(), invocationContext);
}
diff --git
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestTransportClient.java
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestTransportClient.java
index 5bd898a..ae7d28d 100644
---
a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestTransportClient.java
+++
b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestTransportClient.java
@@ -101,14 +101,13 @@ public class RestTransportClient {
public void send(Invocation invocation, AsyncResponse asyncResp) {
URIEndpointObject endpoint = (URIEndpointObject)
invocation.getEndpoint().getAddress();
- HttpClientWithContext httpClientWithContext;
+ ClientPoolManager<HttpClientWithContext> currentClientMgr = clientMgr;
if (endpoint.isHttp2Enabled()) {
- httpClientWithContext = findHttp2ClientPool(invocation);
- } else {
- httpClientWithContext = findHttpClientPool(invocation);
+ currentClientMgr = clientMgrHttp2;
}
+ HttpClientWithContext httpClientWithContext =
findHttpClientPool(currentClientMgr, invocation);
RestClientInvocation restClientInvocation = new
RestClientInvocation(httpClientWithContext, httpClientFilters);
try {
@@ -119,11 +118,8 @@ public class RestTransportClient {
}
}
- protected HttpClientWithContext findHttpClientPool(Invocation invocation) {
- return clientMgr.findClientPool(invocation.isSync());
- }
-
- public HttpClientWithContext findHttp2ClientPool(Invocation invocation) {
- return clientMgrHttp2.findClientPool(invocation.isSync());
+ protected HttpClientWithContext
findHttpClientPool(ClientPoolManager<HttpClientWithContext> currentClientMgr,
+ Invocation invocation) {
+ return currentClientMgr.findClientPool(invocation.isSync());
}
}