package cn.hmsoft.frame.timer;

import cn.hmsoft.frame.module.FrameModuleConfig;

public class TimerModuleConfig extends FrameModuleConfig {

	/*********************************
	 * 定时器是否以守护进程模式
	 */

	public static String FrameTimerThreadDaemon = "true";

	/*********************************
	 * 定时器最大的线程数目
	 */

	public static int FrameTimerThreadCount = 100;

	@Override
	public String setModule_name() {
		return "FrameTimer";
	}

	@Override
	public String setModule_version() {
		return "1.0.0";
	}

	@Override
	protected boolean start() throws Exception {
		FrameTimerThreadDaemon = this.getModule().getParamMap().getOrDefault("FrameTimerThreadDaemon",
				FrameTimerThreadDaemon);
		try {
			FrameTimerThreadCount = Integer.parseInt(
					this.getModule().getParamMap().getOrDefault("FrameTimerThreadCount", FrameTimerThreadCount + ""));
		} catch (Exception e) {

		}
		FrameTimerUtil.getInstance();
		return true;
	}

	@Override
	protected boolean stop() throws Exception {
		return FrameTimerUtil.getInstance().shutdown();
	}

}
