(final HBaseClient client, String[] args)
| 234 | |
| 235 | private static final class delete implements Cmd { |
| 236 | public void execute(final HBaseClient client, String[] args) throws Exception { |
| 237 | ensureArguments(args, 4, 6); |
| 238 | RowLock lock = null; |
| 239 | if (args[1].charAt(0) == 'l') { // locked version of the command |
| 240 | ensureArguments(args, 6, 6); |
| 241 | final RowLockRequest rlr = new RowLockRequest(args[2], args[3]); |
| 242 | lock = client.lockRow(rlr).joinUninterruptibly(); |
| 243 | LOG.info("Acquired explicit row lock: " + lock); |
| 244 | } |
| 245 | final DeleteRequest delete; |
| 246 | if (lock == null) { |
| 247 | switch (args.length) { |
| 248 | case 4: delete = new DeleteRequest(args[2], args[3]); break; |
| 249 | case 5: delete = new DeleteRequest(args[2], args[3], args[4]); break; |
| 250 | case 6: delete = new DeleteRequest(args[2], args[3], args[4], args[5]); break; |
| 251 | default: throw new AssertionError("Should never be here"); |
| 252 | } |
| 253 | } else { |
| 254 | delete = new DeleteRequest(args[2], args[3], args[4], args[5], lock); |
| 255 | } |
| 256 | args = null; |
| 257 | try { |
| 258 | final Object result = client.delete(delete).joinUninterruptibly(); |
| 259 | LOG.info("Delete result=" + result); |
| 260 | } catch (Exception e) { |
| 261 | LOG.error("Delete failed", e); |
| 262 | } finally { |
| 263 | if (lock != null) { |
| 264 | client.unlockRow(lock).joinUninterruptibly(); |
| 265 | LOG.info("Released explicit row lock: " + lock); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | private static final class scan implements Cmd { |
nothing calls this directly
no test coverage detected