fix: move the RemoteConfigFileRepo destroy hook to the Polaris config module. (#1111)

pull/1117/head
qingliu 1 year ago committed by GitHub
parent 717d08b348
commit 975003fa9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,12 +27,14 @@ import com.tencent.cloud.polaris.config.adapter.PolarisRefreshEntireContextRefre
import com.tencent.cloud.polaris.config.annotation.PolarisConfigAnnotationProcessor; import com.tencent.cloud.polaris.config.annotation.PolarisConfigAnnotationProcessor;
import com.tencent.cloud.polaris.config.condition.ConditionalOnReflectRefreshType; import com.tencent.cloud.polaris.config.condition.ConditionalOnReflectRefreshType;
import com.tencent.cloud.polaris.config.config.PolarisConfigProperties; import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import com.tencent.cloud.polaris.config.listener.PolarisConfigApplicationEventListener;
import com.tencent.cloud.polaris.config.listener.PolarisConfigChangeEventListener; import com.tencent.cloud.polaris.config.listener.PolarisConfigChangeEventListener;
import com.tencent.cloud.polaris.config.listener.PolarisConfigRefreshOptimizationListener; import com.tencent.cloud.polaris.config.listener.PolarisConfigRefreshOptimizationListener;
import com.tencent.cloud.polaris.config.logger.PolarisConfigLoggerApplicationListener; import com.tencent.cloud.polaris.config.logger.PolarisConfigLoggerApplicationListener;
import com.tencent.cloud.polaris.config.spring.annotation.SpringValueProcessor; import com.tencent.cloud.polaris.config.spring.annotation.SpringValueProcessor;
import com.tencent.cloud.polaris.config.spring.property.PlaceholderHelper; import com.tencent.cloud.polaris.config.spring.property.PlaceholderHelper;
import com.tencent.cloud.polaris.config.spring.property.SpringValueRegistry; import com.tencent.cloud.polaris.config.spring.property.SpringValueRegistry;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@ -120,5 +122,10 @@ public class PolarisConfigAutoConfiguration {
public PolarisConfigRefreshOptimizationListener polarisConfigRefreshOptimizationListener() { public PolarisConfigRefreshOptimizationListener polarisConfigRefreshOptimizationListener() {
return new PolarisConfigRefreshOptimizationListener(); return new PolarisConfigRefreshOptimizationListener();
} }
@Bean
public PolarisConfigApplicationEventListener polarisContextApplicationEventListener(PolarisSDKContextManager polarisSDKContextManager) {
return new PolarisConfigApplicationEventListener(polarisSDKContextManager);
}
} }
} }

@ -16,7 +16,7 @@
* *
*/ */
package com.tencent.cloud.polaris.context.listener; package com.tencent.cloud.polaris.config.listener;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager; import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
import com.tencent.polaris.configuration.client.internal.RemoteConfigFileRepo; import com.tencent.polaris.configuration.client.internal.RemoteConfigFileRepo;
@ -33,11 +33,11 @@ import org.springframework.lang.NonNull;
* @author shuiqingliu * @author shuiqingliu
* @since 2023/8/29 * @since 2023/8/29
**/ **/
public class PolarisContextApplicationEventListener implements ApplicationListener<ApplicationEvent> { public class PolarisConfigApplicationEventListener implements ApplicationListener<ApplicationEvent> {
private final PolarisSDKContextManager polarisSDKContextManager; private final PolarisSDKContextManager polarisSDKContextManager;
public PolarisContextApplicationEventListener(PolarisSDKContextManager polarisSDKContextManager) { public PolarisConfigApplicationEventListener(PolarisSDKContextManager polarisSDKContextManager) {
this.polarisSDKContextManager = polarisSDKContextManager; this.polarisSDKContextManager = polarisSDKContextManager;
} }

@ -25,7 +25,6 @@ import com.tencent.cloud.polaris.context.ModifyAddress;
import com.tencent.cloud.polaris.context.PolarisConfigModifier; import com.tencent.cloud.polaris.context.PolarisConfigModifier;
import com.tencent.cloud.polaris.context.PolarisSDKContextManager; import com.tencent.cloud.polaris.context.PolarisSDKContextManager;
import com.tencent.cloud.polaris.context.ServiceRuleManager; import com.tencent.cloud.polaris.context.ServiceRuleManager;
import com.tencent.cloud.polaris.context.listener.PolarisContextApplicationEventListener;
import com.tencent.polaris.api.exception.PolarisException; import com.tencent.polaris.api.exception.PolarisException;
import com.tencent.polaris.client.api.SDKContext; import com.tencent.polaris.client.api.SDKContext;
@ -59,9 +58,4 @@ public class PolarisContextAutoConfiguration {
public ServiceRuleManager serviceRuleManager(PolarisSDKContextManager polarisSDKContextManager) { public ServiceRuleManager serviceRuleManager(PolarisSDKContextManager polarisSDKContextManager) {
return new ServiceRuleManager(polarisSDKContextManager.getSDKContext(), polarisSDKContextManager.getConsumerAPI()); return new ServiceRuleManager(polarisSDKContextManager.getSDKContext(), polarisSDKContextManager.getConsumerAPI());
} }
@Bean
public PolarisContextApplicationEventListener polarisContextApplicationEventListener(PolarisSDKContextManager polarisSDKContextManager) {
return new PolarisContextApplicationEventListener(polarisSDKContextManager);
}
} }

Loading…
Cancel
Save