From d4caaae53d8880d760cdf26382cc45d396f3987c Mon Sep 17 00:00:00 2001 From: moremind Date: Mon, 23 Oct 2023 09:52:16 +0800 Subject: [PATCH] [type:fix] e2e test error --- .../shenyu/sync/data/http/HttpSyncDataService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/HttpSyncDataService.java b/shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/HttpSyncDataService.java index 114ef268a86c..209b463fdee8 100644 --- a/shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/HttpSyncDataService.java +++ b/shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/HttpSyncDataService.java @@ -39,6 +39,7 @@ import org.apache.shenyu.sync.data.http.refresh.DataRefreshFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -60,7 +61,7 @@ /** * HTTP long polling implementation. */ -public class HttpSyncDataService implements SyncDataService { +public class HttpSyncDataService implements SyncDataService, InitializingBean { /** * logger. @@ -94,7 +95,6 @@ public HttpSyncDataService(final HttpConfig httpConfig, this.factory = new DataRefreshFactory(pluginDataSubscriber, metaDataSubscribers, authDataSubscribers, proxySelectorDataSubscribers, discoveryUpstreamDataSubscribers); this.serverList = Lists.newArrayList(Splitter.on(",").split(httpConfig.getUrl())); this.restTemplate = restTemplate; - this.start(); } private void start() { @@ -215,7 +215,12 @@ public void close() { executor = null; } } - + + @Override + public void afterPropertiesSet() throws Exception { + this.start(); + } + class HttpLongPollingTask implements Runnable { private final String server;