文章分类 -  JAVA

摘要:在公司接触到Collections.unmodifiableList(List list)) 觉得用法挺特殊的,所以学习了下,简单而言,看名字就知道,将参数中的List返回一个不可修改的List.觉得以下这篇文章写得很好,说 明了它的应用场景。--------------------------------------------------------------------------------------在《重构——改善既有代码的设计》一书中,有一种重构手法叫EncapsulateCollection(封装集群),为了演示该重构手法,我写了四个类,通过对比重构前后的代码,加深对这一重构 阅读全文
posted @ 2013-09-10 09:30 xumin_minzi 阅读(167) 评论(0) 推荐(0)
摘要:本文转自http://blog.csdn.net/wangwenhui11/article/details/6760474private static ExecutorService exec = new ThreadPoolExecutor(8, 8, 0L,TimeUnit.MILLISECONDS, new LinkedBlockingQueue(100000),new ThreadPoolExecutor.CallerRunsPolicy());一、简介 线程池类为 java.util.concurrent.ThreadPoolExecutor,常用构造方法为: ThreadPoolE 阅读全文
posted @ 2013-09-06 16:18 xumin_minzi 阅读(68) 评论(0) 推荐(0)
摘要:CountDownLatch,一个同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待。主要方法 public CountDownLatch(int count); public void countDown(); public void await() throws InterruptedException 构造方法参数指定了计数的次数countDown方法,当前线程调用此方法,则计数减一awaint方法,调用此方法会一直阻塞当前线程,直到计时器的值为0 例子Java代码 收藏代码 public class CountDownLatchDemo { ... 阅读全文
posted @ 2013-09-06 16:09 xumin_minzi 阅读(93) 评论(0) 推荐(0)