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 (Iterator it = logs.iterator(); it.hasNext();) {
            ChangeLog changeLog = (ChangeLog) it.next();
            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 (Iterator it = logs.iterator(); it.hasNext();) {
            ChangeLog changeLog = (ChangeLog) it.next();
            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

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

            final ChangeLog changeLog = (ChangeLog) it.next();
            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

     * @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

     * @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

     *
     * @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

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.