@@ -0,0 +1,1086 @@
+package edu.ptu.test.concurence;%0A%0Aimport java.util.Objects;%0Aimport java.util.concurrent.locks.Condition;%0Aimport java.util.concurrent.locks.Lock;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0A/**%0A * Created by anshu.wang on 2016/3/29.%0A */%0Apublic class LockTest %7B%0A    private int a;%0A    private int b;%0A    private Object o = new Object();%0A    private Lock l = new ReentrantLock();%0A%0A    public void testSynchronized() %7B%0A        synchronized (LockTest.this) %7B%0A            a++;%0A        %7D%0A    %7D%0A%0A    public void testLock() %7B%0A        l.lock();%0A        try %7B%0A%0A        %7D catch (Exception e) %7B%0A        %7D finally %7B%0A            l.unlock();%0A        %7D%0A        try %7B%0A            Condition condition = l.newCondition();%0A            a++;%0A            condition.await();%0A            b++;%0A            condition.signalAll();%0A        %7D catch (Exception e) %7B%0A%0A        %7D%0A    %7D%0A%0A    public void testObjectWait() %7B%0A        try %7B%0A%0A            a++;%0A            o.wait();%0A            b++;%0A            o.notifyAll();%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%0A%7D%0A

test Lock Signed-off-by: anshu.wang <anshu.wang.work@gmail.com>