parent
8b64314d95
commit
d7da61c394
@ -1,2 +1,2 @@
|
||||
/com/
|
||||
/dataSystem.properties
|
||||
/com
|
||||
/spring-applicationContext-test.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,68 +0,0 @@
|
||||
package com.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.base.Constant;
|
||||
|
||||
/**
|
||||
* @描述 写入异常--进文件system_exception.txt
|
||||
* @author chen
|
||||
* @date 2016年8月30日
|
||||
* @package com.utils.exception
|
||||
*/
|
||||
public class WritefileThread extends Thread implements Runnable{
|
||||
|
||||
/** 存储异常信息 */
|
||||
private static List<String> strArray = new ArrayList<>();
|
||||
|
||||
/** 是否继续运行 */
|
||||
private static boolean isContinue = true;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
while(isContinue){
|
||||
try {
|
||||
Thread.sleep(Constant.THREAD_SLEEP_WRITEFILETHREAD);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
synchronized (strArray) {
|
||||
//同步代码--写入日志
|
||||
String str = array2Str(strArray);
|
||||
//TODO FileOperate.appendWriteFile(str, Constant.SYSTEM_EXCEPTION_FILEPATH);
|
||||
strArray.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @功能 获得strArray
|
||||
* @return strArray
|
||||
*/
|
||||
public static List<String> getStrArray() {
|
||||
return strArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能 设置 isContinue
|
||||
* @param isContinue
|
||||
*/
|
||||
public static void setContinue(boolean isContinue) {
|
||||
WritefileThread.isContinue = isContinue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能 list --> String
|
||||
* @param array arrayList
|
||||
* @return String
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static String array2Str(List array) {
|
||||
StringBuffer sbuf = new StringBuffer();
|
||||
for (Object object : array) {
|
||||
sbuf.append(object);
|
||||
}
|
||||
return sbuf.toString();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue