use of org.apache.jackrabbit.core.state.DefaultISMLocking in project jackrabbit by apache.
the class DefaultISMLockingDeadlockTest method test.
public void test() throws InterruptedException {
final ISMLocking lock = new DefaultISMLocking();
WriteLock w1 = lock.acquireWriteLock(null);
ReadLock r1 = w1.downgrade();
final InterruptedException[] ex = new InterruptedException[1];
Thread thread = new Thread() {
public void run() {
try {
lock.acquireWriteLock(null).release();
} catch (InterruptedException e) {
ex[0] = e;
}
}
};
thread.start();
Thread.sleep(100);
lock.acquireReadLock(null).release();
r1.release();
thread.join();
if (ex[0] != null) {
throw ex[0];
}
}
Aggregations