本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException类的典型用法代码示例。如果您正苦于以下问题:Java LeaseStillHeldException类的具体用法?Java LeaseStillHeldException怎么用?Java LeaseStillHeldException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LeaseStillHeldException类属于org.apache.hadoop.hbase.regionserver.Leases包,在下文中一共展示了LeaseStillHeldException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
private RegionScannerHolder addScanner(String scannerName, RegionScanner s, Shipper shipper,
HRegion r, boolean needCursor) throws LeaseStillHeldException {
Lease lease = regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
RpcCallback shippedCallback = new RegionScannerShippedCallBack(scannerName, shipper, lease);
RpcCallback closeCallback;
if (s instanceof RpcCallback) {
closeCallback = (RpcCallback) s;
} else {
closeCallback = new RegionScannerCloseCallBack(s);
}
RegionScannerHolder rsh =
new RegionScannerHolder(scannerName, s, r, closeCallback, shippedCallback, needCursor);
RegionScannerHolder existing = scanners.putIfAbsent(scannerName, rsh);
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle! " +
scannerName;
return rsh;
}
示例2: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
long addScanner(RegionScanner s, Region r) throws LeaseStillHeldException {
long scannerId = this.scannerIdGen.incrementAndGet();
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing =
scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r));
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
return scannerId;
}
示例3: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
long scannerId = -1L;
scannerId = rand.nextLong();
String scannerName = String.valueOf(scannerId);
scanners.put(scannerName, s);
this.leases.createLease(scannerName, new ScannerListener(scannerName));
return scannerId;
}
示例4: addRowLock
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException {
long lockId = -1L;
lockId = rand.nextLong();
String lockName = String.valueOf(lockId);
rowlocks.put(lockName, r);
this.leases.createLease(lockName, new RowLockListener(lockName, region));
return lockId;
}
示例5: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException {
long scannerId = this.scannerIdGen.incrementAndGet();
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing =
scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r));
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
return scannerId;
}
示例6: addPScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
long addPScanner(PRegionScanner s, HRegion r) throws LeaseStillHeldException {
long scannerId = this.scannerIdGen.incrementAndGet();
String scannerName = String.valueOf(scannerId);
PRegionScannerHolder existing =
pscanners.putIfAbsent(scannerName, new PRegionScannerHolder(s, r));
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
//todo:
/* regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));*/
return scannerId;
}
示例7: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException {
long scannerId = this.scannerIdGen.incrementAndGet();
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing =
scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r));
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
return scannerId;
}
示例8: addRowLock
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addRowLock(Integer r, HRegion region)
throws LeaseStillHeldException {
long lockId = -1L;
lockId = rand.nextLong();
String lockName = String.valueOf(lockId);
rowlocks.put(lockName, r);
this.leases.createLease(lockName, new RowLockListener(lockName, region));
return lockId;
}
示例9: addScannerLeaseBack
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
private void addScannerLeaseBack(Leases.Lease lease) {
try {
regionServer.leases.addLease(lease);
} catch (LeaseStillHeldException e) {
// should not happen as the scanner id is unique.
throw new AssertionError(e);
}
}
示例10: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException {
long scannerId = this.scannerIdGen.incrementAndGet();
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing =
scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r));
assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
return scannerId;
}
示例11: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addScanner(RegionScanner s, HRegion r) throws LeaseStillHeldException {
long scannerId = -1;
while (true) {
scannerId = Math.abs(rand.nextLong() << 24) ^ startcode;
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing =
scanners.putIfAbsent(scannerName, new RegionScannerHolder(s, r));
if (existing == null) {
this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
break;
}
}
return scannerId;
}
示例12: addRowLock
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException {
String lockName = null;
long lockId;
do {
lockId = nextLong();
lockName = String.valueOf(lockId);
} while (rowlocks.putIfAbsent(lockName, r) != null);
this.leases.createLease(lockName, this.rowLockLeaseTimeoutPeriod, new RowLockListener(lockName,
region));
return lockId;
}
示例13: addScanner
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
protected long addScanner(RegionScanner s) throws LeaseStillHeldException {
long scannerId = -1;
while (true) {
scannerId = rand.nextLong();
if (scannerId == -1) continue;
String scannerName = String.valueOf(scannerId);
RegionScannerHolder existing = scanners.putIfAbsent(scannerName, new RegionScannerHolder(s));
if (existing == null) {
this.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod,
new ScannerListener(scannerName));
break;
}
}
return scannerId;
}
示例14: beginTransaction
import org.apache.hadoop.hbase.regionserver.Leases.LeaseStillHeldException; //导入依赖的package包/类
/**
* @param transactionId
* @throws IOException
*/
public void beginTransaction(final long transactionId) throws IOException {
checkClosing();
String key = String.valueOf(transactionId);
if (transactionsById.get(key) != null) {
TransactionState alias = getTransactionState(transactionId);
if (alias != null) {
alias.setStatus(Status.ABORTED);
retireTransaction(alias);
}
LOG.error("Existing trasaction with id [" + key + "] in region ["
+ super.getRegionInfo().getRegionNameAsString() + "]");
throw new IOException("Already exiting transaction id: " + key);
}
TransactionState state = new TransactionState(transactionId, super.getLog().getSequenceNumber(),
super.getRegionInfo());
state.setStartSequenceNumber(nextSequenceId.get());
List<TransactionState> commitPendingCopy = new ArrayList<TransactionState>(commitPendingTransactions);
for (TransactionState commitPending : commitPendingCopy) {
state.addTransactionToCheck(commitPending);
}
synchronized (transactionsById) {
transactionsById.put(key, state);
}
try {
transactionLeases.createLease(getLeaseId(transactionId), new TransactionLeaseListener(key));
} catch (LeaseStillHeldException e) {
LOG.error("Lease still held for [" + key + "] in region [" + super.getRegionInfo().getRegionNameAsString()
+ "]");
throw new RuntimeException(e);
}
LOG.debug("Begining transaction " + key + " in region " + super.getRegionInfo().getRegionNameAsString());
maybeTriggerOldTransactionFlush();
}