private void getLocks(Stack<String> names, boolean verify, boolean fetchData, List<HiveLock> locks, HiveConf conf) throws LockException { lock.lock(); try { if (hasLock()) { getLocks(names.toArray(new String[names.size()]), verify, fetchData, locks, conf); } if (children != null) { for (Map.Entry<String, Node> entry : children.entrySet()) { names.push(entry.getKey()); entry.getValue().getLocks(names, verify, fetchData, locks, conf); names.pop(); } } } finally { lock.unlock(); } }
private void getLocks(Stack<String> names, boolean verify, boolean fetchData, List<HiveLock> locks, HiveConf conf) throws LockException { lock.lock(); try { if (hasLock()) { getLocks(names.toArray(new String[names.size()]), verify, fetchData, locks, conf); } if (children != null) { for (Map.Entry<String, Node> entry : children.entrySet()) { names.push(entry.getKey()); entry.getValue().getLocks(names, verify, fetchData, locks, conf); names.pop(); } } } finally { lock.unlock(); } }
private boolean lock(String[] paths, int index, HiveLockObjectData data, boolean exclusive) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (this.exclusive || exclusive && hasLock()) { return false; } set(data, exclusive); return true; } Node child; if (children == null) { children = new HashMap<String, Node>(3); children.put(paths[index], child = new Node()); } else { child = children.get(paths[index]); if (child == null) { children.put(paths[index], child = new Node()); } } return child.lock(paths, index + 1, data, exclusive); } finally { lock.unlock(); } }
private boolean unlock(String[] paths, int index, HiveLockObjectData data) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (hasLock()) { datas.remove(data.getQueryId()); } return true; } Node child = children == null ? null : children.get(paths[index]); if (child == null) { return true; // should not happen } if (child.unlock(paths, index + 1, data)) { if (!child.hasLock() && !child.hasChild()) { children.remove(paths[index]); } return true; } return false; } finally { lock.unlock(); } }
private boolean lock(String[] paths, int index, HiveLockObjectData data, boolean exclusive) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (this.exclusive || exclusive && hasLock()) { return false; } set(data, exclusive); return true; } Node child; if (children == null) { children = new HashMap<String, Node>(3); children.put(paths[index], child = new Node()); } else { child = children.get(paths[index]); if (child == null) { children.put(paths[index], child = new Node()); } } return child.lock(paths, index + 1, data, exclusive); } finally { lock.unlock(); } }
private void getLocks(Stack<String> names, boolean verify, boolean fetchData, List<HiveLock> locks, HiveConf conf) throws LockException { lock.lock(); try { if (hasLock()) { getLocks(names.toArray(new String[names.size()]), verify, fetchData, locks, conf); } if (children != null) { for (Map.Entry<String, Node> entry : children.entrySet()) { names.push(entry.getKey()); entry.getValue().getLocks(names, verify, fetchData, locks, conf); names.pop(); } } } finally { lock.unlock(); } }
private boolean unlock(String[] paths, int index, HiveLockObjectData data) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (hasLock()) { datas.remove(data.getQueryId()); } return true; } Node child = children == null ? null : children.get(paths[index]); if (child == null) { return true; // should not happen } if (child.unlock(paths, index + 1, data)) { if (!child.hasLock() && !child.hasChild()) { children.remove(paths[index]); } return true; } return false; } finally { lock.unlock(); } }
private boolean lock(String[] paths, int index, HiveLockObjectData data, boolean exclusive) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (this.exclusive || exclusive && hasLock()) { return false; } set(data, exclusive); return true; } Node child; if (children == null) { children = new HashMap<String, Node>(3); children.put(paths[index], child = new Node()); } else { child = children.get(paths[index]); if (child == null) { children.put(paths[index], child = new Node()); } } return child.lock(paths, index + 1, data, exclusive); } finally { lock.unlock(); } }
private boolean unlock(String[] paths, int index, HiveLockObjectData data) { if (!lock.tryLock()) { return false; } try { if (index == paths.length) { if (hasLock()) { datas.remove(data.getQueryId()); } return true; } Node child = children == null ? null : children.get(paths[index]); if (child == null) { return true; // should not happen } if (child.unlock(paths, index + 1, data)) { if (!child.hasLock() && !child.hasChild()) { children.remove(paths[index]); } return true; } return false; } finally { lock.unlock(); } }