// Path: src/main/java/com/ystruct.middleware/stormmq/broker/netty/Conf.java
// public class Conf {
//     public static int connNum = 199;
//     public static AtomicInteger producerNum = new AtomicInteger(0);
//     public static Map<String/*topic*/,String> producerMap = new HashMap<String, String>();
//     public static int initValue = 0;
//     public static void Increase(String topic){
//         synchronized (producerMap){
//             if(!producerMap.containsKey(topic)){
//                 producerNum.incrementAndGet();
//                 producerMap.put(topic,topic);
//             }
//         }
//     }
//     public static void Dcrease(String topic)
//     {
//         if(producerMap.containsKey(topic))
//         {
//             producerNum.decrementAndGet();
//             producerMap.remove(topic);
//         }
//     }
//     public static int getProducerNum()
//     {
//         return producerNum.get();
//     }
// }


import broker.netty.Conf;
import sun.security.util.DerEncoder;
import java.io.*;
import java.util.Date;
import java.util.Properties;
package tool;

/**
 * Created by yang on 16-12-1.
 */



/**
 * 日志工具类,使用了单例模式,保证只有一个实例,
 * 为了更方便的配置日志文件名,使用属性文件配置,
 * 也可以在程序指定日志文件名.
 */
public class LogWriter {
    //日志的配置文件
    public static final String LOG_CONFIGFILE_NAME = "/home/yang/log.properties";
    //日志文件名在配置文件中的标签
    public static final String LOGFILE_TAG_NAME = "logfile";
    //默认的日志文件的路径和文件名称
    private final String DEFAULT_LOG_FILE_NAME = "/"+System.getProperty("user.home")+"/output.log";
    //该类的唯一实例
    private static LogWriter logWriter;
    //文件的输出流
    private PrintWriter write;
    //日志文件名
    private String logFileName;

    private LogWriter(int version) throws Exception{
        this.init();
    }
    private LogWriter(String fileName) throws Exception{
        this.logFileName = fileName;
        this.init();
    }
    /**
     * 获取LogWriter的唯一实例
     */
    public synchronized  static LogWriter getLogWriter() throws Exception{
        if(logWriter == null){
// Path: src/main/java/com/ystruct.middleware/stormmq/broker/netty/Conf.java
// public class Conf {
//     public static int connNum = 199;
//     public static AtomicInteger producerNum = new AtomicInteger(0);
//     public static Map<String/*topic*/,String> producerMap = new HashMap<String, String>();
//     public static int initValue = 0;
//     public static void Increase(String topic){
//         synchronized (producerMap){
//             if(!producerMap.containsKey(topic)){
//                 producerNum.incrementAndGet();
//                 producerMap.put(topic,topic);
//             }
//         }
//     }
//     public static void Dcrease(String topic)
//     {
//         if(producerMap.containsKey(topic))
//         {
//             producerNum.decrementAndGet();
//             producerMap.remove(topic);
//         }
//     }
//     public static int getProducerNum()
//     {
//         return producerNum.get();
//     }
// }


// Path: src/main/java/com/ystruct.middleware/stormmq/tool/LogWriter.java
import broker.netty.Conf;
import sun.security.util.DerEncoder;
import java.io.*;
import java.util.Date;
import java.util.Properties;

package tool;

/**
 * Created by yang on 16-12-1.
 */



/**
 * 日志工具类,使用了单例模式,保证只有一个实例,
 * 为了更方便的配置日志文件名,使用属性文件配置,
 * 也可以在程序指定日志文件名.
 */
public class LogWriter {
    //日志的配置文件
    public static final String LOG_CONFIGFILE_NAME = "/home/yang/log.properties";
    //日志文件名在配置文件中的标签
    public static final String LOGFILE_TAG_NAME = "logfile";
    //默认的日志文件的路径和文件名称
    private final String DEFAULT_LOG_FILE_NAME = "/"+System.getProperty("user.home")+"/output.log";
    //该类的唯一实例
    private static LogWriter logWriter;
    //文件的输出流
    private PrintWriter write;
    //日志文件名
    private String logFileName;

    private LogWriter(int version) throws Exception{
        this.init();
    }
    private LogWriter(String fileName) throws Exception{
        this.logFileName = fileName;
        this.init();
    }
    /**
     * 获取LogWriter的唯一实例
     */
    public synchronized  static LogWriter getLogWriter() throws Exception{
        if(logWriter == null){
            System.out.println("getLogWriter:"+Conf.initValue++);