Package org.apache.hadoop.hbase.zookeeper.lock

Examples of org.apache.hadoop.hbase.zookeeper.lock.ZKInterProcessReadWriteLock


    }

    public void visitAllLocks(MetadataHandler handler) throws IOException {
      for (String tableName : getTableNames()) {
        String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
        ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
            zkWatcher, tableLockZNode, null);
        lock.readLock(null).visitLocks(handler);
        lock.writeLock(null).visitLocks(handler);
      }
    }
View Full Code Here


    public void reapWriteLocks() throws IOException {
      //get the table names
      try {
        for (String tableName : getTableNames()) {
          String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
          ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
              zkWatcher, tableLockZNode, null);
          lock.writeLock(null).reapAllLocks();
        }
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        LOG.warn("Caught exception while reaping table write locks", ex);
View Full Code Here

    public void reapAllExpiredLocks() throws IOException {
      //get the table names
      try {
        for (String tableName : getTableNames()) {
          String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
          ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
              zkWatcher, tableLockZNode, null);
          lock.readLock(null).reapExpiredLocks(lockExpireTimeoutMs);
          lock.writeLock(null).reapExpiredLocks(lockExpireTimeoutMs);
        }
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        throw new IOException(ex);
View Full Code Here

          .setPurpose(purpose)
          .setIsShared(isShared)
          .setCreateTime(EnvironmentEdgeManager.currentTimeMillis()).build();
        byte[] lockMetadata = toBytes(data);

        InterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(zkWatcher, tableLockZNode,
          METADATA_HANDLER);
        return isShared ? lock.readLock(lockMetadata) : lock.writeLock(lockMetadata);
      }
View Full Code Here

          throw new IOException("Unexpected ZooKeeper exception", e);
        }

        for (String tableName : tableNames) {
          String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
          ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
              zkWatcher, tableLockZNode, null);
          lock.writeLock(null).reapAllLocks();
        }
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        LOG.warn("Caught exception while reaping table write locks", ex);
View Full Code Here

          .setThreadId(Thread.currentThread().getId())
          .setPurpose(purpose)
          .setIsShared(isShared).build();
        byte[] lockMetadata = toBytes(data);

        InterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(zkWatcher, tableLockZNode,
          METADATA_HANDLER);
        return isShared ? lock.readLock(lockMetadata) : lock.writeLock(lockMetadata);
      }
View Full Code Here

    }

    public void visitAllLocks(MetadataHandler handler) throws IOException {
      for (String tableName : getTableNames()) {
        String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
        ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
            zkWatcher, tableLockZNode, null);
        lock.readLock(null).visitLocks(handler);
        lock.writeLock(null).visitLocks(handler);
      }
    }
View Full Code Here

    public void reapWriteLocks() throws IOException {
      //get the table names
      try {
        for (String tableName : getTableNames()) {
          String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
          ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
              zkWatcher, tableLockZNode, null);
          lock.writeLock(null).reapAllLocks();
        }
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        LOG.warn("Caught exception while reaping table write locks", ex);
View Full Code Here

    public void reapAllExpiredLocks() throws IOException {
      //get the table names
      try {
        for (String tableName : getTableNames()) {
          String tableLockZNode = ZKUtil.joinZNode(zkWatcher.tableLockZNode, tableName);
          ZKInterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(
              zkWatcher, tableLockZNode, null);
          lock.readLock(null).reapExpiredLocks(lockExpireTimeoutMs);
          lock.writeLock(null).reapExpiredLocks(lockExpireTimeoutMs);
        }
      } catch (IOException ex) {
        throw ex;
      } catch (Exception ex) {
        throw new IOException(ex);
View Full Code Here

          .setPurpose(purpose)
          .setIsShared(isShared)
          .setCreateTime(EnvironmentEdgeManager.currentTime()).build();
        byte[] lockMetadata = toBytes(data);

        InterProcessReadWriteLock lock = new ZKInterProcessReadWriteLock(zkWatcher, tableLockZNode,
          METADATA_HANDLER);
        return isShared ? lock.readLock(lockMetadata) : lock.writeLock(lockMetadata);
      }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.zookeeper.lock.ZKInterProcessReadWriteLock

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.