Releases an explicit row lock. For a description of what row locks are, see RowLock. @param lock The lock to release. @return A deferred object that indicates the completion of the request. The Object has not special meaning and can be null (think of it as {@code Deferred
(final RowLock lock)
| 2191 | * (think of it as {@code Deferred<Void>}). |
| 2192 | */ |
| 2193 | public Deferred<Object> unlockRow(final RowLock lock) { |
| 2194 | final byte[] region_name = lock.region(); |
| 2195 | final RegionInfo region = regions_cache.get(region_name); |
| 2196 | if (knownToBeNSREd(region)) { |
| 2197 | // If this region has been NSRE'd, we can't possibly still hold a lock |
| 2198 | // on one of its rows, as this would have prevented it from splitting. |
| 2199 | // So let's just pretend the row has been unlocked. |
| 2200 | return Deferred.fromResult(null); |
| 2201 | } |
| 2202 | final RegionClient client = clientFor(region); |
| 2203 | if (client == null) { |
| 2204 | // Oops, we no longer know anything about this client or region. Our |
| 2205 | // cache was probably invalidated while the client was holding the lock. |
| 2206 | LOG.warn("Cannot release " + lock + ", no connection open for " |
| 2207 | + Bytes.pretty(region_name)); |
| 2208 | return Deferred.fromResult(null); |
| 2209 | } |
| 2210 | final HBaseRpc release = new RowLockRequest.ReleaseRequest(lock, region); |
| 2211 | release.setRegion(region); |
| 2212 | final Deferred<Object> d = release.getDeferred(); |
| 2213 | client.sendRpc(release); |
| 2214 | return d; |
| 2215 | } |
| 2216 | |
| 2217 | /** |
| 2218 | * Deletes data from HBase. |