org.apache.hadoop.hbase.regionserver.Region.getRowLock()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.hadoop.hbase.regionserver.Region.getRowLock方法的一些代码示例,展示了Region.getRowLock的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.getRowLock方法的具体详情如下:
包路径:org.apache.hadoop.hbase.regionserver.Region
类名称:Region
方法名:getRowLock

Region.getRowLock介绍

[英]Get a row lock for the specified row. All locks are reentrant. Before calling this function make sure that a region operation has already been started (the calling thread has already acquired the region-close-guard lock).

The obtained locks should be released after use by RowLock#release()

NOTE: the boolean passed here has changed. It used to be a boolean that stated whether or not to wait on the lock. Now it is whether it an exclusive lock is requested.
[中]获取指定行的行锁。所有锁都是可重入的。在调用此函数之前,请确保已启动区域操作(调用线程已获取区域关闭保护锁)。
RowLock#release()使用后应释放获得的锁
注意:此处传递的布尔值已更改。它过去是一个布尔值,表示是否等待锁。现在的问题是,它是否需要一个独占锁。

代码示例

代码示例来源:origin: apache/phoenix

public static RowLock acquireLock(Region region, byte[] key, List<RowLock> locks)
    throws IOException {
  RowLock rowLock = region.getRowLock(key, false);
  if (rowLock == null) {
    throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
  }
  if (locks != null) {
    locks.add(rowLock);
  }
  return rowLock;
}

代码示例来源:origin: apache/phoenix

private RowLock acquireLock(Region region, byte[] lockKey, List<RowLock> locks) throws IOException {
  RowLock rowLock = region.getRowLock(lockKey, false);
  if (rowLock == null) {
    throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(lockKey));
  }
  if (locks != null) {
    locks.add(rowLock);
  }
  return rowLock;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

private RowLock acquireLock(Region region, byte[] lockKey, List<RowLock> locks) throws IOException {
  RowLock rowLock = region.getRowLock(lockKey, false);
  if (rowLock == null) {
    throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(lockKey));
  }
  if (locks != null) {
    locks.add(rowLock);
  }
  return rowLock;
}

代码示例来源:origin: org.apache.phoenix/phoenix-core

public static RowLock acquireLock(Region region, byte[] key, List<RowLock> locks)
    throws IOException {
  RowLock rowLock = region.getRowLock(key, false);
  if (rowLock == null) {
    throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
  }
  if (locks != null) {
    locks.add(rowLock);
  }
  return rowLock;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

public static RowLock acquireLock(Region region, byte[] key, List<RowLock> locks)
    throws IOException {
  RowLock rowLock = region.getRowLock(key, false);
  if (rowLock == null) {
    throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key));
  }
  if (locks != null) {
    locks.add(rowLock);
  }
  return rowLock;
}

相关文章