码迷,mamicode.com
首页 > 编程语言 > 详细

java-单例模式的java连接池

时间:2015-07-24 20:36:23      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

 1 package com.dawning.gridview.app.resourcemanagement.service.servicemanagement.discoverresourceutil;
 2 
 3 import java.util.concurrent.ExecutorService;
 4 import java.util.concurrent.Executors;
 5 
 6 /**
 7  * 线程池单例
 8  * @class SingletonTheadPool
 9  * @date 2015-7-7 下午3:29:04
10  * @author wanghc
11  */
12 public class SingletonTheadPool {
13     /**
14      * 单例
15      */
16     private static class SingletonHolder{
17         private static final ExecutorService MYPOOL = Executors.newFixedThreadPool(2);
18     }
19 
20     private SingletonTheadPool(){};
21 
22     public static final ExecutorService getSingletonTheadPool(){
23 
24         return SingletonHolder.MYPOOL;
25     }
26 
27 }

 

java-单例模式的java连接池

标签:

原文地址:http://www.cnblogs.com/My-Cloud/p/4674227.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!