This commit is contained in:
wentch
2016-01-04 17:06:52 +08:00
parent b6c20436da
commit e75dab5cc8
4 changed files with 35 additions and 13 deletions

View File

@@ -37,7 +37,9 @@ import org.w3c.dom.*;
* 最后进行Service、Servlet与其他资源之间的依赖注入。
*
*
* <p> 详情见: http://www.redkale.org
* <p>
* 详情见: http://www.redkale.org
*
* @author zhangjx
*/
public final class Application {
@@ -69,21 +71,21 @@ public final class Application {
//当前Service所属的组 类型: Set<String>、String[]
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();

View File

@@ -16,13 +16,17 @@ import java.util.logging.*;
import java.util.logging.Formatter;
/**
* 自定义的日志存储
* 自定义的日志输出
* <p>
* <p> 详情见: http://www.redkale.org
* 详情见: http://www.redkale.org
*
* @author zhangjx
*/
public class LogFileHandler extends Handler {
/**
* SNCP的日志输出Handler
*/
public static class SncpLogFileHandler extends LogFileHandler {
@Override
@@ -31,6 +35,10 @@ public class LogFileHandler extends Handler {
}
}
/**
* 默认的日志时间格式化类
*
*/
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";

View File

@@ -8,13 +8,17 @@ package org.redkale.boot;
import java.lang.annotation.*;
/**
* 根据application.xml中的server节点中的protocol值来适配Server的加载逻辑
*
* <p>
* 详情见: http://www.redkale.org
*
* <p> 详情见: http://www.redkale.org
* @author zhangjx
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface NodeProtocol {
String[] value();
}

View File

@@ -30,21 +30,29 @@ import org.redkale.util.*;
/**
*
* <p> 详情见: http://www.redkale.org
* <p>
* 详情见: http://www.redkale.org
*
* @author zhangjx
*/
public abstract class NodeServer {
//INFO日志的换行符
public static final String LINE_SEPARATOR = "\r\n";
//日志输出对象
protected final Logger logger;
//日志是否为FINE级别
protected final boolean fine;
//进程主类
protected final Application application;
//依赖注入工厂类
protected final ResourceFactory factory;
//当前Server对象
protected final Server server;
private String sncpGroup = null; //当前Server的SNCP协议的组