摘要:
wait 和notify 在 synchronized 包含的范围中 必须与synchronized 使用同一个对象可以在一个锁中设定 多个 condition 来执行等待的方法,这样的好处就是能实现多个方法之间的等待执行。例如下面例子 的两个conditionclass BoundedBuffer... 阅读全文
posted @ 2014-09-05 08:49
mxyhws
阅读(176)
评论(0)
推荐(0)
摘要:
public class CacheDemo { private Map cache = new HashMap(); public static void main(String[] args) { // TODO Auto-generated method stub } private Read... 阅读全文
posted @ 2014-09-05 08:48
mxyhws
阅读(136)
评论(0)
推荐(0)
摘要:
public class LockTest { /** * @param args */ public static void main(String[] args) { new LockTest().init(); } private void init(){ final Outputer out... 阅读全文
posted @ 2014-09-05 08:47
mxyhws
阅读(1035)
评论(0)
推荐(0)
摘要:
创建固定大小的线程池 ExecutorService threadPool = Executors.newFixedThreadPool(3);创建缓存线程池 ExecutorService threadPool = Executors.newCachedThreadPool(3);创建单一线程池 ... 阅读全文
posted @ 2014-09-05 08:45
mxyhws
阅读(211)
评论(0)
推荐(0)

浙公网安备 33010602011771号