This commit is contained in:
@@ -138,7 +138,7 @@ public abstract class NodeServer {
|
|||||||
if (this.sncpGroup != null) this.resourceFactory.register(RESNAME_SERVER_GROUP, this.sncpGroup);
|
if (this.sncpGroup != null) this.resourceFactory.register(RESNAME_SERVER_GROUP, this.sncpGroup);
|
||||||
{
|
{
|
||||||
//设置root文件夹
|
//设置root文件夹
|
||||||
String webroot = config.getValue("root", "root");
|
String webroot = this.serverConf.getValue("root", "root");
|
||||||
File myroot = new File(webroot);
|
File myroot = new File(webroot);
|
||||||
if (!webroot.contains(":") && !webroot.startsWith("/")) {
|
if (!webroot.contains(":") && !webroot.startsWith("/")) {
|
||||||
myroot = new File(System.getProperty(Application.RESNAME_APP_HOME), webroot);
|
myroot = new File(System.getProperty(Application.RESNAME_APP_HOME), webroot);
|
||||||
@@ -150,13 +150,13 @@ public abstract class NodeServer {
|
|||||||
|
|
||||||
final String homepath = myroot.getCanonicalPath();
|
final String homepath = myroot.getCanonicalPath();
|
||||||
//加入指定的classpath
|
//加入指定的classpath
|
||||||
Server.loadLib(logger, config.getValue("lib", "").replace("${APP_HOME}", homepath) + ";" + homepath + "/lib/*;" + homepath + "/classes");
|
Server.loadLib(logger, this.serverConf.getValue("lib", "").replace("${APP_HOME}", homepath) + ";" + homepath + "/lib/*;" + homepath + "/classes");
|
||||||
}
|
}
|
||||||
//必须要进行初始化, 构建Service时需要使用Context中的ExecutorService
|
//必须要进行初始化, 构建Service时需要使用Context中的ExecutorService
|
||||||
server.init(config);
|
server.init(this.serverConf);
|
||||||
|
|
||||||
initResource(); //给 DataSource、CacheSource 注册依赖注入时的监听回调事件。
|
initResource(); //给 DataSource、CacheSource 注册依赖注入时的监听回调事件。
|
||||||
String interceptorClass = config.getValue("nodeInterceptor", "");
|
String interceptorClass = this.serverConf.getValue("nodeInterceptor", "");
|
||||||
if (!interceptorClass.isEmpty()) {
|
if (!interceptorClass.isEmpty()) {
|
||||||
Class clazz = forName(interceptorClass);
|
Class clazz = forName(interceptorClass);
|
||||||
this.interceptor = (NodeInterceptor) clazz.newInstance();
|
this.interceptor = (NodeInterceptor) clazz.newInstance();
|
||||||
@@ -282,9 +282,7 @@ public abstract class NodeServer {
|
|||||||
|| (this.sncpGroup == null && entry.isEmptyGroups()) //空的SNCP配置
|
|| (this.sncpGroup == null && entry.isEmptyGroups()) //空的SNCP配置
|
||||||
|| type.getAnnotation(LocalService.class) != null;//本地模式
|
|| type.getAnnotation(LocalService.class) != null;//本地模式
|
||||||
if (localed && (type.isInterface() || Modifier.isAbstract(type.getModifiers()))) continue; //本地模式不能实例化接口和抽象类的Service类
|
if (localed && (type.isInterface() || Modifier.isAbstract(type.getModifiers()))) continue; //本地模式不能实例化接口和抽象类的Service类
|
||||||
final Runnable runner = new Runnable() {
|
final Runnable runner = () -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
try {
|
||||||
Service service;
|
Service service;
|
||||||
if (localed) { //本地模式
|
if (localed) { //本地模式
|
||||||
@@ -314,7 +312,6 @@ public abstract class NodeServer {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if (entry.isExpect()) {
|
if (entry.isExpect()) {
|
||||||
ResourceFactory.ResourceLoader resourceLoader = (ResourceFactory rf, final Object src, final String resourceName, Field field, final Object attachment) -> {
|
ResourceFactory.ResourceLoader resourceLoader = (ResourceFactory rf, final Object src, final String resourceName, Field field, final Object attachment) -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user