Examples of LockAdviser


Examples of org.openbel.framework.common.lock.LockAdviser

        }
    }

    @Test
    public void testMultipleReadLocks() {
        final LockAdviser lockAdviser = LockAdviser.instance(lockDir);

        final Lock rlock1;
        final Lock rlock2;
        try {
            rlock1 = lockAdviser.obtainReadLock();
            rlock2 = lockAdviser.obtainReadLock();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
            return;
        }

        assertNotNull(rlock1);
        assertNotNull(rlock2);

        try {
            lockAdviser.releaseReadLock(rlock1);
            lockAdviser.releaseReadLock(rlock2);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

Examples of org.openbel.framework.common.lock.LockAdviser

        assertEquals(0, lockDir.listFiles().length);
    }

    @Test
    public void testSingleWriteLock() {
        final LockAdviser lockAdviser = LockAdviser.instance(lockDir);

        final Lock wlock1;
        final Lock wlock2;
        try {
            wlock1 = lockAdviser.obtainWriteLock();
            wlock2 = lockAdviser.obtainWriteLock();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
            return;
        }

        assertNotNull(wlock1);
        assertNull(wlock2);

        try {
            lockAdviser.releaseWriteLock(wlock1);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

Examples of org.openbel.framework.common.lock.LockAdviser

        assertEquals(0, lockDir.listFiles().length);
    }

    @Test
    public void testReleaseLockDeletion() {
        final LockAdviser lockAdviser = LockAdviser.instance(lockDir);

        final Lock rlock;
        try {
            rlock = lockAdviser.obtainReadLock();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
            return;
        }

        assertNotNull(rlock);

        try {
            lockAdviser.releaseReadLock(rlock);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
View Full Code Here

Examples of org.openbel.framework.common.lock.LockAdviser

        } catch (IOException e) {
            e.printStackTrace();
            fail(e.getMessage());
        }

        final LockAdviser lockAdviser = LockAdviser.instance(lockDir);

        // attempt write lock, which should return null
        final Lock wlock;
        try {
            wlock = lockAdviser.obtainWriteLock();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
            return;
        }
View Full Code Here

Examples of org.openbel.framework.common.lock.LockAdviser

        } catch (IOException e) {
            e.printStackTrace();
            fail(e.getMessage());
        }

        final LockAdviser lockAdviser = LockAdviser.instance(lockDir);

        // attempt read lock, which should return null
        final Lock rlock;
        try {
            rlock = lockAdviser.obtainReadLock();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
            return;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.