Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengJie1053 committed Mar 14, 2024
1 parent cff6add commit e6cb65b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

package org.apache.linkis.rpc.conf;

import org.springframework.stereotype.Component;

@Component
public interface CacheManualRefresher {
void refresh();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;

Expand All @@ -37,7 +37,7 @@
import org.slf4j.LoggerFactory;

@Component
@ConditionalOnProperty(name = "discovery", havingValue = "eureka")
@ConditionalOnClass(name = "org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration")
public class EurekaClientCacheManualRefresher implements CacheManualRefresher {
private static final Logger logger =
LoggerFactory.getLogger(EurekaClientCacheManualRefresher.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@

package org.apache.linkis.rpc.conf;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.stereotype.Component;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component
@ConditionalOnProperty(name = "discovery", havingValue = "nacos")
@ConditionalOnClass(name = "com.alibaba.cloud.nacos.registry.NacosServiceRegistryAutoConfiguration")
public class NacosClientCacheManualRefresher implements CacheManualRefresher {
private static final Logger logger =
LoggerFactory.getLogger(NacosClientCacheManualRefresher.class);

public void refresh() {
try {
logger.warn("Failed to obtain nacos metadata. Wait 3 seconds");
Thread.sleep(3000L);
logger.warn("Failed to obtain nacos metadata. Wait 100 milliseconds");
Thread.sleep(100L);
} catch (InterruptedException e) {

}
Expand Down
5 changes: 1 addition & 4 deletions linkis-dist/package/conf/application-engineconn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,4 @@ management:
include: refresh,info,health,metrics

logging:
config: classpath:log4j2.xml

#The default value is eureka, Optional value: eureka,nacos
discovery: eureka
config: classpath:log4j2.xml
5 changes: 1 addition & 4 deletions linkis-dist/package/conf/application-linkis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,4 @@ spring:
##disable kinif4j.production when you want to use apidoc during development
knife4j:
enable: true
production: true

#The default value is eureka, Optional value: eureka,nacos
discovery: eureka
production: true

0 comments on commit e6cb65b

Please sign in to comment.