12345678910111213141516171819202122232425262728293031323334 |
- package com.yihu.ehr.thread;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * Created by chenweida on 2016/3/2.
- */
- public class ThreadManage {
- public static String LOG_THREAD = "logThread";
- public static String SQL_THREAD = "sqlThread";
- public static String UPDATE_THREAD = "UpdateThread";
- public static boolean logIsRunning = true;
- public static boolean sqlIsRunning = true;
- public static boolean updateIsRunning = true;
- private static Map<String, Thread> threadPool = new HashMap<String, Thread>();
- public static void add(String threadId, Thread thread) {
- threadPool.put(threadId, thread);
- }
- public static Thread get(String threadId) {
- return threadPool.get(threadId);
- }
- //把所有的线程的有效标示设置成false
- public static void stopAllThread() {
- logIsRunning = false;
- sqlIsRunning = false;
- updateIsRunning = false;
- }
- }
|