@@ -0,0 +1,1803 @@
+package io.hebert.autolock;%0A%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.locks.Condition;%0Aimport java.util.concurrent.locks.Lock;%0A%0A/**%0A * Wrapper for %7B@link Lock%7D instances to use them in the ARM context.%0A */%0Apublic class AutoLockWrapper implements AutoLock %7B%0A    private final Lock lock;%0A%0A    /**%0A     * Wraps the given Lock in an AutoLock.%0A     *%0A     * @param lock lock to wrap.%0A     */%0A    public AutoLockWrapper(Lock lock) %7B%0A        this.lock = lock;%0A    %7D%0A%0A    @Override%0A    public void lock() %7B%0A        lock.lock();%0A    %7D%0A%0A    @Override%0A    public void lockInterruptibly() throws InterruptedException %7B%0A        lock.lockInterruptibly();%0A    %7D%0A%0A    @Override%0A    public boolean tryLock() %7B%0A        return lock.tryLock();%0A    %7D%0A%0A    @Override%0A    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException %7B%0A        return lock.tryLock();%0A    %7D%0A%0A    @Override%0A    public AutoLock autoLock() %7B%0A        lock.lock();%0A        return this;%0A    %7D%0A%0A    @Override%0A    public AutoLock autoLockInterruptibly() throws InterruptedException %7B%0A        lock.lockInterruptibly();%0A        return this;%0A    %7D%0A%0A    @Override%0A    public AutoLock autoTryLock() throws TryLockFailedException %7B%0A        if (!lock.tryLock())%0A            throw new TryLockFailedException(this);%0A        return this;%0A    %7D%0A%0A    @Override%0A    public AutoLock autoTryLock(long time, TimeUnit unit) throws InterruptedException, TryLockFailedException %7B%0A        if (!lock.tryLock(time, unit))%0A            throw new TryLockFailedException(this);%0A        return this;%0A    %7D%0A%0A    @Override%0A    public void unlock() %7B%0A        lock.unlock();%0A    %7D%0A%0A    @Override%0A    public Condition newCondition() %7B%0A        return lock.newCondition();%0A    %7D%0A%0A    @Override%0A    public void close() %7B%0A        unlock();%0A    %7D%0A%7D%0A

Create a wrapper that will allow any Lock to be used in an ARM context