public synchronized LockID getLockID() { if (lock == null) { throw new IllegalStateException("Lock not held"); } return new LockID(path, lock, zooKeeper.getZooKeeper().getSessionId()); }
@SuppressFBWarnings(value = "DM_EXIT", justification = "TODO - should probably avoid System.exit here; " + "this code is used by the fate admin shell command") public boolean checkGlobalLock(IZooReaderWriter zk, String path) { try { if (ZooLock.getLockData(zk.getZooKeeper(), path) != null) { System.err.println("ERROR: Master lock is held, not running"); if (this.exitOnError) System.exit(1); else return false; } } catch (KeeperException e) { System.err.println("ERROR: Could not read master lock, not running " + e.getMessage()); if (this.exitOnError) System.exit(1); else return false; } catch (InterruptedException e) { System.err.println("ERROR: Could not read master lock, not running" + e.getMessage()); if (this.exitOnError) System.exit(1); else return false; } return true; } }
public synchronized void replaceLockData(byte[] b) throws KeeperException, InterruptedException { if (getLockPath() != null) zooKeeper.getZooKeeper().setData(getLockPath(), b, -1); }
IZooReaderWriter zk = context.getZooReaderWriter(); if (opts.auth != null) { zk.getZooKeeper().addAuthInfo("digest", ("accumulo:" + opts.auth).getBytes(UTF_8));
public synchronized LockID getLockID() { if (lock == null) { throw new IllegalStateException("Lock not held"); } return new LockID(path, lock, zooKeeper.getZooKeeper().getSessionId()); }
public boolean checkGlobalLock(IZooReaderWriter zk, String path) { try { if (ZooLock.getLockData(zk.getZooKeeper(), path) != null) { System.err.println("ERROR: Master lock is held, not running"); if (this.exitOnError) System.exit(1); else return false; } } catch (KeeperException e) { System.err.println("ERROR: Could not read master lock, not running " + e.getMessage()); if (this.exitOnError) System.exit(1); else return false; } catch (InterruptedException e) { System.err.println("ERROR: Could not read master lock, not running" + e.getMessage()); if (this.exitOnError) System.exit(1); else return false; } return true; } }
public synchronized void replaceLockData(byte[] b) throws KeeperException, InterruptedException { if (getLockPath() != null) zooKeeper.getZooKeeper().setData(getLockPath(), b, -1); }
IZooReaderWriter zk = ZooReaderWriter.getInstance(); if (opts.auth != null) { zk.getZooKeeper().addAuthInfo("digest", ("accumulo:" + opts.auth).getBytes(UTF_8));
IZooReaderWriter zk = ZooReaderWriter.getInstance(); if (opts.auth != null) { zk.getZooKeeper().addAuthInfo("digest", ("accumulo:" + opts.auth).getBytes(UTF_8));
private static void initZooKeeper(Opts opts, String uuid, String instanceNamePath) throws KeeperException, InterruptedException { ZooUtil.putPersistentData(zoo.getZooKeeper(), Constants.ZROOT, new byte[0], -1, NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE); ZooUtil.putPersistentData(zoo.getZooKeeper(), Constants.ZROOT + Constants.ZINSTANCES, new byte[0], -1, NodeExistsPolicy.SKIP, Ids.OPEN_ACL_UNSAFE);
writer.getZooKeeper().setData(lockPath, data, -1);