Package org.apache.oozie.service.ZKLocksService

Examples of org.apache.oozie.service.ZKLocksService.ZKLockToken


    public void testLockRelease() throws ServiceException, InterruptedException {
        final String path = UUID.randomUUID().toString();
        ZKLocksService zkls = new ZKLocksService();
        try {
            zkls.init(Services.get());
            ZKLockToken lock = (ZKLockToken) zkls.getWriteLock(path, 5000);
            assertTrue(zkls.getLocks().containsKey(path));
            lock.release();
            assertFalse(zkls.getLocks().containsKey(path));
        }
        finally {
            zkls.destroy();
        }
View Full Code Here


    public void testReentrantMultipleCall() throws ServiceException, InterruptedException {
        final String path = UUID.randomUUID().toString();
        ZKLocksService zkls = new ZKLocksService();
        try {
            zkls.init(Services.get());
            ZKLockToken lock = (ZKLockToken) zkls.getWriteLock(path, 5000);
            lock = (ZKLockToken) zkls.getWriteLock(path, 5000);
            lock = (ZKLockToken) zkls.getWriteLock(path, 5000);
            assertTrue(zkls.getLocks().containsKey(path));
            lock.release();
            assertTrue(zkls.getLocks().containsKey(path));
            lock.release();
            assertTrue(zkls.getLocks().containsKey(path));
            lock.release();
            assertFalse(zkls.getLocks().containsKey(path));
        }
        catch (Exception e) {
            fail("Reentrant property, it should have acquired lock");
        }
View Full Code Here

TOP

Related Classes of org.apache.oozie.service.ZKLocksService.ZKLockToken

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.