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 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 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(); } }
public boolean lock(String[] paths, HiveLockObjectData data, boolean exclusive) { return lock(paths, 0, data, exclusive); }
private HiveLock lockPrimitive(HiveLockObject key, HiveLockMode mode) throws LockException { if (root.lock(key.getPaths(), key.getData(), mode == HiveLockMode.EXCLUSIVE)) { return new SimpleHiveLock(key, mode); } return null; }
public boolean lock(String[] paths, HiveLockObjectData data, boolean exclusive) { return lock(paths, 0, data, exclusive); }
private HiveLock lockPrimitive(HiveLockObject key, HiveLockMode mode) throws LockException { if (root.lock(key.getPaths(), key.getData(), mode == HiveLockMode.EXCLUSIVE)) { return new SimpleHiveLock(key, mode); } return null; }
public boolean lock(String[] paths, HiveLockObjectData data, boolean exclusive) { return lock(paths, 0, data, exclusive); }
private HiveLock lockPrimitive(HiveLockObject key, HiveLockMode mode) throws LockException { if (root.lock(key.getPaths(), key.getData(), mode == HiveLockMode.EXCLUSIVE)) { return new SimpleHiveLock(key, mode); } return null; }