摘要: @SuppressWarnings("restriction") public abstract class AbstractQueuedSynchronizer1 extends AbstractOwnableSynchronizer1 implements java.io.Serializable { private static final long serialVersionUI... 阅读全文
posted @ 2019-08-14 22:26 无天666 阅读(242) 评论(0) 推荐(0) 编辑
摘要: @SuppressWarnings("restriction") public class ReentrantReadWriteLock1 implements ReadWriteLock, java.io.Serializable { private static final long serialVersionUID = -6992448646407690164L; priv... 阅读全文
posted @ 2019-08-14 22:22 无天666 阅读(191) 评论(0) 推荐(0) 编辑
摘要: public class ReentrantLock1 implements Lock, java.io.Serializable { private static final long serialVersionUID = 7373984872572414699L; //创建一个ReentrantLock1里面有一个sync,里面有一个state和队列。 //多个线程竞... 阅读全文
posted @ 2019-08-14 22:21 无天666 阅读(142) 评论(0) 推荐(0) 编辑
摘要: public class CyclicBarrierExample3 { private static CyclicBarrier1 barrier = new CyclicBarrier1(3, new Runnable() { @Override public void run() { System.out.printl... 阅读全文
posted @ 2019-08-14 22:19 无天666 阅读(126) 评论(0) 推荐(0) 编辑
摘要: public class CountDownLatchExample1 { public static void main(String[] args) throws Exception { ExecutorService exec = Executors1.newCachedThreadPool(); final CountDownLatch1 coun... 阅读全文
posted @ 2019-08-14 14:56 无天666 阅读(221) 评论(0) 推荐(0) 编辑
摘要: public class SemaphoreExample1 { private final static int threadCount = 20; public static void main(String[] args) throws Exception { ExecutorService exec = Executors1.newCachedThrea... 阅读全文
posted @ 2019-08-14 11:36 无天666 阅读(271) 评论(0) 推荐(0) 编辑