| 613 | */ |
| 614 | private final class TimeoutTask implements TimerTask { |
| 615 | @Override |
| 616 | public void run(final Timeout time_out) throws Exception { |
| 617 | synchronized (HBaseRpc.this) { |
| 618 | if (has_timedout) { |
| 619 | throw new IllegalStateException( |
| 620 | "This RPC has already timed out " + HBaseRpc.this); |
| 621 | } |
| 622 | has_timedout = true; |
| 623 | } |
| 624 | |
| 625 | if (timeout_handle == null) { |
| 626 | LOG.error("Received a timeout handle " + time_out |
| 627 | + " but this RPC did not have one " + this); |
| 628 | } |
| 629 | if (time_out != timeout_handle) { |
| 630 | LOG.error("Receieved a timeout handle " + time_out + |
| 631 | " that doesn't match our own " + this); |
| 632 | } |
| 633 | if (region_client == null) { |
| 634 | LOG.error("Somehow the region client was null when timing out RPC " |
| 635 | + this); |
| 636 | } else { |
| 637 | region_client.removeRpc(HBaseRpc.this, true); |
| 638 | } |
| 639 | |
| 640 | callback(new RpcTimedOutException("RPC ID [" + rpc_id + |
| 641 | "] timed out waiting for response from HBase on region client [" + |
| 642 | region_client + " ] for over " + timeout + "ms", HBaseRpc.this)); |
| 643 | timeout_task = null; |
| 644 | timeout_handle = null; |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | /** |