From 6b505dfd8d457f3a4386731f81d47669332d1c77 Mon Sep 17 00:00:00 2001 From: tanghc Date: Thu, 16 Jan 2020 09:46:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=81=B0=E5=BA=A6=E9=A2=84?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatewaycommon/zuul/loadbalancer/BaseServerChooser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/loadbalancer/BaseServerChooser.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/loadbalancer/BaseServerChooser.java index a452476f..e92a2fb2 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/loadbalancer/BaseServerChooser.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/loadbalancer/BaseServerChooser.java @@ -53,7 +53,7 @@ public abstract class BaseServerChooser extends ZoneAvoidanceRule { ILoadBalancer lb = getLoadBalancer(); // 获取服务实例列表 List servers = lb.getReachableServers(); - HttpServletRequest request = RequestContext.getCurrentContext().getRequest(); + RequestContext currentContext = RequestContext.getCurrentContext(); // 存放预发服务器 List preServers = new ArrayList<>(4); // 存放灰度发布服务器 @@ -77,11 +77,11 @@ public abstract class BaseServerChooser extends ZoneAvoidanceRule { return super.choose(key); } // 如果是从预发布域名访问过来,则认为是预发布请求 - if (this.isRequestFromPreDomain(request)) { + if (this.isRequestFromPreDomain(currentContext.getRequest())) { return doChoose(preServers, key); } // 如果是灰度请求 - if (this.isRequestGrayServer(RequestContext.getCurrentContext())) { + if (this.isRequestGrayServer(currentContext)) { return doChoose(grayServers, key); }