diff -r 000000000000 -r 3905a2e66b9b samples/reentrant/src/org/apidesign/reentrant/NonReentrantLock.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/reentrant/src/org/apidesign/reentrant/NonReentrantLock.java Sat Jun 14 09:54:36 2008 +0200 @@ -0,0 +1,22 @@ +package org.apidesign.reentrant; + +import java.util.concurrent.locks.ReentrantLock; + +final class NonReentrantLock extends ReentrantLock { + @Override + public void lock() { + if (isHeldByCurrentThread()) { + throw new IllegalStateException("Attempt to reentrant lock"); + } + super.lock(); + } + + @Override + public void lockInterruptibly() throws InterruptedException { + if (isHeldByCurrentThread()) { + throw new IllegalStateException("Attempt to reentrant lock"); + } + super.lockInterruptibly(); + } + +}