Package org.apache.oozie.lock

Examples of org.apache.oozie.lock.LockToken.release()


                    return;
                }
            }
            finally {
                if (lock != null) {
                    lock.release();
                }
            }
        }
        throw new Exception("Can't reset ID sequence in ZK. Retried " + RETRY_COUNT + " times");
    }
View Full Code Here


        ZKLocksService zkls = new ZKLocksService();
        try {
            zkls.init(Services.get());
            for (int i = 0; i < 10; ++i) {
                LockToken l = zkls.getReadLock(String.valueOf(i), 1);
                l.release();

            }
            sleep(2000);
            Stat stat = getClient().checkExists().forPath(ZKLocksService.LOCKS_NODE);
            assertEquals(stat.getNumChildren(), 0);
View Full Code Here

                    sb.append(nameIndex).append("-L ");
                    synchronized (this) {
                        wait();
                    }
                    sb.append(nameIndex).append("-U ");
                    token.release();
                    log.info("Release lock [{0}]", nameIndex);
                }
                else {
                    sb.append(nameIndex).append("-N ");
                    log.info("Did not get lock [{0}]", nameIndex);
View Full Code Here

        // it will create a lock znode.
        ZKLocksService zkls = new ZKLocksService();
        try {
            zkls.init(Services.get());
            LockToken lock = zkls.getWriteLock("foo", 3);
            lock.release();
            List<ACL> acls = getClient().getZookeeperClient().getZooKeeper().getACL("/oozie", new Stat());
            assertEquals(ZooDefs.Perms.ALL, acls.get(0).getPerms());
            assertEquals("world", acls.get(0).getId().getScheme());
            assertEquals("anyone", acls.get(0).getId().getId());
            acls = getClient().getACL().forPath("/locks");
View Full Code Here

            assertNull(getClient().checkExists().forPath("/locks"));
            assertNull(getClient().checkExists().forPath("/services"));
            // Check that new znodes will use the ACLs
            zkls.init(Services.get());
            LockToken lock = zkls.getWriteLock("foo", 3);
            lock.release();
            List<ACL> acls = getClient().getZookeeperClient().getZooKeeper().getACL("/oozie", new Stat());
            assertEquals(ZooDefs.Perms.ALL, acls.get(0).getPerms());
            assertEquals("sasl", acls.get(0).getId().getScheme());
            assertEquals(PRIMARY_PRINCIPAL, acls.get(0).getId().getId());
            acls = getClient().getACL().forPath("/locks");
View Full Code Here

            catch (Exception e) {
                LOG.error("Exception", e);
            }
            finally {
                if (lock != null) {
                    lock.release();
                    LOG.info("Released lock for [{0}]", CoordMaterializeTriggerService.class.getName());
                }

            }
View Full Code Here

                    catch (Exception e) {
                        LOG.warn("Failed to load records for " + jobId, e);
                    }
                    finally {
                        if (lock != null) {
                            lock.release();
                            lock = null;
                        }
                    }
                }
                try {
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.