This commit is contained in:
@@ -37,7 +37,9 @@ import org.w3c.dom.*;
|
|||||||
* 最后进行Service、Servlet与其他资源之间的依赖注入。
|
* 最后进行Service、Servlet与其他资源之间的依赖注入。
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* <p> 详情见: http://www.redkale.org
|
* <p>
|
||||||
|
* 详情见: http://www.redkale.org
|
||||||
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public final class Application {
|
public final class Application {
|
||||||
@@ -69,21 +71,21 @@ public final class Application {
|
|||||||
//当前Service所属的组 类型: Set<String>、String[]
|
//当前Service所属的组 类型: Set<String>、String[]
|
||||||
public static final String RESNAME_SNCP_GROUPS = Sncp.RESNAME_SNCP_GROUPS; // SNCP_GROUPS
|
public static final String RESNAME_SNCP_GROUPS = Sncp.RESNAME_SNCP_GROUPS; // SNCP_GROUPS
|
||||||
|
|
||||||
protected final Map<InetSocketAddress, String> globalNodes = new HashMap<>();
|
final Map<InetSocketAddress, String> globalNodes = new HashMap<>();
|
||||||
|
|
||||||
private final Map<String, Set<InetSocketAddress>> globalGroups = new HashMap<>();
|
final Map<String, Set<InetSocketAddress>> globalGroups = new HashMap<>();
|
||||||
|
|
||||||
protected final List<Transport> transports = new ArrayList<>();
|
final List<Transport> transports = new ArrayList<>();
|
||||||
|
|
||||||
protected final InetAddress localAddress;
|
final InetAddress localAddress;
|
||||||
|
|
||||||
protected final List<CacheSource> cacheSources = new CopyOnWriteArrayList<>();
|
final List<CacheSource> cacheSources = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
protected final List<DataSource> dataSources = new CopyOnWriteArrayList<>();
|
final List<DataSource> dataSources = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
protected final List<NodeServer> servers = new CopyOnWriteArrayList<>();
|
final List<NodeServer> servers = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
protected CountDownLatch servicecdl; //会出现两次赋值
|
CountDownLatch servicecdl; //会出现两次赋值
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------
|
||||||
private final ResourceFactory factory = ResourceFactory.root();
|
private final ResourceFactory factory = ResourceFactory.root();
|
||||||
|
|||||||
@@ -16,13 +16,17 @@ import java.util.logging.*;
|
|||||||
import java.util.logging.Formatter;
|
import java.util.logging.Formatter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义的日志存储类
|
* 自定义的日志输出类
|
||||||
* <p>
|
* <p>
|
||||||
* <p> 详情见: http://www.redkale.org
|
* 详情见: http://www.redkale.org
|
||||||
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public class LogFileHandler extends Handler {
|
public class LogFileHandler extends Handler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SNCP的日志输出Handler
|
||||||
|
*/
|
||||||
public static class SncpLogFileHandler extends LogFileHandler {
|
public static class SncpLogFileHandler extends LogFileHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -31,6 +35,10 @@ public class LogFileHandler extends Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认的日志时间格式化类
|
||||||
|
*
|
||||||
|
*/
|
||||||
public static class LoggingFormater extends Formatter {
|
public static class LoggingFormater extends Formatter {
|
||||||
|
|
||||||
private static final String format = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%tL %4$s %2$s\r\n%5$s%6$s\r\n";
|
private static final String format = "%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%tL %4$s %2$s\r\n%5$s%6$s\r\n";
|
||||||
|
|||||||
@@ -8,13 +8,17 @@ package org.redkale.boot;
|
|||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 根据application.xml中的server节点中的protocol值来适配Server的加载逻辑
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* 详情见: http://www.redkale.org
|
||||||
*
|
*
|
||||||
* <p> 详情见: http://www.redkale.org
|
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
@Target({ElementType.TYPE})
|
@Target({ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Documented
|
@Documented
|
||||||
public @interface NodeProtocol {
|
public @interface NodeProtocol {
|
||||||
|
|
||||||
String[] value();
|
String[] value();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,21 +30,29 @@ import org.redkale.util.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* <p> 详情见: http://www.redkale.org
|
* <p>
|
||||||
|
* 详情见: http://www.redkale.org
|
||||||
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public abstract class NodeServer {
|
public abstract class NodeServer {
|
||||||
|
|
||||||
|
//INFO日志的换行符
|
||||||
public static final String LINE_SEPARATOR = "\r\n";
|
public static final String LINE_SEPARATOR = "\r\n";
|
||||||
|
|
||||||
|
//日志输出对象
|
||||||
protected final Logger logger;
|
protected final Logger logger;
|
||||||
|
|
||||||
|
//日志是否为FINE级别
|
||||||
protected final boolean fine;
|
protected final boolean fine;
|
||||||
|
|
||||||
|
//进程主类
|
||||||
protected final Application application;
|
protected final Application application;
|
||||||
|
|
||||||
|
//依赖注入工厂类
|
||||||
protected final ResourceFactory factory;
|
protected final ResourceFactory factory;
|
||||||
|
|
||||||
|
//当前Server对象
|
||||||
protected final Server server;
|
protected final Server server;
|
||||||
|
|
||||||
private String sncpGroup = null; //当前Server的SNCP协议的组
|
private String sncpGroup = null; //当前Server的SNCP协议的组
|
||||||
|
|||||||
Reference in New Issue
Block a user