@@ -0,0 +1,1109 @@
+package juc.aqs;%0A%0A/**%0A * Created by %E6%9D%8E%E6%81%92%E5%90%8D on 2017/6/22.%0A */%0Apublic class MutexLockTest %7B%0A    public static void main(String%5B%5D args) %7B%0A        TestTask test = new TestTask();%0A        new Thread(() -%3E test.method1()).start();%0A        new Thread(() -%3E test.method2()).start();%0A%0A        /**%0A         %E8%BE%93%E5%87%BA%EF%BC%9A%0A         method1() execute!%0A         method2() execute!%0A%0A         %E4%B8%8D%E5%8A%A0%E9%94%81%E7%9A%84%E8%AF%9D%EF%BC%9A%0A         method2() execute!%0A         method1() execute!%0A         */%0A    %7D%0A%0A    static class TestTask %7B%0A        private MutexLock lock = new MutexLock();%0A%0A        public void method1() %7B%0A            lock.lock();%0A            try %7B%0A                //%E6%A8%A1%E6%8B%9F%E6%96%B9%E6%B3%95%E9%9C%80%E8%A6%81%E6%89%A7%E8%A1%8C100%E6%AF%AB%E7%A7%92%0A                Thread.sleep(100);%0A                System.out.println(%22method1() execute!%22);%0A            %7D catch (InterruptedException e) %7B%0A                e.printStackTrace();%0A            %7D finally %7B%0A                lock.unlock();%0A            %7D%0A        %7D%0A%0A        public void method2() %7B%0A            lock.lock();%0A            try %7B%0A                System.out.println(%22method2() execute!%22);%0A            %7D finally %7B%0A                lock.unlock();%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

update > juc AQS test code