ThreadPool.java 1.81 KB
/**  
* @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;
	}

}