ThreadPool.java
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* @Title: ThreadPool.java
* @Package com.bjivt.web.thread
* @Description: TODO(用一句话描述该文件做什么)
* @author Yh.T
* @date 2016年9月27日 下午5:16:49
* @version
*/
package com.bjivt.web.thread;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
/**
* 项目名称:admin
*
* 类描述:
* 类名称:com.bjivt.web.thread.ThreadPool
* Yh.T
* 创建时间:2016年9月27日 下午5:16:49
* 修改备注:
* @version
*/
public class ThreadPool {
private static ThreadPool _instance = new ThreadPool();
private ConcurrentHashMap<Integer, SystemNoticeThread> noticeMap = new ConcurrentHashMap<Integer, SystemNoticeThread>();
private ConcurrentHashMap<Integer, ScheduledExecutorService> serviceMap = new ConcurrentHashMap<Integer, ScheduledExecutorService>();
public static ThreadPool getInstance(){
return _instance;
}
private ThreadPool(){}
public SystemNoticeThread getNotice(Integer id){
return noticeMap.get(id);
}
public void putNotice(Integer id, SystemNoticeThread notice){
noticeMap.put(id, notice);
}
public ConcurrentHashMap<Integer, SystemNoticeThread> getNoticeMap() {
return noticeMap;
}
public void setNoticeMap(ConcurrentHashMap<Integer, SystemNoticeThread> noticeMap) {
this.noticeMap = noticeMap;
}
public void putServiceThread(Integer id, ScheduledExecutorService service){
serviceMap.put(id, service);
}
public ScheduledExecutorService getServiceThread(Integer id){
return serviceMap.get(id);
}
public ConcurrentHashMap<Integer, ScheduledExecutorService> getServiceMap() {
return serviceMap;
}
public void setServiceMap(ConcurrentHashMap<Integer, ScheduledExecutorService> serviceMap) {
this.serviceMap = serviceMap;
}
}