Commit 036fa8d9 authored by yanzg's avatar yanzg

多线程处理配置

parent a88d4829
package com.yanzuoguang.util.extend;
import com.yanzuoguang.util.log.RunnableLog;
/**
* 配置参数
*/
public class Config {
public class ConfigBase {
/**
* 打印线程相关参数
*/
public static final boolean PrintThread = false;
/**
* 写入日志对象
*/
public static RunnableLog WriteLog;
}
package com.yanzuoguang.util.log;
import com.yanzuoguang.util.extend.ConfigBase;
import java.util.Date;
import java.util.HashMap;
......@@ -8,8 +10,6 @@ import java.util.HashMap;
*/
public class Log {
public static RunnableLog writeLog;
/**
* 当前线程缓存的对象
*/
......@@ -95,8 +95,8 @@ public class Log {
date.commit();
info.setTime((long) date.getLastSecond());
info.setTotalTime((long) date.getTotalSecond());
if (writeLog != null) {
writeLog.run(info);
if (ConfigBase.WriteLog != null) {
ConfigBase.WriteLog.run(info);
} else {
writeLogDefault.run(info);
}
......
package com.yanzuoguang.util.thread;
import com.yanzuoguang.util.extend.Config;
import com.yanzuoguang.util.extend.ConfigBase;
import com.yanzuoguang.util.log.Log;
import java.util.Date;
......@@ -57,7 +57,7 @@ public class ThreadWait {
}
this.stopPrint();
}
if (Config.PrintThread) {
if (ConfigBase.PrintThread) {
Log.info(ThreadWait.class, "客户端结束时间");
}
}
......@@ -78,7 +78,7 @@ public class ThreadWait {
public synchronized void finish() {
if (this.execute.isFinally()) {
this.notify();
if (Config.PrintThread) {
if (ConfigBase.PrintThread) {
Log.info(ThreadWait.class, "客户端结束时间");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment