Let nacos-server.jar import external jar package
This commit is contained in:
parent
ef7e250675
commit
6695805c69
@ -104,6 +104,7 @@
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<mainClass>com.alibaba.nacos.Nacos</mainClass>
|
||||
<layout>ZIP</layout>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -35,9 +35,8 @@ if not "%2" == "cluster" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
|
||||
)
|
||||
|
||||
set "JAVA_OPT=%JAVA_OPT% -Xbootclasspath/a:%BASE_DIR%\plugins\cmdb"
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.home=%BASE_DIR%"
|
||||
set "JAVA_OPT=%JAVA_OPT% -jar %BASE_DIR%\target\nacos-server.jar"
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dloader.path=%BASE_DIR%/plugins/health/nacos-health-plugin-example-1.0.jar -jar %BASE_DIR%\target\nacos-server.jar"
|
||||
set "JAVA_OPT=%JAVA_OPT% --spring.config.location=%CUSTOM_SEARCH_LOCATIONS%"
|
||||
set "JAVA_OPT=%JAVA_OPT% --logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
||||
|
||||
|
@ -102,7 +102,7 @@ else
|
||||
fi
|
||||
|
||||
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
|
||||
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar"
|
||||
JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/plugins/health/nacos-health-plugin-example-1.0.jar -jar ${BASE_DIR}/target/nacos-server.jar"
|
||||
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
|
||||
JAVA_OPT="${JAVA_OPT} --spring.config.location=${CUSTOM_SEARCH_LOCATIONS}"
|
||||
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
|
||||
|
@ -19,6 +19,8 @@ import com.alibaba.nacos.api.naming.pojo.AbstractHealthChecker;
|
||||
import com.alibaba.nacos.naming.healthcheck.HealthCheckProcessor;
|
||||
import com.alibaba.nacos.naming.healthcheck.HealthCheckType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
@ -36,6 +38,8 @@ import java.util.Set;
|
||||
@Component
|
||||
public class HealthCheckExtendProvider implements BeanFactoryAware {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HealthCheckExtendProvider.class);
|
||||
|
||||
private ServiceLoader<HealthCheckProcessor> processorLoader
|
||||
= ServiceLoader.load(HealthCheckProcessor.class);
|
||||
|
||||
@ -75,9 +79,7 @@ public class HealthCheckExtendProvider implements BeanFactoryAware {
|
||||
AbstractHealthChecker checker = healthCheckerIt.next();
|
||||
String type = checker.getType();
|
||||
if(healthCheckerType.contains(type)){
|
||||
if(processorType.contains(type)){
|
||||
throw new RuntimeException("More than one healthChecker of the same type was found : [type=\"" + type + "\"]");
|
||||
}
|
||||
throw new RuntimeException("More than one healthChecker of the same type was found : [type=\"" + type + "\"]");
|
||||
}
|
||||
healthCheckerType.add(type);
|
||||
HealthCheckType.registerHealthChecker(checker.getType(), checker.getClass());
|
||||
@ -85,6 +87,10 @@ public class HealthCheckExtendProvider implements BeanFactoryAware {
|
||||
if(!processorType.equals(healthCheckerType)){
|
||||
throw new RuntimeException("An unmatched processor and healthChecker are detected in the extension package.");
|
||||
}
|
||||
if(processorType.size() > origin.size()){
|
||||
processorType.removeAll(origin);
|
||||
LOGGER.debug("init health plugin : types=" + processorType);
|
||||
}
|
||||
}
|
||||
|
||||
private String lowerFirstChar(String simpleName) {
|
||||
|
Loading…
Reference in New Issue
Block a user