mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync & commit in greenwich
This commit is contained in:
parent
695b374902
commit
f31b48a01f
@ -508,14 +508,17 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
|||||||
class NacosConfiguration {
|
class NacosConfiguration {
|
||||||
|
|
||||||
private final NamingService namingService;
|
private final NamingService namingService;
|
||||||
|
private final NacosDiscoveryProperties nacosDiscoveryProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the set of services is listening
|
* the set of services is listening.
|
||||||
*/
|
*/
|
||||||
private final Set<String> listeningServices;
|
private final Set<String> listeningServices;
|
||||||
|
|
||||||
NacosConfiguration(NacosNamingManager nacosNamingManager) {
|
NacosConfiguration(NacosNamingManager nacosNamingManager,
|
||||||
|
NacosDiscoveryProperties nacosDiscoveryProperties) {
|
||||||
this.namingService = nacosNamingManager.getNamingService();
|
this.namingService = nacosNamingManager.getNamingService();
|
||||||
|
this.nacosDiscoveryProperties = nacosDiscoveryProperties;
|
||||||
this.listeningServices = new ConcurrentSkipListSet<>();
|
this.listeningServices = new ConcurrentSkipListSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +544,8 @@ public class DubboServiceDiscoveryAutoConfiguration {
|
|||||||
private void subscribeEventListener(String serviceName) {
|
private void subscribeEventListener(String serviceName) {
|
||||||
if (listeningServices.add(serviceName)) {
|
if (listeningServices.add(serviceName)) {
|
||||||
try {
|
try {
|
||||||
namingService.subscribe(serviceName, event -> {
|
String group = nacosDiscoveryProperties.getGroup();
|
||||||
|
namingService.subscribe(serviceName, group, event -> {
|
||||||
if (event instanceof NamingEvent) {
|
if (event instanceof NamingEvent) {
|
||||||
NamingEvent namingEvent = (NamingEvent) event;
|
NamingEvent namingEvent = (NamingEvent) event;
|
||||||
List<ServiceInstance> serviceInstances = hostToServiceInstanceList(
|
List<ServiceInstance> serviceInstances = hostToServiceInstanceList(
|
||||||
|
@ -23,6 +23,7 @@ import io.seata.core.context.RootContext;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||||||
* And clean up Seata information after servlet method invocation in
|
* And clean up Seata information after servlet method invocation in
|
||||||
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
|
* {@link org.springframework.web.servlet.HandlerInterceptor#afterCompletion(HttpServletRequest, HttpServletResponse, Object, Exception)}
|
||||||
*/
|
*/
|
||||||
|
@ConditionalOnWebApplication
|
||||||
public class SeataHandlerInterceptor implements HandlerInterceptor {
|
public class SeataHandlerInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory
|
private static final Logger log = LoggerFactory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user