Search in sources :

Example 1 with RpcCallback

use of org.apache.hadoop.hbase.ipc.RpcCallback in project hbase by apache.

the class RSRpcServices method addScanner.

private RegionScannerHolder addScanner(String scannerName, RegionScanner s, Shipper shipper, HRegion r, boolean needCursor, boolean fullRegionScan) throws LeaseStillHeldException {
    Lease lease = server.getLeaseManager().createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName));
    RpcCallback shippedCallback = new RegionScannerShippedCallBack(scannerName, shipper, lease);
    RpcCallback closeCallback = s instanceof RpcCallback ? (RpcCallback) s : new RegionScannerCloseCallBack(s);
    RegionScannerHolder rsh = new RegionScannerHolder(s, r, closeCallback, shippedCallback, needCursor, fullRegionScan, getRemoteClientIpAndPort(), getUserName());
    RegionScannerHolder existing = scanners.putIfAbsent(scannerName, rsh);
    assert existing == null : "scannerId must be unique within regionserver's whole lifecycle! " + scannerName + ", " + existing;
    return rsh;
}
Also used : Lease(org.apache.hadoop.hbase.regionserver.LeaseManager.Lease) RpcCallback(org.apache.hadoop.hbase.ipc.RpcCallback)

Example 2 with RpcCallback

use of org.apache.hadoop.hbase.ipc.RpcCallback in project hbase by apache.

the class RSRpcServices method addScanner.

private RegionScannerHolder addScanner(String scannerName, RegionScanner s, Region r) throws LeaseStillHeldException {
    Lease lease = regionServer.leases.createLease(scannerName, this.scannerLeaseTimeoutPeriod, new ScannerListener(scannerName));
    RpcCallback shippedCallback = new RegionScannerShippedCallBack(scannerName, s, lease);
    RpcCallback closeCallback;
    if (s instanceof RpcCallback) {
        closeCallback = (RpcCallback) s;
    } else {
        closeCallback = new RegionScannerCloseCallBack(s);
    }
    RegionScannerHolder rsh = new RegionScannerHolder(scannerName, s, r, closeCallback, shippedCallback);
    RegionScannerHolder existing = scanners.putIfAbsent(scannerName, rsh);
    assert existing == null : "scannerId must be unique within regionserver's whole lifecycle!";
    return rsh;
}
Also used : Lease(org.apache.hadoop.hbase.regionserver.Leases.Lease) RpcCallback(org.apache.hadoop.hbase.ipc.RpcCallback)

Aggregations

RpcCallback (org.apache.hadoop.hbase.ipc.RpcCallback)2 Lease (org.apache.hadoop.hbase.regionserver.LeaseManager.Lease)1 Lease (org.apache.hadoop.hbase.regionserver.Leases.Lease)1