Handles the response of #helloRpc. @return null when it re-tried for a version mismatch. A version object if it was successful. @throws an exception If there was an error that we cannot retry. It includes ServerNotRunningYetExceptio, and NotServingRegionException.
(final Object response)
| 624 | * includes ServerNotRunningYetExceptio, and NotServingRegionException. |
| 625 | */ |
| 626 | public Long call(final Object response) throws Exception { |
| 627 | if (response instanceof VersionMismatchException) { |
| 628 | if (server_version == SERVER_VERSION_UNKNWON) { |
| 629 | // If we get here, it's because we tried to handshake with a server |
| 630 | // running HBase 0.92 or above, but using a pre-0.92 handshake. So |
| 631 | // we know we have to handshake differently. |
| 632 | server_version = SERVER_VERSION_092_OR_ABOVE; |
| 633 | helloRpc(chan, header092()); |
| 634 | } else { |
| 635 | // We get here if the server refused our 0.92-style handshake. This |
| 636 | // must be a future version of HBase that broke compatibility again, |
| 637 | // and we don't know how to talk to it, so give up here. |
| 638 | throw (VersionMismatchException) response; |
| 639 | } |
| 640 | return null; |
| 641 | } else if (!(response instanceof Long)) { |
| 642 | if (response instanceof Exception) { // If it's already an exception, |
| 643 | throw (Exception) response; // just re-throw it as-is. |
| 644 | } |
| 645 | throw new InvalidResponseException(Long.class, response); |
| 646 | } |
| 647 | final Long version = (Long) response; |
| 648 | final long v = version; |
| 649 | if (v <= 0 || v > Byte.MAX_VALUE) { |
| 650 | throw new InvalidResponseException("getProtocolVersion returned a " |
| 651 | + (v <= 0 ? "negative" : "too large") + " value", version); |
| 652 | } |
| 653 | becomeReady(chan, (byte) v); |
| 654 | return version; |
| 655 | } |
| 656 | |
| 657 | public String toString() { |
| 658 | return "handle getProtocolVersion response on " + chan; |
nothing calls this directly
no test coverage detected