hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [10/51] [partial] hbase-site git commit: Published site at .
Date Sun, 29 Oct 2017 15:17:11 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/1d9053bc/devapidocs/src-html/org/apache/hadoop/hbase/client/HTable.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/client/HTable.html b/devapidocs/src-html/org/apache/hadoop/hbase/client/HTable.html
index 06f911a..3dd53c6 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/client/HTable.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/client/HTable.html
@@ -953,384 +953,381 @@
 <span class="sourceLineNo">945</span>    return r.getExists();<a name="line.945"></a>
 <span class="sourceLineNo">946</span>  }<a name="line.946"></a>
 <span class="sourceLineNo">947</span><a name="line.947"></a>
-<span class="sourceLineNo">948</span>  /**<a name="line.948"></a>
-<span class="sourceLineNo">949</span>   * {@inheritDoc}<a name="line.949"></a>
-<span class="sourceLineNo">950</span>   */<a name="line.950"></a>
-<span class="sourceLineNo">951</span>  @Override<a name="line.951"></a>
-<span class="sourceLineNo">952</span>  public boolean[] existsAll(final List&lt;Get&gt; gets) throws IOException {<a name="line.952"></a>
-<span class="sourceLineNo">953</span>    if (gets.isEmpty()) return new boolean[]{};<a name="line.953"></a>
-<span class="sourceLineNo">954</span>    if (gets.size() == 1) return new boolean[]{exists(gets.get(0))};<a name="line.954"></a>
-<span class="sourceLineNo">955</span><a name="line.955"></a>
-<span class="sourceLineNo">956</span>    ArrayList&lt;Get&gt; exists = new ArrayList&lt;&gt;(gets.size());<a name="line.956"></a>
-<span class="sourceLineNo">957</span>    for (Get g: gets){<a name="line.957"></a>
-<span class="sourceLineNo">958</span>      Get ge = new Get(g);<a name="line.958"></a>
-<span class="sourceLineNo">959</span>      ge.setCheckExistenceOnly(true);<a name="line.959"></a>
-<span class="sourceLineNo">960</span>      exists.add(ge);<a name="line.960"></a>
-<span class="sourceLineNo">961</span>    }<a name="line.961"></a>
-<span class="sourceLineNo">962</span><a name="line.962"></a>
-<span class="sourceLineNo">963</span>    Object[] r1= new Object[exists.size()];<a name="line.963"></a>
-<span class="sourceLineNo">964</span>    try {<a name="line.964"></a>
-<span class="sourceLineNo">965</span>      batch(exists, r1, readRpcTimeoutMs);<a name="line.965"></a>
-<span class="sourceLineNo">966</span>    } catch (InterruptedException e) {<a name="line.966"></a>
-<span class="sourceLineNo">967</span>      throw (InterruptedIOException)new InterruptedIOException().initCause(e);<a name="line.967"></a>
-<span class="sourceLineNo">968</span>    }<a name="line.968"></a>
-<span class="sourceLineNo">969</span><a name="line.969"></a>
-<span class="sourceLineNo">970</span>    // translate.<a name="line.970"></a>
-<span class="sourceLineNo">971</span>    boolean[] results = new boolean[r1.length];<a name="line.971"></a>
-<span class="sourceLineNo">972</span>    int i = 0;<a name="line.972"></a>
-<span class="sourceLineNo">973</span>    for (Object o : r1) {<a name="line.973"></a>
-<span class="sourceLineNo">974</span>      // batch ensures if there is a failure we get an exception instead<a name="line.974"></a>
-<span class="sourceLineNo">975</span>      results[i++] = ((Result)o).getExists();<a name="line.975"></a>
-<span class="sourceLineNo">976</span>    }<a name="line.976"></a>
+<span class="sourceLineNo">948</span>  @Override<a name="line.948"></a>
+<span class="sourceLineNo">949</span>  public boolean[] exists(List&lt;Get&gt; gets) throws IOException {<a name="line.949"></a>
+<span class="sourceLineNo">950</span>    if (gets.isEmpty()) return new boolean[]{};<a name="line.950"></a>
+<span class="sourceLineNo">951</span>    if (gets.size() == 1) return new boolean[]{exists(gets.get(0))};<a name="line.951"></a>
+<span class="sourceLineNo">952</span><a name="line.952"></a>
+<span class="sourceLineNo">953</span>    ArrayList&lt;Get&gt; exists = new ArrayList&lt;&gt;(gets.size());<a name="line.953"></a>
+<span class="sourceLineNo">954</span>    for (Get g: gets){<a name="line.954"></a>
+<span class="sourceLineNo">955</span>      Get ge = new Get(g);<a name="line.955"></a>
+<span class="sourceLineNo">956</span>      ge.setCheckExistenceOnly(true);<a name="line.956"></a>
+<span class="sourceLineNo">957</span>      exists.add(ge);<a name="line.957"></a>
+<span class="sourceLineNo">958</span>    }<a name="line.958"></a>
+<span class="sourceLineNo">959</span><a name="line.959"></a>
+<span class="sourceLineNo">960</span>    Object[] r1= new Object[exists.size()];<a name="line.960"></a>
+<span class="sourceLineNo">961</span>    try {<a name="line.961"></a>
+<span class="sourceLineNo">962</span>      batch(exists, r1, readRpcTimeoutMs);<a name="line.962"></a>
+<span class="sourceLineNo">963</span>    } catch (InterruptedException e) {<a name="line.963"></a>
+<span class="sourceLineNo">964</span>      throw (InterruptedIOException)new InterruptedIOException().initCause(e);<a name="line.964"></a>
+<span class="sourceLineNo">965</span>    }<a name="line.965"></a>
+<span class="sourceLineNo">966</span><a name="line.966"></a>
+<span class="sourceLineNo">967</span>    // translate.<a name="line.967"></a>
+<span class="sourceLineNo">968</span>    boolean[] results = new boolean[r1.length];<a name="line.968"></a>
+<span class="sourceLineNo">969</span>    int i = 0;<a name="line.969"></a>
+<span class="sourceLineNo">970</span>    for (Object o : r1) {<a name="line.970"></a>
+<span class="sourceLineNo">971</span>      // batch ensures if there is a failure we get an exception instead<a name="line.971"></a>
+<span class="sourceLineNo">972</span>      results[i++] = ((Result)o).getExists();<a name="line.972"></a>
+<span class="sourceLineNo">973</span>    }<a name="line.973"></a>
+<span class="sourceLineNo">974</span><a name="line.974"></a>
+<span class="sourceLineNo">975</span>    return results;<a name="line.975"></a>
+<span class="sourceLineNo">976</span>  }<a name="line.976"></a>
 <span class="sourceLineNo">977</span><a name="line.977"></a>
-<span class="sourceLineNo">978</span>    return results;<a name="line.978"></a>
-<span class="sourceLineNo">979</span>  }<a name="line.979"></a>
-<span class="sourceLineNo">980</span><a name="line.980"></a>
-<span class="sourceLineNo">981</span>  /**<a name="line.981"></a>
-<span class="sourceLineNo">982</span>   * Process a mixed batch of Get, Put and Delete actions. All actions for a<a name="line.982"></a>
-<span class="sourceLineNo">983</span>   * RegionServer are forwarded in one RPC call. Queries are executed in parallel.<a name="line.983"></a>
-<span class="sourceLineNo">984</span>   *<a name="line.984"></a>
-<span class="sourceLineNo">985</span>   * @param list The collection of actions.<a name="line.985"></a>
-<span class="sourceLineNo">986</span>   * @param results An empty array, same size as list. If an exception is thrown,<a name="line.986"></a>
-<span class="sourceLineNo">987</span>   *   you can test here for partial results, and to determine which actions<a name="line.987"></a>
-<span class="sourceLineNo">988</span>   *   processed successfully.<a name="line.988"></a>
-<span class="sourceLineNo">989</span>   * @throws IOException if there are problems talking to META. Per-item<a name="line.989"></a>
-<span class="sourceLineNo">990</span>   *   exceptions are stored in the results array.<a name="line.990"></a>
-<span class="sourceLineNo">991</span>   */<a name="line.991"></a>
-<span class="sourceLineNo">992</span>  public &lt;R&gt; void processBatchCallback(<a name="line.992"></a>
-<span class="sourceLineNo">993</span>    final List&lt;? extends Row&gt; list, final Object[] results, final Batch.Callback&lt;R&gt; callback)<a name="line.993"></a>
-<span class="sourceLineNo">994</span>    throws IOException, InterruptedException {<a name="line.994"></a>
-<span class="sourceLineNo">995</span>    this.batchCallback(list, results, callback);<a name="line.995"></a>
-<span class="sourceLineNo">996</span>  }<a name="line.996"></a>
-<span class="sourceLineNo">997</span><a name="line.997"></a>
-<span class="sourceLineNo">998</span>  @Override<a name="line.998"></a>
-<span class="sourceLineNo">999</span>  public void close() throws IOException {<a name="line.999"></a>
-<span class="sourceLineNo">1000</span>    if (this.closed) {<a name="line.1000"></a>
-<span class="sourceLineNo">1001</span>      return;<a name="line.1001"></a>
-<span class="sourceLineNo">1002</span>    }<a name="line.1002"></a>
-<span class="sourceLineNo">1003</span>    if (cleanupPoolOnClose) {<a name="line.1003"></a>
-<span class="sourceLineNo">1004</span>      this.pool.shutdown();<a name="line.1004"></a>
-<span class="sourceLineNo">1005</span>      try {<a name="line.1005"></a>
-<span class="sourceLineNo">1006</span>        boolean terminated = false;<a name="line.1006"></a>
-<span class="sourceLineNo">1007</span>        do {<a name="line.1007"></a>
-<span class="sourceLineNo">1008</span>          // wait until the pool has terminated<a name="line.1008"></a>
-<span class="sourceLineNo">1009</span>          terminated = this.pool.awaitTermination(60, TimeUnit.SECONDS);<a name="line.1009"></a>
-<span class="sourceLineNo">1010</span>        } while (!terminated);<a name="line.1010"></a>
-<span class="sourceLineNo">1011</span>      } catch (InterruptedException e) {<a name="line.1011"></a>
-<span class="sourceLineNo">1012</span>        this.pool.shutdownNow();<a name="line.1012"></a>
-<span class="sourceLineNo">1013</span>        LOG.warn("waitForTermination interrupted");<a name="line.1013"></a>
-<span class="sourceLineNo">1014</span>      }<a name="line.1014"></a>
-<span class="sourceLineNo">1015</span>    }<a name="line.1015"></a>
-<span class="sourceLineNo">1016</span>    this.closed = true;<a name="line.1016"></a>
-<span class="sourceLineNo">1017</span>  }<a name="line.1017"></a>
-<span class="sourceLineNo">1018</span><a name="line.1018"></a>
-<span class="sourceLineNo">1019</span>  // validate for well-formedness<a name="line.1019"></a>
-<span class="sourceLineNo">1020</span>  public void validatePut(final Put put) throws IllegalArgumentException {<a name="line.1020"></a>
-<span class="sourceLineNo">1021</span>    validatePut(put, connConfiguration.getMaxKeyValueSize());<a name="line.1021"></a>
-<span class="sourceLineNo">1022</span>  }<a name="line.1022"></a>
-<span class="sourceLineNo">1023</span><a name="line.1023"></a>
-<span class="sourceLineNo">1024</span>  // validate for well-formedness<a name="line.1024"></a>
-<span class="sourceLineNo">1025</span>  public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {<a name="line.1025"></a>
-<span class="sourceLineNo">1026</span>    if (put.isEmpty()) {<a name="line.1026"></a>
-<span class="sourceLineNo">1027</span>      throw new IllegalArgumentException("No columns to insert");<a name="line.1027"></a>
-<span class="sourceLineNo">1028</span>    }<a name="line.1028"></a>
-<span class="sourceLineNo">1029</span>    if (maxKeyValueSize &gt; 0) {<a name="line.1029"></a>
-<span class="sourceLineNo">1030</span>      for (List&lt;Cell&gt; list : put.getFamilyCellMap().values()) {<a name="line.1030"></a>
-<span class="sourceLineNo">1031</span>        for (Cell cell : list) {<a name="line.1031"></a>
-<span class="sourceLineNo">1032</span>          if (KeyValueUtil.length(cell) &gt; maxKeyValueSize) {<a name="line.1032"></a>
-<span class="sourceLineNo">1033</span>            throw new IllegalArgumentException("KeyValue size too large");<a name="line.1033"></a>
-<span class="sourceLineNo">1034</span>          }<a name="line.1034"></a>
-<span class="sourceLineNo">1035</span>        }<a name="line.1035"></a>
-<span class="sourceLineNo">1036</span>      }<a name="line.1036"></a>
-<span class="sourceLineNo">1037</span>    }<a name="line.1037"></a>
-<span class="sourceLineNo">1038</span>  }<a name="line.1038"></a>
-<span class="sourceLineNo">1039</span><a name="line.1039"></a>
-<span class="sourceLineNo">1040</span>  /**<a name="line.1040"></a>
-<span class="sourceLineNo">1041</span>   * The pool is used for mutli requests for this HTable<a name="line.1041"></a>
-<span class="sourceLineNo">1042</span>   * @return the pool used for mutli<a name="line.1042"></a>
-<span class="sourceLineNo">1043</span>   */<a name="line.1043"></a>
-<span class="sourceLineNo">1044</span>  ExecutorService getPool() {<a name="line.1044"></a>
-<span class="sourceLineNo">1045</span>    return this.pool;<a name="line.1045"></a>
-<span class="sourceLineNo">1046</span>  }<a name="line.1046"></a>
-<span class="sourceLineNo">1047</span><a name="line.1047"></a>
-<span class="sourceLineNo">1048</span>  /**<a name="line.1048"></a>
-<span class="sourceLineNo">1049</span>   * Explicitly clears the region cache to fetch the latest value from META.<a name="line.1049"></a>
-<span class="sourceLineNo">1050</span>   * This is a power user function: avoid unless you know the ramifications.<a name="line.1050"></a>
-<span class="sourceLineNo">1051</span>   */<a name="line.1051"></a>
-<span class="sourceLineNo">1052</span>  public void clearRegionCache() {<a name="line.1052"></a>
-<span class="sourceLineNo">1053</span>    this.connection.clearRegionCache();<a name="line.1053"></a>
-<span class="sourceLineNo">1054</span>  }<a name="line.1054"></a>
-<span class="sourceLineNo">1055</span><a name="line.1055"></a>
-<span class="sourceLineNo">1056</span>  /**<a name="line.1056"></a>
-<span class="sourceLineNo">1057</span>   * {@inheritDoc}<a name="line.1057"></a>
-<span class="sourceLineNo">1058</span>   */<a name="line.1058"></a>
-<span class="sourceLineNo">1059</span>  @Override<a name="line.1059"></a>
-<span class="sourceLineNo">1060</span>  public CoprocessorRpcChannel coprocessorService(byte[] row) {<a name="line.1060"></a>
-<span class="sourceLineNo">1061</span>    return new RegionCoprocessorRpcChannel(connection, tableName, row);<a name="line.1061"></a>
-<span class="sourceLineNo">1062</span>  }<a name="line.1062"></a>
-<span class="sourceLineNo">1063</span><a name="line.1063"></a>
-<span class="sourceLineNo">1064</span>  /**<a name="line.1064"></a>
-<span class="sourceLineNo">1065</span>   * {@inheritDoc}<a name="line.1065"></a>
-<span class="sourceLineNo">1066</span>   */<a name="line.1066"></a>
-<span class="sourceLineNo">1067</span>  @Override<a name="line.1067"></a>
-<span class="sourceLineNo">1068</span>  public &lt;T extends Service, R&gt; Map&lt;byte[],R&gt; coprocessorService(final Class&lt;T&gt; service,<a name="line.1068"></a>
-<span class="sourceLineNo">1069</span>      byte[] startKey, byte[] endKey, final Batch.Call&lt;T,R&gt; callable)<a name="line.1069"></a>
-<span class="sourceLineNo">1070</span>      throws ServiceException, Throwable {<a name="line.1070"></a>
-<span class="sourceLineNo">1071</span>    final Map&lt;byte[],R&gt; results =  Collections.synchronizedMap(<a name="line.1071"></a>
-<span class="sourceLineNo">1072</span>        new TreeMap&lt;byte[], R&gt;(Bytes.BYTES_COMPARATOR));<a name="line.1072"></a>
-<span class="sourceLineNo">1073</span>    coprocessorService(service, startKey, endKey, callable, new Batch.Callback&lt;R&gt;() {<a name="line.1073"></a>
-<span class="sourceLineNo">1074</span>      @Override<a name="line.1074"></a>
-<span class="sourceLineNo">1075</span>      public void update(byte[] region, byte[] row, R value) {<a name="line.1075"></a>
-<span class="sourceLineNo">1076</span>        if (region != null) {<a name="line.1076"></a>
-<span class="sourceLineNo">1077</span>          results.put(region, value);<a name="line.1077"></a>
-<span class="sourceLineNo">1078</span>        }<a name="line.1078"></a>
-<span class="sourceLineNo">1079</span>      }<a name="line.1079"></a>
-<span class="sourceLineNo">1080</span>    });<a name="line.1080"></a>
-<span class="sourceLineNo">1081</span>    return results;<a name="line.1081"></a>
-<span class="sourceLineNo">1082</span>  }<a name="line.1082"></a>
-<span class="sourceLineNo">1083</span><a name="line.1083"></a>
-<span class="sourceLineNo">1084</span>  /**<a name="line.1084"></a>
-<span class="sourceLineNo">1085</span>   * {@inheritDoc}<a name="line.1085"></a>
-<span class="sourceLineNo">1086</span>   */<a name="line.1086"></a>
-<span class="sourceLineNo">1087</span>  @Override<a name="line.1087"></a>
-<span class="sourceLineNo">1088</span>  public &lt;T extends Service, R&gt; void coprocessorService(final Class&lt;T&gt; service,<a name="line.1088"></a>
-<span class="sourceLineNo">1089</span>      byte[] startKey, byte[] endKey, final Batch.Call&lt;T,R&gt; callable,<a name="line.1089"></a>
-<span class="sourceLineNo">1090</span>      final Batch.Callback&lt;R&gt; callback) throws ServiceException, Throwable {<a name="line.1090"></a>
-<span class="sourceLineNo">1091</span>    // get regions covered by the row range<a name="line.1091"></a>
-<span class="sourceLineNo">1092</span>    List&lt;byte[]&gt; keys = getStartKeysInRange(startKey, endKey);<a name="line.1092"></a>
-<span class="sourceLineNo">1093</span>    Map&lt;byte[],Future&lt;R&gt;&gt; futures = new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.1093"></a>
-<span class="sourceLineNo">1094</span>    for (final byte[] r : keys) {<a name="line.1094"></a>
-<span class="sourceLineNo">1095</span>      final RegionCoprocessorRpcChannel channel =<a name="line.1095"></a>
-<span class="sourceLineNo">1096</span>          new RegionCoprocessorRpcChannel(connection, tableName, r);<a name="line.1096"></a>
-<span class="sourceLineNo">1097</span>      Future&lt;R&gt; future = pool.submit(new Callable&lt;R&gt;() {<a name="line.1097"></a>
-<span class="sourceLineNo">1098</span>        @Override<a name="line.1098"></a>
-<span class="sourceLineNo">1099</span>        public R call() throws Exception {<a name="line.1099"></a>
-<span class="sourceLineNo">1100</span>          T instance =<a name="line.1100"></a>
-<span class="sourceLineNo">1101</span>              org.apache.hadoop.hbase.protobuf.ProtobufUtil.newServiceStub(service, channel);<a name="line.1101"></a>
-<span class="sourceLineNo">1102</span>          R result = callable.call(instance);<a name="line.1102"></a>
-<span class="sourceLineNo">1103</span>          byte[] region = channel.getLastRegion();<a name="line.1103"></a>
-<span class="sourceLineNo">1104</span>          if (callback != null) {<a name="line.1104"></a>
-<span class="sourceLineNo">1105</span>            callback.update(region, r, result);<a name="line.1105"></a>
-<span class="sourceLineNo">1106</span>          }<a name="line.1106"></a>
-<span class="sourceLineNo">1107</span>          return result;<a name="line.1107"></a>
-<span class="sourceLineNo">1108</span>        }<a name="line.1108"></a>
-<span class="sourceLineNo">1109</span>      });<a name="line.1109"></a>
-<span class="sourceLineNo">1110</span>      futures.put(r, future);<a name="line.1110"></a>
-<span class="sourceLineNo">1111</span>    }<a name="line.1111"></a>
-<span class="sourceLineNo">1112</span>    for (Map.Entry&lt;byte[],Future&lt;R&gt;&gt; e : futures.entrySet()) {<a name="line.1112"></a>
-<span class="sourceLineNo">1113</span>      try {<a name="line.1113"></a>
-<span class="sourceLineNo">1114</span>        e.getValue().get();<a name="line.1114"></a>
-<span class="sourceLineNo">1115</span>      } catch (ExecutionException ee) {<a name="line.1115"></a>
-<span class="sourceLineNo">1116</span>        LOG.warn("Error calling coprocessor service " + service.getName() + " for row "<a name="line.1116"></a>
-<span class="sourceLineNo">1117</span>            + Bytes.toStringBinary(e.getKey()), ee);<a name="line.1117"></a>
-<span class="sourceLineNo">1118</span>        throw ee.getCause();<a name="line.1118"></a>
-<span class="sourceLineNo">1119</span>      } catch (InterruptedException ie) {<a name="line.1119"></a>
-<span class="sourceLineNo">1120</span>        throw new InterruptedIOException("Interrupted calling coprocessor service "<a name="line.1120"></a>
-<span class="sourceLineNo">1121</span>            + service.getName() + " for row " + Bytes.toStringBinary(e.getKey())).initCause(ie);<a name="line.1121"></a>
-<span class="sourceLineNo">1122</span>      }<a name="line.1122"></a>
-<span class="sourceLineNo">1123</span>    }<a name="line.1123"></a>
-<span class="sourceLineNo">1124</span>  }<a name="line.1124"></a>
-<span class="sourceLineNo">1125</span><a name="line.1125"></a>
-<span class="sourceLineNo">1126</span>  private List&lt;byte[]&gt; getStartKeysInRange(byte[] start, byte[] end)<a name="line.1126"></a>
-<span class="sourceLineNo">1127</span>  throws IOException {<a name="line.1127"></a>
-<span class="sourceLineNo">1128</span>    if (start == null) {<a name="line.1128"></a>
-<span class="sourceLineNo">1129</span>      start = HConstants.EMPTY_START_ROW;<a name="line.1129"></a>
+<span class="sourceLineNo">978</span>  /**<a name="line.978"></a>
+<span class="sourceLineNo">979</span>   * Process a mixed batch of Get, Put and Delete actions. All actions for a<a name="line.979"></a>
+<span class="sourceLineNo">980</span>   * RegionServer are forwarded in one RPC call. Queries are executed in parallel.<a name="line.980"></a>
+<span class="sourceLineNo">981</span>   *<a name="line.981"></a>
+<span class="sourceLineNo">982</span>   * @param list The collection of actions.<a name="line.982"></a>
+<span class="sourceLineNo">983</span>   * @param results An empty array, same size as list. If an exception is thrown,<a name="line.983"></a>
+<span class="sourceLineNo">984</span>   *   you can test here for partial results, and to determine which actions<a name="line.984"></a>
+<span class="sourceLineNo">985</span>   *   processed successfully.<a name="line.985"></a>
+<span class="sourceLineNo">986</span>   * @throws IOException if there are problems talking to META. Per-item<a name="line.986"></a>
+<span class="sourceLineNo">987</span>   *   exceptions are stored in the results array.<a name="line.987"></a>
+<span class="sourceLineNo">988</span>   */<a name="line.988"></a>
+<span class="sourceLineNo">989</span>  public &lt;R&gt; void processBatchCallback(<a name="line.989"></a>
+<span class="sourceLineNo">990</span>    final List&lt;? extends Row&gt; list, final Object[] results, final Batch.Callback&lt;R&gt; callback)<a name="line.990"></a>
+<span class="sourceLineNo">991</span>    throws IOException, InterruptedException {<a name="line.991"></a>
+<span class="sourceLineNo">992</span>    this.batchCallback(list, results, callback);<a name="line.992"></a>
+<span class="sourceLineNo">993</span>  }<a name="line.993"></a>
+<span class="sourceLineNo">994</span><a name="line.994"></a>
+<span class="sourceLineNo">995</span>  @Override<a name="line.995"></a>
+<span class="sourceLineNo">996</span>  public void close() throws IOException {<a name="line.996"></a>
+<span class="sourceLineNo">997</span>    if (this.closed) {<a name="line.997"></a>
+<span class="sourceLineNo">998</span>      return;<a name="line.998"></a>
+<span class="sourceLineNo">999</span>    }<a name="line.999"></a>
+<span class="sourceLineNo">1000</span>    if (cleanupPoolOnClose) {<a name="line.1000"></a>
+<span class="sourceLineNo">1001</span>      this.pool.shutdown();<a name="line.1001"></a>
+<span class="sourceLineNo">1002</span>      try {<a name="line.1002"></a>
+<span class="sourceLineNo">1003</span>        boolean terminated = false;<a name="line.1003"></a>
+<span class="sourceLineNo">1004</span>        do {<a name="line.1004"></a>
+<span class="sourceLineNo">1005</span>          // wait until the pool has terminated<a name="line.1005"></a>
+<span class="sourceLineNo">1006</span>          terminated = this.pool.awaitTermination(60, TimeUnit.SECONDS);<a name="line.1006"></a>
+<span class="sourceLineNo">1007</span>        } while (!terminated);<a name="line.1007"></a>
+<span class="sourceLineNo">1008</span>      } catch (InterruptedException e) {<a name="line.1008"></a>
+<span class="sourceLineNo">1009</span>        this.pool.shutdownNow();<a name="line.1009"></a>
+<span class="sourceLineNo">1010</span>        LOG.warn("waitForTermination interrupted");<a name="line.1010"></a>
+<span class="sourceLineNo">1011</span>      }<a name="line.1011"></a>
+<span class="sourceLineNo">1012</span>    }<a name="line.1012"></a>
+<span class="sourceLineNo">1013</span>    this.closed = true;<a name="line.1013"></a>
+<span class="sourceLineNo">1014</span>  }<a name="line.1014"></a>
+<span class="sourceLineNo">1015</span><a name="line.1015"></a>
+<span class="sourceLineNo">1016</span>  // validate for well-formedness<a name="line.1016"></a>
+<span class="sourceLineNo">1017</span>  public void validatePut(final Put put) throws IllegalArgumentException {<a name="line.1017"></a>
+<span class="sourceLineNo">1018</span>    validatePut(put, connConfiguration.getMaxKeyValueSize());<a name="line.1018"></a>
+<span class="sourceLineNo">1019</span>  }<a name="line.1019"></a>
+<span class="sourceLineNo">1020</span><a name="line.1020"></a>
+<span class="sourceLineNo">1021</span>  // validate for well-formedness<a name="line.1021"></a>
+<span class="sourceLineNo">1022</span>  public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {<a name="line.1022"></a>
+<span class="sourceLineNo">1023</span>    if (put.isEmpty()) {<a name="line.1023"></a>
+<span class="sourceLineNo">1024</span>      throw new IllegalArgumentException("No columns to insert");<a name="line.1024"></a>
+<span class="sourceLineNo">1025</span>    }<a name="line.1025"></a>
+<span class="sourceLineNo">1026</span>    if (maxKeyValueSize &gt; 0) {<a name="line.1026"></a>
+<span class="sourceLineNo">1027</span>      for (List&lt;Cell&gt; list : put.getFamilyCellMap().values()) {<a name="line.1027"></a>
+<span class="sourceLineNo">1028</span>        for (Cell cell : list) {<a name="line.1028"></a>
+<span class="sourceLineNo">1029</span>          if (KeyValueUtil.length(cell) &gt; maxKeyValueSize) {<a name="line.1029"></a>
+<span class="sourceLineNo">1030</span>            throw new IllegalArgumentException("KeyValue size too large");<a name="line.1030"></a>
+<span class="sourceLineNo">1031</span>          }<a name="line.1031"></a>
+<span class="sourceLineNo">1032</span>        }<a name="line.1032"></a>
+<span class="sourceLineNo">1033</span>      }<a name="line.1033"></a>
+<span class="sourceLineNo">1034</span>    }<a name="line.1034"></a>
+<span class="sourceLineNo">1035</span>  }<a name="line.1035"></a>
+<span class="sourceLineNo">1036</span><a name="line.1036"></a>
+<span class="sourceLineNo">1037</span>  /**<a name="line.1037"></a>
+<span class="sourceLineNo">1038</span>   * The pool is used for mutli requests for this HTable<a name="line.1038"></a>
+<span class="sourceLineNo">1039</span>   * @return the pool used for mutli<a name="line.1039"></a>
+<span class="sourceLineNo">1040</span>   */<a name="line.1040"></a>
+<span class="sourceLineNo">1041</span>  ExecutorService getPool() {<a name="line.1041"></a>
+<span class="sourceLineNo">1042</span>    return this.pool;<a name="line.1042"></a>
+<span class="sourceLineNo">1043</span>  }<a name="line.1043"></a>
+<span class="sourceLineNo">1044</span><a name="line.1044"></a>
+<span class="sourceLineNo">1045</span>  /**<a name="line.1045"></a>
+<span class="sourceLineNo">1046</span>   * Explicitly clears the region cache to fetch the latest value from META.<a name="line.1046"></a>
+<span class="sourceLineNo">1047</span>   * This is a power user function: avoid unless you know the ramifications.<a name="line.1047"></a>
+<span class="sourceLineNo">1048</span>   */<a name="line.1048"></a>
+<span class="sourceLineNo">1049</span>  public void clearRegionCache() {<a name="line.1049"></a>
+<span class="sourceLineNo">1050</span>    this.connection.clearRegionCache();<a name="line.1050"></a>
+<span class="sourceLineNo">1051</span>  }<a name="line.1051"></a>
+<span class="sourceLineNo">1052</span><a name="line.1052"></a>
+<span class="sourceLineNo">1053</span>  /**<a name="line.1053"></a>
+<span class="sourceLineNo">1054</span>   * {@inheritDoc}<a name="line.1054"></a>
+<span class="sourceLineNo">1055</span>   */<a name="line.1055"></a>
+<span class="sourceLineNo">1056</span>  @Override<a name="line.1056"></a>
+<span class="sourceLineNo">1057</span>  public CoprocessorRpcChannel coprocessorService(byte[] row) {<a name="line.1057"></a>
+<span class="sourceLineNo">1058</span>    return new RegionCoprocessorRpcChannel(connection, tableName, row);<a name="line.1058"></a>
+<span class="sourceLineNo">1059</span>  }<a name="line.1059"></a>
+<span class="sourceLineNo">1060</span><a name="line.1060"></a>
+<span class="sourceLineNo">1061</span>  /**<a name="line.1061"></a>
+<span class="sourceLineNo">1062</span>   * {@inheritDoc}<a name="line.1062"></a>
+<span class="sourceLineNo">1063</span>   */<a name="line.1063"></a>
+<span class="sourceLineNo">1064</span>  @Override<a name="line.1064"></a>
+<span class="sourceLineNo">1065</span>  public &lt;T extends Service, R&gt; Map&lt;byte[],R&gt; coprocessorService(final Class&lt;T&gt; service,<a name="line.1065"></a>
+<span class="sourceLineNo">1066</span>      byte[] startKey, byte[] endKey, final Batch.Call&lt;T,R&gt; callable)<a name="line.1066"></a>
+<span class="sourceLineNo">1067</span>      throws ServiceException, Throwable {<a name="line.1067"></a>
+<span class="sourceLineNo">1068</span>    final Map&lt;byte[],R&gt; results =  Collections.synchronizedMap(<a name="line.1068"></a>
+<span class="sourceLineNo">1069</span>        new TreeMap&lt;byte[], R&gt;(Bytes.BYTES_COMPARATOR));<a name="line.1069"></a>
+<span class="sourceLineNo">1070</span>    coprocessorService(service, startKey, endKey, callable, new Batch.Callback&lt;R&gt;() {<a name="line.1070"></a>
+<span class="sourceLineNo">1071</span>      @Override<a name="line.1071"></a>
+<span class="sourceLineNo">1072</span>      public void update(byte[] region, byte[] row, R value) {<a name="line.1072"></a>
+<span class="sourceLineNo">1073</span>        if (region != null) {<a name="line.1073"></a>
+<span class="sourceLineNo">1074</span>          results.put(region, value);<a name="line.1074"></a>
+<span class="sourceLineNo">1075</span>        }<a name="line.1075"></a>
+<span class="sourceLineNo">1076</span>      }<a name="line.1076"></a>
+<span class="sourceLineNo">1077</span>    });<a name="line.1077"></a>
+<span class="sourceLineNo">1078</span>    return results;<a name="line.1078"></a>
+<span class="sourceLineNo">1079</span>  }<a name="line.1079"></a>
+<span class="sourceLineNo">1080</span><a name="line.1080"></a>
+<span class="sourceLineNo">1081</span>  /**<a name="line.1081"></a>
+<span class="sourceLineNo">1082</span>   * {@inheritDoc}<a name="line.1082"></a>
+<span class="sourceLineNo">1083</span>   */<a name="line.1083"></a>
+<span class="sourceLineNo">1084</span>  @Override<a name="line.1084"></a>
+<span class="sourceLineNo">1085</span>  public &lt;T extends Service, R&gt; void coprocessorService(final Class&lt;T&gt; service,<a name="line.1085"></a>
+<span class="sourceLineNo">1086</span>      byte[] startKey, byte[] endKey, final Batch.Call&lt;T,R&gt; callable,<a name="line.1086"></a>
+<span class="sourceLineNo">1087</span>      final Batch.Callback&lt;R&gt; callback) throws ServiceException, Throwable {<a name="line.1087"></a>
+<span class="sourceLineNo">1088</span>    // get regions covered by the row range<a name="line.1088"></a>
+<span class="sourceLineNo">1089</span>    List&lt;byte[]&gt; keys = getStartKeysInRange(startKey, endKey);<a name="line.1089"></a>
+<span class="sourceLineNo">1090</span>    Map&lt;byte[],Future&lt;R&gt;&gt; futures = new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.1090"></a>
+<span class="sourceLineNo">1091</span>    for (final byte[] r : keys) {<a name="line.1091"></a>
+<span class="sourceLineNo">1092</span>      final RegionCoprocessorRpcChannel channel =<a name="line.1092"></a>
+<span class="sourceLineNo">1093</span>          new RegionCoprocessorRpcChannel(connection, tableName, r);<a name="line.1093"></a>
+<span class="sourceLineNo">1094</span>      Future&lt;R&gt; future = pool.submit(new Callable&lt;R&gt;() {<a name="line.1094"></a>
+<span class="sourceLineNo">1095</span>        @Override<a name="line.1095"></a>
+<span class="sourceLineNo">1096</span>        public R call() throws Exception {<a name="line.1096"></a>
+<span class="sourceLineNo">1097</span>          T instance =<a name="line.1097"></a>
+<span class="sourceLineNo">1098</span>              org.apache.hadoop.hbase.protobuf.ProtobufUtil.newServiceStub(service, channel);<a name="line.1098"></a>
+<span class="sourceLineNo">1099</span>          R result = callable.call(instance);<a name="line.1099"></a>
+<span class="sourceLineNo">1100</span>          byte[] region = channel.getLastRegion();<a name="line.1100"></a>
+<span class="sourceLineNo">1101</span>          if (callback != null) {<a name="line.1101"></a>
+<span class="sourceLineNo">1102</span>            callback.update(region, r, result);<a name="line.1102"></a>
+<span class="sourceLineNo">1103</span>          }<a name="line.1103"></a>
+<span class="sourceLineNo">1104</span>          return result;<a name="line.1104"></a>
+<span class="sourceLineNo">1105</span>        }<a name="line.1105"></a>
+<span class="sourceLineNo">1106</span>      });<a name="line.1106"></a>
+<span class="sourceLineNo">1107</span>      futures.put(r, future);<a name="line.1107"></a>
+<span class="sourceLineNo">1108</span>    }<a name="line.1108"></a>
+<span class="sourceLineNo">1109</span>    for (Map.Entry&lt;byte[],Future&lt;R&gt;&gt; e : futures.entrySet()) {<a name="line.1109"></a>
+<span class="sourceLineNo">1110</span>      try {<a name="line.1110"></a>
+<span class="sourceLineNo">1111</span>        e.getValue().get();<a name="line.1111"></a>
+<span class="sourceLineNo">1112</span>      } catch (ExecutionException ee) {<a name="line.1112"></a>
+<span class="sourceLineNo">1113</span>        LOG.warn("Error calling coprocessor service " + service.getName() + " for row "<a name="line.1113"></a>
+<span class="sourceLineNo">1114</span>            + Bytes.toStringBinary(e.getKey()), ee);<a name="line.1114"></a>
+<span class="sourceLineNo">1115</span>        throw ee.getCause();<a name="line.1115"></a>
+<span class="sourceLineNo">1116</span>      } catch (InterruptedException ie) {<a name="line.1116"></a>
+<span class="sourceLineNo">1117</span>        throw new InterruptedIOException("Interrupted calling coprocessor service "<a name="line.1117"></a>
+<span class="sourceLineNo">1118</span>            + service.getName() + " for row " + Bytes.toStringBinary(e.getKey())).initCause(ie);<a name="line.1118"></a>
+<span class="sourceLineNo">1119</span>      }<a name="line.1119"></a>
+<span class="sourceLineNo">1120</span>    }<a name="line.1120"></a>
+<span class="sourceLineNo">1121</span>  }<a name="line.1121"></a>
+<span class="sourceLineNo">1122</span><a name="line.1122"></a>
+<span class="sourceLineNo">1123</span>  private List&lt;byte[]&gt; getStartKeysInRange(byte[] start, byte[] end)<a name="line.1123"></a>
+<span class="sourceLineNo">1124</span>  throws IOException {<a name="line.1124"></a>
+<span class="sourceLineNo">1125</span>    if (start == null) {<a name="line.1125"></a>
+<span class="sourceLineNo">1126</span>      start = HConstants.EMPTY_START_ROW;<a name="line.1126"></a>
+<span class="sourceLineNo">1127</span>    }<a name="line.1127"></a>
+<span class="sourceLineNo">1128</span>    if (end == null) {<a name="line.1128"></a>
+<span class="sourceLineNo">1129</span>      end = HConstants.EMPTY_END_ROW;<a name="line.1129"></a>
 <span class="sourceLineNo">1130</span>    }<a name="line.1130"></a>
-<span class="sourceLineNo">1131</span>    if (end == null) {<a name="line.1131"></a>
-<span class="sourceLineNo">1132</span>      end = HConstants.EMPTY_END_ROW;<a name="line.1132"></a>
-<span class="sourceLineNo">1133</span>    }<a name="line.1133"></a>
-<span class="sourceLineNo">1134</span>    return getKeysAndRegionsInRange(start, end, true).getFirst();<a name="line.1134"></a>
-<span class="sourceLineNo">1135</span>  }<a name="line.1135"></a>
-<span class="sourceLineNo">1136</span><a name="line.1136"></a>
-<span class="sourceLineNo">1137</span>  @Override<a name="line.1137"></a>
-<span class="sourceLineNo">1138</span>  public long getRpcTimeout(TimeUnit unit) {<a name="line.1138"></a>
-<span class="sourceLineNo">1139</span>    return unit.convert(rpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1139"></a>
-<span class="sourceLineNo">1140</span>  }<a name="line.1140"></a>
-<span class="sourceLineNo">1141</span><a name="line.1141"></a>
-<span class="sourceLineNo">1142</span>  @Override<a name="line.1142"></a>
-<span class="sourceLineNo">1143</span>  @Deprecated<a name="line.1143"></a>
-<span class="sourceLineNo">1144</span>  public int getRpcTimeout() {<a name="line.1144"></a>
-<span class="sourceLineNo">1145</span>    return rpcTimeoutMs;<a name="line.1145"></a>
-<span class="sourceLineNo">1146</span>  }<a name="line.1146"></a>
-<span class="sourceLineNo">1147</span><a name="line.1147"></a>
-<span class="sourceLineNo">1148</span>  @Override<a name="line.1148"></a>
-<span class="sourceLineNo">1149</span>  @Deprecated<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>  public void setRpcTimeout(int rpcTimeout) {<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span>    setReadRpcTimeout(rpcTimeout);<a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>    setWriteRpcTimeout(rpcTimeout);<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span>  }<a name="line.1153"></a>
-<span class="sourceLineNo">1154</span><a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>  @Override<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>  public long getReadRpcTimeout(TimeUnit unit) {<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>    return unit.convert(readRpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span>  }<a name="line.1158"></a>
-<span class="sourceLineNo">1159</span><a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>  @Override<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>  @Deprecated<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>  public int getReadRpcTimeout() {<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span>    return readRpcTimeoutMs;<a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>  }<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span><a name="line.1165"></a>
-<span class="sourceLineNo">1166</span>  @Override<a name="line.1166"></a>
-<span class="sourceLineNo">1167</span>  @Deprecated<a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>  public void setReadRpcTimeout(int readRpcTimeout) {<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>    this.readRpcTimeoutMs = readRpcTimeout;<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span>  }<a name="line.1170"></a>
-<span class="sourceLineNo">1171</span><a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>  @Override<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>  public long getWriteRpcTimeout(TimeUnit unit) {<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span>    return unit.convert(writeRpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1174"></a>
-<span class="sourceLineNo">1175</span>  }<a name="line.1175"></a>
-<span class="sourceLineNo">1176</span><a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>  @Override<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>  @Deprecated<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>  public int getWriteRpcTimeout() {<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>    return writeRpcTimeoutMs;<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>  }<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span><a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>  @Override<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span>  @Deprecated<a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>  public void setWriteRpcTimeout(int writeRpcTimeout) {<a name="line.1185"></a>
-<span class="sourceLineNo">1186</span>    this.writeRpcTimeoutMs = writeRpcTimeout;<a name="line.1186"></a>
-<span class="sourceLineNo">1187</span>  }<a name="line.1187"></a>
-<span class="sourceLineNo">1188</span><a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>  @Override<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>  public long getOperationTimeout(TimeUnit unit) {<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>    return unit.convert(operationTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span>  }<a name="line.1192"></a>
-<span class="sourceLineNo">1193</span><a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>  @Override<a name="line.1194"></a>
-<span class="sourceLineNo">1195</span>  @Deprecated<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span>  public int getOperationTimeout() {<a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>    return operationTimeoutMs;<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>  }<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span><a name="line.1199"></a>
-<span class="sourceLineNo">1200</span>  @Override<a name="line.1200"></a>
-<span class="sourceLineNo">1201</span>  @Deprecated<a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>  public void setOperationTimeout(int operationTimeout) {<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>    this.operationTimeoutMs = operationTimeout;<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>  }<a name="line.1204"></a>
-<span class="sourceLineNo">1205</span><a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>  @Override<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>  public String toString() {<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>    return tableName + ";" + connection;<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>  }<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span><a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>  @Override<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>  public &lt;R extends Message&gt; Map&lt;byte[], R&gt; batchCoprocessorService(<a name="line.1212"></a>
-<span class="sourceLineNo">1213</span>      Descriptors.MethodDescriptor methodDescriptor, Message request,<a name="line.1213"></a>
-<span class="sourceLineNo">1214</span>      byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable {<a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>    final Map&lt;byte[], R&gt; results = Collections.synchronizedMap(new TreeMap&lt;byte[], R&gt;(<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>        Bytes.BYTES_COMPARATOR));<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>    batchCoprocessorService(methodDescriptor, request, startKey, endKey, responsePrototype,<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>        new Callback&lt;R&gt;() {<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>      @Override<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>      public void update(byte[] region, byte[] row, R result) {<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>        if (region != null) {<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>          results.put(region, result);<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>        }<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>      }<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>    });<a name="line.1225"></a>
-<span class="sourceLineNo">1226</span>    return results;<a name="line.1226"></a>
-<span class="sourceLineNo">1227</span>  }<a name="line.1227"></a>
-<span class="sourceLineNo">1228</span><a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>  /**<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>   * {@inheritDoc}<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span>   */<a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>  @Override<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>  public &lt;R extends Message&gt; void batchCoprocessorService(<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>      final Descriptors.MethodDescriptor methodDescriptor, final Message request,<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>      byte[] startKey, byte[] endKey, final R responsePrototype, final Callback&lt;R&gt; callback)<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>      throws ServiceException, Throwable {<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span><a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>    if (startKey == null) {<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>      startKey = HConstants.EMPTY_START_ROW;<a name="line.1239"></a>
+<span class="sourceLineNo">1131</span>    return getKeysAndRegionsInRange(start, end, true).getFirst();<a name="line.1131"></a>
+<span class="sourceLineNo">1132</span>  }<a name="line.1132"></a>
+<span class="sourceLineNo">1133</span><a name="line.1133"></a>
+<span class="sourceLineNo">1134</span>  @Override<a name="line.1134"></a>
+<span class="sourceLineNo">1135</span>  public long getRpcTimeout(TimeUnit unit) {<a name="line.1135"></a>
+<span class="sourceLineNo">1136</span>    return unit.convert(rpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1136"></a>
+<span class="sourceLineNo">1137</span>  }<a name="line.1137"></a>
+<span class="sourceLineNo">1138</span><a name="line.1138"></a>
+<span class="sourceLineNo">1139</span>  @Override<a name="line.1139"></a>
+<span class="sourceLineNo">1140</span>  @Deprecated<a name="line.1140"></a>
+<span class="sourceLineNo">1141</span>  public int getRpcTimeout() {<a name="line.1141"></a>
+<span class="sourceLineNo">1142</span>    return rpcTimeoutMs;<a name="line.1142"></a>
+<span class="sourceLineNo">1143</span>  }<a name="line.1143"></a>
+<span class="sourceLineNo">1144</span><a name="line.1144"></a>
+<span class="sourceLineNo">1145</span>  @Override<a name="line.1145"></a>
+<span class="sourceLineNo">1146</span>  @Deprecated<a name="line.1146"></a>
+<span class="sourceLineNo">1147</span>  public void setRpcTimeout(int rpcTimeout) {<a name="line.1147"></a>
+<span class="sourceLineNo">1148</span>    setReadRpcTimeout(rpcTimeout);<a name="line.1148"></a>
+<span class="sourceLineNo">1149</span>    setWriteRpcTimeout(rpcTimeout);<a name="line.1149"></a>
+<span class="sourceLineNo">1150</span>  }<a name="line.1150"></a>
+<span class="sourceLineNo">1151</span><a name="line.1151"></a>
+<span class="sourceLineNo">1152</span>  @Override<a name="line.1152"></a>
+<span class="sourceLineNo">1153</span>  public long getReadRpcTimeout(TimeUnit unit) {<a name="line.1153"></a>
+<span class="sourceLineNo">1154</span>    return unit.convert(readRpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1154"></a>
+<span class="sourceLineNo">1155</span>  }<a name="line.1155"></a>
+<span class="sourceLineNo">1156</span><a name="line.1156"></a>
+<span class="sourceLineNo">1157</span>  @Override<a name="line.1157"></a>
+<span class="sourceLineNo">1158</span>  @Deprecated<a name="line.1158"></a>
+<span class="sourceLineNo">1159</span>  public int getReadRpcTimeout() {<a name="line.1159"></a>
+<span class="sourceLineNo">1160</span>    return readRpcTimeoutMs;<a name="line.1160"></a>
+<span class="sourceLineNo">1161</span>  }<a name="line.1161"></a>
+<span class="sourceLineNo">1162</span><a name="line.1162"></a>
+<span class="sourceLineNo">1163</span>  @Override<a name="line.1163"></a>
+<span class="sourceLineNo">1164</span>  @Deprecated<a name="line.1164"></a>
+<span class="sourceLineNo">1165</span>  public void setReadRpcTimeout(int readRpcTimeout) {<a name="line.1165"></a>
+<span class="sourceLineNo">1166</span>    this.readRpcTimeoutMs = readRpcTimeout;<a name="line.1166"></a>
+<span class="sourceLineNo">1167</span>  }<a name="line.1167"></a>
+<span class="sourceLineNo">1168</span><a name="line.1168"></a>
+<span class="sourceLineNo">1169</span>  @Override<a name="line.1169"></a>
+<span class="sourceLineNo">1170</span>  public long getWriteRpcTimeout(TimeUnit unit) {<a name="line.1170"></a>
+<span class="sourceLineNo">1171</span>    return unit.convert(writeRpcTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1171"></a>
+<span class="sourceLineNo">1172</span>  }<a name="line.1172"></a>
+<span class="sourceLineNo">1173</span><a name="line.1173"></a>
+<span class="sourceLineNo">1174</span>  @Override<a name="line.1174"></a>
+<span class="sourceLineNo">1175</span>  @Deprecated<a name="line.1175"></a>
+<span class="sourceLineNo">1176</span>  public int getWriteRpcTimeout() {<a name="line.1176"></a>
+<span class="sourceLineNo">1177</span>    return writeRpcTimeoutMs;<a name="line.1177"></a>
+<span class="sourceLineNo">1178</span>  }<a name="line.1178"></a>
+<span class="sourceLineNo">1179</span><a name="line.1179"></a>
+<span class="sourceLineNo">1180</span>  @Override<a name="line.1180"></a>
+<span class="sourceLineNo">1181</span>  @Deprecated<a name="line.1181"></a>
+<span class="sourceLineNo">1182</span>  public void setWriteRpcTimeout(int writeRpcTimeout) {<a name="line.1182"></a>
+<span class="sourceLineNo">1183</span>    this.writeRpcTimeoutMs = writeRpcTimeout;<a name="line.1183"></a>
+<span class="sourceLineNo">1184</span>  }<a name="line.1184"></a>
+<span class="sourceLineNo">1185</span><a name="line.1185"></a>
+<span class="sourceLineNo">1186</span>  @Override<a name="line.1186"></a>
+<span class="sourceLineNo">1187</span>  public long getOperationTimeout(TimeUnit unit) {<a name="line.1187"></a>
+<span class="sourceLineNo">1188</span>    return unit.convert(operationTimeoutMs, TimeUnit.MILLISECONDS);<a name="line.1188"></a>
+<span class="sourceLineNo">1189</span>  }<a name="line.1189"></a>
+<span class="sourceLineNo">1190</span><a name="line.1190"></a>
+<span class="sourceLineNo">1191</span>  @Override<a name="line.1191"></a>
+<span class="sourceLineNo">1192</span>  @Deprecated<a name="line.1192"></a>
+<span class="sourceLineNo">1193</span>  public int getOperationTimeout() {<a name="line.1193"></a>
+<span class="sourceLineNo">1194</span>    return operationTimeoutMs;<a name="line.1194"></a>
+<span class="sourceLineNo">1195</span>  }<a name="line.1195"></a>
+<span class="sourceLineNo">1196</span><a name="line.1196"></a>
+<span class="sourceLineNo">1197</span>  @Override<a name="line.1197"></a>
+<span class="sourceLineNo">1198</span>  @Deprecated<a name="line.1198"></a>
+<span class="sourceLineNo">1199</span>  public void setOperationTimeout(int operationTimeout) {<a name="line.1199"></a>
+<span class="sourceLineNo">1200</span>    this.operationTimeoutMs = operationTimeout;<a name="line.1200"></a>
+<span class="sourceLineNo">1201</span>  }<a name="line.1201"></a>
+<span class="sourceLineNo">1202</span><a name="line.1202"></a>
+<span class="sourceLineNo">1203</span>  @Override<a name="line.1203"></a>
+<span class="sourceLineNo">1204</span>  public String toString() {<a name="line.1204"></a>
+<span class="sourceLineNo">1205</span>    return tableName + ";" + connection;<a name="line.1205"></a>
+<span class="sourceLineNo">1206</span>  }<a name="line.1206"></a>
+<span class="sourceLineNo">1207</span><a name="line.1207"></a>
+<span class="sourceLineNo">1208</span>  @Override<a name="line.1208"></a>
+<span class="sourceLineNo">1209</span>  public &lt;R extends Message&gt; Map&lt;byte[], R&gt; batchCoprocessorService(<a name="line.1209"></a>
+<span class="sourceLineNo">1210</span>      Descriptors.MethodDescriptor methodDescriptor, Message request,<a name="line.1210"></a>
+<span class="sourceLineNo">1211</span>      byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable {<a name="line.1211"></a>
+<span class="sourceLineNo">1212</span>    final Map&lt;byte[], R&gt; results = Collections.synchronizedMap(new TreeMap&lt;byte[], R&gt;(<a name="line.1212"></a>
+<span class="sourceLineNo">1213</span>        Bytes.BYTES_COMPARATOR));<a name="line.1213"></a>
+<span class="sourceLineNo">1214</span>    batchCoprocessorService(methodDescriptor, request, startKey, endKey, responsePrototype,<a name="line.1214"></a>
+<span class="sourceLineNo">1215</span>        new Callback&lt;R&gt;() {<a name="line.1215"></a>
+<span class="sourceLineNo">1216</span>      @Override<a name="line.1216"></a>
+<span class="sourceLineNo">1217</span>      public void update(byte[] region, byte[] row, R result) {<a name="line.1217"></a>
+<span class="sourceLineNo">1218</span>        if (region != null) {<a name="line.1218"></a>
+<span class="sourceLineNo">1219</span>          results.put(region, result);<a name="line.1219"></a>
+<span class="sourceLineNo">1220</span>        }<a name="line.1220"></a>
+<span class="sourceLineNo">1221</span>      }<a name="line.1221"></a>
+<span class="sourceLineNo">1222</span>    });<a name="line.1222"></a>
+<span class="sourceLineNo">1223</span>    return results;<a name="line.1223"></a>
+<span class="sourceLineNo">1224</span>  }<a name="line.1224"></a>
+<span class="sourceLineNo">1225</span><a name="line.1225"></a>
+<span class="sourceLineNo">1226</span>  /**<a name="line.1226"></a>
+<span class="sourceLineNo">1227</span>   * {@inheritDoc}<a name="line.1227"></a>
+<span class="sourceLineNo">1228</span>   */<a name="line.1228"></a>
+<span class="sourceLineNo">1229</span>  @Override<a name="line.1229"></a>
+<span class="sourceLineNo">1230</span>  public &lt;R extends Message&gt; void batchCoprocessorService(<a name="line.1230"></a>
+<span class="sourceLineNo">1231</span>      final Descriptors.MethodDescriptor methodDescriptor, final Message request,<a name="line.1231"></a>
+<span class="sourceLineNo">1232</span>      byte[] startKey, byte[] endKey, final R responsePrototype, final Callback&lt;R&gt; callback)<a name="line.1232"></a>
+<span class="sourceLineNo">1233</span>      throws ServiceException, Throwable {<a name="line.1233"></a>
+<span class="sourceLineNo">1234</span><a name="line.1234"></a>
+<span class="sourceLineNo">1235</span>    if (startKey == null) {<a name="line.1235"></a>
+<span class="sourceLineNo">1236</span>      startKey = HConstants.EMPTY_START_ROW;<a name="line.1236"></a>
+<span class="sourceLineNo">1237</span>    }<a name="line.1237"></a>
+<span class="sourceLineNo">1238</span>    if (endKey == null) {<a name="line.1238"></a>
+<span class="sourceLineNo">1239</span>      endKey = HConstants.EMPTY_END_ROW;<a name="line.1239"></a>
 <span class="sourceLineNo">1240</span>    }<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span>    if (endKey == null) {<a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>      endKey = HConstants.EMPTY_END_ROW;<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>    }<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>    // get regions covered by the row range<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>    Pair&lt;List&lt;byte[]&gt;, List&lt;HRegionLocation&gt;&gt; keysAndRegions =<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>        getKeysAndRegionsInRange(startKey, endKey, true);<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>    List&lt;byte[]&gt; keys = keysAndRegions.getFirst();<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>    List&lt;HRegionLocation&gt; regions = keysAndRegions.getSecond();<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span><a name="line.1249"></a>
-<span class="sourceLineNo">1250</span>    // check if we have any calls to make<a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>    if (keys.isEmpty()) {<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>      LOG.info("No regions were selected by key range start=" + Bytes.toStringBinary(startKey) +<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>          ", end=" + Bytes.toStringBinary(endKey));<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>      return;<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>    }<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span><a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>    List&lt;RegionCoprocessorServiceExec&gt; execs = new ArrayList&lt;&gt;(keys.size());<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>    final Map&lt;byte[], RegionCoprocessorServiceExec&gt; execsByRow = new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span>    for (int i = 0; i &lt; keys.size(); i++) {<a name="line.1259"></a>
-<span class="sourceLineNo">1260</span>      final byte[] rowKey = keys.get(i);<a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>      final byte[] region = regions.get(i).getRegionInfo().getRegionName();<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span>      RegionCoprocessorServiceExec exec =<a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>          new RegionCoprocessorServiceExec(region, rowKey, methodDescriptor, request);<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>      execs.add(exec);<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>      execsByRow.put(rowKey, exec);<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>    }<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span><a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>    // tracking for any possible deserialization errors on success callback<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>    // TODO: it would be better to be able to reuse AsyncProcess.BatchErrors here<a name="line.1269"></a>
-<span class="sourceLineNo">1270</span>    final List&lt;Throwable&gt; callbackErrorExceptions = new ArrayList&lt;&gt;();<a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>    final List&lt;Row&gt; callbackErrorActions = new ArrayList&lt;&gt;();<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span>    final List&lt;String&gt; callbackErrorServers = new ArrayList&lt;&gt;();<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>    Object[] results = new Object[execs.size()];<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span><a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>    AsyncProcess asyncProcess =<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>        new AsyncProcess(connection, configuration,<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>            RpcRetryingCallerFactory.instantiate(configuration, connection.getStatisticsTracker()),<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>            true, RpcControllerFactory.instantiate(configuration));<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span><a name="line.1279"></a>
-<span class="sourceLineNo">1280</span>    Callback&lt;ClientProtos.CoprocessorServiceResult&gt; resultsCallback<a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>    = (byte[] region, byte[] row, ClientProtos.CoprocessorServiceResult serviceResult) -&gt; {<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>      if (LOG.isTraceEnabled()) {<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span>        LOG.trace("Received result for endpoint " + methodDescriptor.getFullName() +<a name="line.1283"></a>
-<span class="sourceLineNo">1284</span>            ": region=" + Bytes.toStringBinary(region) +<a name="line.1284"></a>
-<span class="sourceLineNo">1285</span>            ", row=" + Bytes.toStringBinary(row) +<a name="line.1285"></a>
-<span class="sourceLineNo">1286</span>            ", value=" + serviceResult.getValue().getValue());<a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>      }<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>      try {<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>        Message.Builder builder = responsePrototype.newBuilderForType();<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>        org.apache.hadoop.hbase.protobuf.ProtobufUtil.mergeFrom(builder,<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>            serviceResult.getValue().getValue().toByteArray());<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>        callback.update(region, row, (R) builder.build());<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>      } catch (IOException e) {<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>        LOG.error("Unexpected response type from endpoint " + methodDescriptor.getFullName(),<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>            e);<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span>        callbackErrorExceptions.add(e);<a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>        callbackErrorActions.add(execsByRow.get(row));<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>        callbackErrorServers.add("null");<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>      }<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>    };<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>    AsyncProcessTask&lt;ClientProtos.CoprocessorServiceResult&gt; task =<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>        AsyncProcessTask.newBuilder(resultsCallback)<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>            .setPool(pool)<a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>            .setTableName(tableName)<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>            .setRowAccess(execs)<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>            .setResults(results)<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span>            .setRpcTimeout(readRpcTimeoutMs)<a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>            .setOperationTimeout(operationTimeoutMs)<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>            .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>            .build();<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>    AsyncRequestFuture future = asyncProcess.submit(task);<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>    future.waitUntilDone();<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span><a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>    if (future.hasError()) {<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>      throw future.getErrors();<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>    } else if (!callbackErrorExceptions.isEmpty()) {<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>      throw new RetriesExhaustedWithDetailsException(callbackErrorExceptions, callbackErrorActions,<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>          callbackErrorServers);<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>    }<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>  }<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span><a name="line.1321"></a>
-<span class="sourceLineNo">1322</span>  public RegionLocator getRegionLocator() {<a name="line.1322"></a>
-<span class="sourceLineNo">1323</span>    return this.locator;<a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>  }<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>}<a name="line.1325"></a>
+<span class="sourceLineNo">1241</span>    // get regions covered by the row range<a name="line.1241"></a>
+<span class="sourceLineNo">1242</span>    Pair&lt;List&lt;byte[]&gt;, List&lt;HRegionLocation&gt;&gt; keysAndRegions =<a name="line.1242"></a>
+<span class="sourceLineNo">1243</span>        getKeysAndRegionsInRange(startKey, endKey, true);<a name="line.1243"></a>
+<span class="sourceLineNo">1244</span>    List&lt;byte[]&gt; keys = keysAndRegions.getFirst();<a name="line.1244"></a>
+<span class="sourceLineNo">1245</span>    List&lt;HRegionLocation&gt; regions = keysAndRegions.getSecond();<a name="line.1245"></a>
+<span class="sourceLineNo">1246</span><a name="line.1246"></a>
+<span class="sourceLineNo">1247</span>    // check if we have any calls to make<a name="line.1247"></a>
+<span class="sourceLineNo">1248</span>    if (keys.isEmpty()) {<a name="line.1248"></a>
+<span class="sourceLineNo">1249</span>      LOG.info("No regions were selected by key range start=" + Bytes.toStringBinary(startKey) +<a name="line.1249"></a>
+<span class="sourceLineNo">1250</span>          ", end=" + Bytes.toStringBinary(endKey));<a name="line.1250"></a>
+<span class="sourceLineNo">1251</span>      return;<a name="line.1251"></a>
+<span class="sourceLineNo">1252</span>    }<a name="line.1252"></a>
+<span class="sourceLineNo">1253</span><a name="line.1253"></a>
+<span class="sourceLineNo">1254</span>    List&lt;RegionCoprocessorServiceExec&gt; execs = new ArrayList&lt;&gt;(keys.size());<a name="line.1254"></a>
+<span class="sourceLineNo">1255</span>    final Map&lt;byte[], RegionCoprocessorServiceExec&gt; execsByRow = new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.1255"></a>
+<span class="sourceLineNo">1256</span>    for (int i = 0; i &lt; keys.size(); i++) {<a name="line.1256"></a>
+<span class="sourceLineNo">1257</span>      final byte[] rowKey = keys.get(i);<a name="line.1257"></a>
+<span class="sourceLineNo">1258</span>      final byte[] region = regions.get(i).getRegionInfo().getRegionName();<a name="line.1258"></a>
+<span class="sourceLineNo">1259</span>      RegionCoprocessorServiceExec exec =<a name="line.1259"></a>
+<span class="sourceLineNo">1260</span>          new RegionCoprocessorServiceExec(region, rowKey, methodDescriptor, request);<a name="line.1260"></a>
+<span class="sourceLineNo">1261</span>      execs.add(exec);<a name="line.1261"></a>
+<span class="sourceLineNo">1262</span>      execsByRow.put(rowKey, exec);<a name="line.1262"></a>
+<span class="sourceLineNo">1263</span>    }<a name="line.1263"></a>
+<span class="sourceLineNo">1264</span><a name="line.1264"></a>
+<span class="sourceLineNo">1265</span>    // tracking for any possible deserialization errors on success callback<a name="line.1265"></a>
+<span class="sourceLineNo">1266</span>    // TODO: it would be better to be able to reuse AsyncProcess.BatchErrors here<a name="line.1266"></a>
+<span class="sourceLineNo">1267</span>    final List&lt;Throwable&gt; callbackErrorExceptions = new ArrayList&lt;&gt;();<a name="line.1267"></a>
+<span class="sourceLineNo">1268</span>    final List&lt;Row&gt; callbackErrorActions = new ArrayList&lt;&gt;();<a name="line.1268"></a>
+<span class="sourceLineNo">1269</span>    final List&lt;String&gt; callbackErrorServers = new ArrayList&lt;&gt;();<a name="line.1269"></a>
+<span class="sourceLineNo">1270</span>    Object[] results = new Object[execs.size()];<a name="line.1270"></a>
+<span class="sourceLineNo">1271</span><a name="line.1271"></a>
+<span class="sourceLineNo">1272</span>    AsyncProcess asyncProcess =<a name="line.1272"></a>
+<span class="sourceLineNo">1273</span>        new AsyncProcess(connection, configuration,<a name="line.1273"></a>
+<span class="sourceLineNo">1274</span>            RpcRetryingCallerFactory.instantiate(configuration, connection.getStatisticsTracker()),<a name="line.1274"></a>
+<span class="sourceLineNo">1275</span>            true, RpcControllerFactory.instantiate(configuration));<a name="line.1275"></a>
+<span class="sourceLineNo">1276</span><a name="line.1276"></a>
+<span class="sourceLineNo">1277</span>    Callback&lt;ClientProtos.CoprocessorServiceResult&gt; resultsCallback<a name="line.1277"></a>
+<span class="sourceLineNo">1278</span>    = (byte[] region, byte[] row, ClientProtos.CoprocessorServiceResult serviceResult) -&gt; {<a name="line.1278"></a>
+<span class="sourceLineNo">1279</span>      if (LOG.isTraceEnabled()) {<a name="line.1279"></a>
+<span class="sourceLineNo">1280</span>        LOG.trace("Received result for endpoint " + methodDescriptor.getFullName() +<a name="line.1280"></a>
+<span class="sourceLineNo">1281</span>            ": region=" + Bytes.toStringBinary(region) +<a name="line.1281"></a>
+<span class="sourceLineNo">1282</span>            ", row=" + Bytes.toStringBinary(row) +<a name="line.1282"></a>
+<span class="sourceLineNo">1283</span>            ", value=" + serviceResult.getValue().getValue());<a name="line.1283"></a>
+<span class="sourceLineNo">1284</span>      }<a name="line.1284"></a>
+<span class="sourceLineNo">1285</span>      try {<a name="line.1285"></a>
+<span class="sourceLineNo">1286</span>        Message.Builder builder = responsePrototype.newBuilderForType();<a name="line.1286"></a>
+<span class="sourceLineNo">1287</span>        org.apache.hadoop.hbase.protobuf.ProtobufUtil.mergeFrom(builder,<a name="line.1287"></a>
+<span class="sourceLineNo">1288</span>            serviceResult.getValue().getValue().toByteArray());<a name="line.1288"></a>
+<span class="sourceLineNo">1289</span>        callback.update(region, row, (R) builder.build());<a name="line.1289"></a>
+<span class="sourceLineNo">1290</span>      } catch (IOException e) {<a name="line.1290"></a>
+<span class="sourceLineNo">1291</span>        LOG.error("Unexpected response type from endpoint " + methodDescriptor.getFullName(),<a name="line.1291"></a>
+<span class="sourceLineNo">1292</span>            e);<a name="line.1292"></a>
+<span class="sourceLineNo">1293</span>        callbackErrorExceptions.add(e);<a name="line.1293"></a>
+<span class="sourceLineNo">1294</span>        callbackErrorActions.add(execsByRow.get(row));<a name="line.1294"></a>
+<span class="sourceLineNo">1295</span>        callbackErrorServers.add("null");<a name="line.1295"></a>
+<span class="sourceLineNo">1296</span>      }<a name="line.1296"></a>
+<span class="sourceLineNo">1297</span>    };<a name="line.1297"></a>
+<span class="sourceLineNo">1298</span>    AsyncProcessTask&lt;ClientProtos.CoprocessorServiceResult&gt; task =<a name="line.1298"></a>
+<span class="sourceLineNo">1299</span>        AsyncProcessTask.newBuilder(resultsCallback)<a name="line.1299"></a>
+<span class="sourceLineNo">1300</span>            .setPool(pool)<a name="line.1300"></a>
+<span class="sourceLineNo">1301</span>            .setTableName(tableName)<a name="line.1301"></a>
+<span class="sourceLineNo">1302</span>            .setRowAccess(execs)<a name="line.1302"></a>
+<span class="sourceLineNo">1303</span>            .setResults(results)<a name="line.1303"></a>
+<span class="sourceLineNo">1304</span>            .setRpcTimeout(readRpcTimeoutMs)<a name="line.1304"></a>
+<span class="sourceLineNo">1305</span>            .setOperationTimeout(operationTimeoutMs)<a name="line.1305"></a>
+<span class="sourceLineNo">1306</span>            .setSubmittedRows(AsyncProcessTask.SubmittedRows.ALL)<a name="line.1306"></a>
+<span class="sourceLineNo">1307</span>            .build();<a name="line.1307"></a>
+<span class="sourceLineNo">1308</span>    AsyncRequestFuture future = asyncProcess.submit(task);<a name="line.1308"></a>
+<span class="sourceLineNo">1309</span>    future.waitUntilDone();<a name="line.1309"></a>
+<span class="sourceLineNo">1310</span><a name="line.1310"></a>
+<span class="sourceLineNo">1311</span>    if (future.hasError()) {<a name="line.1311"></a>
+<span class="sourceLineNo">1312</span>      throw future.getErrors();<a name="line.1312"></a>
+<span class="sourceLineNo">1313</span>    } else if (!callbackErrorExceptions.isEmpty()) {<a name="line.1313"></a>
+<span class="sourceLineNo">1314</span>      throw new RetriesExhaustedWithDetailsException(callbackErrorExceptions, callbackErrorActions,<a name="line.1314"></a>
+<span class="sourceLineNo">1315</span>          callbackErrorServers);<a name="line.1315"></a>
+<span class="sourceLineNo">1316</span>    }<a name="line.1316"></a>
+<span class="sourceLineNo">1317</span>  }<a name="line.1317"></a>
+<span class="sourceLineNo">1318</span><a name="line.1318"></a>
+<span class="sourceLineNo">1319</span>  public RegionLocator getRegionLocator() {<a name="line.1319"></a>
+<span class="sourceLineNo">1320</span>    return this.locator;<a name="line.1320"></a>
+<span class="sourceLineNo">1321</span>  }<a name="line.1321"></a>
+<span class="sourceLineNo">1322</span>}<a name="line.1322"></a>
 
 
 


Mime
View raw message