@@ -0,0 +1,890 @@
+package com.speed.service.threads;%0A%0A%0Aimport java.util.concurrent.locks.Condition;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0Aimport java.util.concurrent.TimeUnit;%0A%0A/**%0A * User: gais.ch%0A * Date: 15/5/27%0A * Time: %E4%B8%8A%E5%8D%889:42%0A */%0Apublic class TestFrom %7B%0A%0A    /**%0A     * Lock held by take, poll, etc%0A     */%0A    private final ReentrantLock takeLock = new ReentrantLock();%0A    /**%0A     * Wait queue for waiting takes%0A     */%0A    private final Condition notEmpty = takeLock.newCondition();%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A    %7D%0A%0A    public void test1() %7B%0A        try %7B%0A            notEmpty.await(10, TimeUnit.SECONDS);%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A    public void test2() %7B%0A        try %7B%0A            Thread.sleep(10000);%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

add lock test