Package org.apache.jackrabbit.core.state.ISMLocking

Examples of org.apache.jackrabbit.core.state.ISMLocking.WriteLock


     * @throws InterruptedException on interruption; this will err the test
     */
    public void testIntersectingWrites() throws InterruptedException {
        ChangeLog cl = new ChangeLog();
        cl.added(state);
        WriteLock wLock = locking.acquireWriteLock(cl);
        for (ChangeLog changeLog : logs) {
            verifyBlocked(startWriterThread(locking, changeLog));
        }
        wLock.release();
    }
View Full Code Here


     *
     * @throws InterruptedException on interruption; this will err the test
     */
    public void testDowngrade() throws InterruptedException {
        for (ChangeLog changeLog : logs) {
            WriteLock wLock = locking.acquireWriteLock(changeLog);
            verifyBlocked(startReaderThread(locking, state.getId()));
            ReadLock rLock = wLock.downgrade();
            verifyNotBlocked(startReaderThread(locking, state.getId()));
            rLock.release();
        }
    }
View Full Code Here

*/
public class DefaultISMLockingDeadlockTest extends JUnitTest {

    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();
View Full Code Here

     *
     * @throws InterruptedException on interruption; this will err the test
     */
    public void testWriteBlocksRead() throws InterruptedException {
        for (ChangeLog changeLog : logs) {
            WriteLock wLock = locking.acquireWriteLock(changeLog);
            verifyBlocked(startReaderThread(locking, state.getId()));
            wLock.release();
        }
    }
View Full Code Here

    public void testWriteBlocksRead_notIfSameThread() throws InterruptedException {
        for (final ChangeLog changeLog : logs) {
            Thread t = new Thread(new Runnable() {
                public void run() {
                    try {
                        WriteLock wLock = locking.acquireWriteLock(changeLog);
                        locking.acquireReadLock(state.getId()).release();
                        wLock.release();
                    } catch (InterruptedException e) {
                    }
                }
            });
            t.start();
View Full Code Here

     * @throws InterruptedException on interruption; this will err the test
     */
    public void testIntersectingWrites() throws InterruptedException {
        ChangeLog cl = new ChangeLog();
        cl.added(state);
        WriteLock wLock = locking.acquireWriteLock(cl);
        for (ChangeLog changeLog : logs) {
            verifyBlocked(startWriterThread(locking, changeLog));
        }
        wLock.release();
    }
View Full Code Here

     *
     * @throws InterruptedException on interruption; this will err the test
     */
    public void testDowngrade() throws InterruptedException {
        for (ChangeLog changeLog : logs) {
            WriteLock wLock = locking.acquireWriteLock(changeLog);
            verifyBlocked(startReaderThread(locking, state.getId()));
            ReadLock rLock = wLock.downgrade();
            verifyNotBlocked(startReaderThread(locking, state.getId()));
            rLock.release();
        }
    }
View Full Code Here

     * @return write operation helper
     * @throws RepositoryException if the write operation could not be started
     */
    private WriteOperation startWriteOperation() throws RepositoryException {
        boolean success = false;
        WriteLock lock = acquireWriteLock();
        try {
            stateMgr.edit();
            success = true;
            return new WriteOperation(lock);
        } catch (IllegalStateException e) {
            throw new RepositoryException("Unable to start edit operation.", e);
        } finally {
            if (!success) {
                lock.release();
            }
        }
    }
View Full Code Here

     * @return write operation helper
     * @throws RepositoryException if the write operation could not be started
     */
    private WriteOperation startWriteOperation() throws RepositoryException {
        boolean success = false;
        WriteLock lock = acquireWriteLock();
        try {
            stateMgr.edit();
            success = true;
            return new WriteOperation(lock);
        } catch (IllegalStateException e) {
            throw new RepositoryException("Unable to start edit operation.", e);
        } finally {
            if (!success) {
                lock.release();
            }
        }
    }
View Full Code Here

     * @return write operation helper
     * @throws RepositoryException if the write operation could not be started
     */
    private WriteOperation startWriteOperation() throws RepositoryException {
        boolean success = false;
        WriteLock lock = acquireWriteLock();
        try {
            stateMgr.edit();
            success = true;
            return new WriteOperation(lock);
        } catch (IllegalStateException e) {
            throw new RepositoryException("Unable to start edit operation.", e);
        } finally {
            if (!success) {
                lock.release();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.state.ISMLocking.WriteLock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.