/*
 *
 * Copyright (c) 2001-2016 泛微软件.
 * 泛微协同商务系统,版权所有.
 * 
 */
package com.engine.kq.biz;
import com.engine.kq.log.KQLog;
import weaver.system.ThreadWork;
import weaver.system.ThreadWorkTimer;

import java.lang.Thread.UncaughtExceptionHandler;

/**
 * @version 1.0
 * @author 
 * [优化]考勤格式化线程偶发失效的问题（自动扫描失效后会自动启一个新的线程）
 */
public class KQFormatThreadManagerExceptionHandler implements UncaughtExceptionHandler {

	protected KQLog kqLog = new KQLog();
	
	  /**
	     * 线程异常后，重启线程
	     * @param t 异常线程对象
	     * @param e 异常对象
	     * @return
	   */
	 public void uncaughtException(Thread t, Throwable e)
	   {

//			 kqLog.writeLog("考勤格式化线程异常,重新启动...");
//			 kqLog.writeLog("An exception has been capturedn");
//			 kqLog.writeLog("Thread: " +t.getId());
//			 kqLog.writeLog("Exception: "+ e.getClass().getName());
//			 kqLog.writeLog("  "+ e.getMessage());
//			 kqLog.writeLog("Stack Trace: n");
//			 kqLog.writeLog("Thread status:"+t.getState());
//
//	     int hrmInterval = 30;   //30秒检查一次
//	     //ThreadWork KQFormatJob = new KQFormatJob();
//
//	     ThreadWorkTimer hrmThreadWorkTimer = new ThreadWorkTimer(hrmInterval, KQFormatJob,"KQFormatJob");
//
//	     hrmThreadWorkTimer.start();
	   }


}
