@@ -0,0 +1,709 @@
+package lock;%0A%0Apublic class Lock %7B%0A    private Thread lockedBy = null;%0A    private int lockedCount = 0;%0A%0A    public void lock() throws InterruptedException %7B%0A        synchronized (this) %7B%0A            Thread callingThread = Thread.currentThread();%0A            while (this.lockedBy != callingThread) %7B%0A                wait();%0A            %7D%0A%0A            this.lockedCount++;%0A            this.lockedBy = callingThread;%0A        %7D%0A    %7D%0A%0A    public void unlock() %7B%0A        synchronized (this) %7B%0A            if (Thread.currentThread() == this.lockedBy) %7B%0A                this.lockedCount--;%0A%0A                if (this.lockedCount == 0) %7B%0A                    notify();%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

add my lock