View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.client;
20  
21  import java.io.Closeable;
22  import java.io.IOException;
23  import java.util.List;
24  import java.util.Map;
25  
26  import com.google.protobuf.Descriptors;
27  import com.google.protobuf.Message;
28  import com.google.protobuf.Service;
29  import com.google.protobuf.ServiceException;
30  
31  import org.apache.hadoop.hbase.classification.InterfaceAudience;
32  import org.apache.hadoop.hbase.classification.InterfaceStability;
33  import org.apache.hadoop.conf.Configuration;
34  import org.apache.hadoop.hbase.HTableDescriptor;
35  import org.apache.hadoop.hbase.TableName;
36  import org.apache.hadoop.hbase.client.coprocessor.Batch;
37  import org.apache.hadoop.hbase.filter.CompareFilter;
38  import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
39  
40  /**
41   * Used to communicate with a single HBase table.
42   * Obtain an instance from a {@link Connection} and call {@link #close()} afterwards.
43   *
44   * <p>Table can be used to get, put, delete or scan data from a table.
45   * @see ConnectionFactory
46   * @see Connection
47   * @see Admin
48   * @see RegionLocator
49   * @since 0.99.0
50   */
51  @InterfaceAudience.Public
52  @InterfaceStability.Evolving
53  public interface Table extends Closeable {
54    /**
55     * Gets the fully qualified table name instance of this table.
56     */
57    TableName getName();
58  
59    /**
60     * Returns the {@link org.apache.hadoop.conf.Configuration} object used by this instance.
61     * <p>
62     * The reference returned is not a copy, so any change made to it will
63     * affect this instance.
64     */
65    Configuration getConfiguration();
66  
67    /**
68     * Gets the {@link org.apache.hadoop.hbase.HTableDescriptor table descriptor} for this table.
69     * @throws java.io.IOException if a remote or network exception occurs.
70     */
71    HTableDescriptor getTableDescriptor() throws IOException;
72  
73    /**
74     * Test for the existence of columns in the table, as specified by the Get.
75     * <p>
76     *
77     * This will return true if the Get matches one or more keys, false if not.
78     * <p>
79     *
80     * This is a server-side call so it prevents any data from being transfered to
81     * the client.
82     *
83     * @param get the Get
84     * @return true if the specified Get matches one or more keys, false if not
85     * @throws IOException e
86     */
87    boolean exists(Get get) throws IOException;
88  
89    /**
90     * Test for the existence of columns in the table, as specified by the Gets.
91     * <p>
92     *
93     * This will return an array of booleans. Each value will be true if the related Get matches
94     * one or more keys, false if not.
95     * <p>
96     *
97     * This is a server-side call so it prevents any data from being transferred to
98     * the client.
99     *
100    * @param gets the Gets
101    * @return Array of boolean.  True if the specified Get matches one or more keys, false if not.
102    * @throws IOException e
103    */
104   boolean[] existsAll(List<Get> gets) throws IOException;
105 
106   /**
107    * Method that does a batch call on Deletes, Gets, Puts, Increments, Appends, RowMutations
108    * The ordering of execution of the actions is not defined. Meaning if you do a Put and a
109    * Get in the same {@link #batch} call, you will not necessarily be
110    * guaranteed that the Get returns what the Put had put.
111    *
112    * @param actions list of Get, Put, Delete, Increment, Append, RowMutations
113    * @param results Empty Object[], same size as actions. Provides access to partial
114    *                results, in case an exception is thrown. A null in the result array means that
115    *                the call for that action failed, even after retries
116    * @throws IOException
117    * @since 0.90.0
118    */
119   void batch(final List<? extends Row> actions, final Object[] results) throws IOException,
120     InterruptedException;
121 
122   /**
123    * Same as {@link #batch(List, Object[])}, but returns an array of
124    * results instead of using a results parameter reference.
125    *
126    * @param actions list of Get, Put, Delete, Increment, Append, RowMutations
127    * @return the results from the actions. A null in the return array means that
128    *         the call for that action failed, even after retries
129    * @throws IOException
130    * @since 0.90.0
131    * @deprecated If any exception is thrown by one of the actions, there is no way to
132    * retrieve the partially executed results. Use {@link #batch(List, Object[])} instead.
133    */
134   @Deprecated
135   Object[] batch(final List<? extends Row> actions) throws IOException, InterruptedException;
136 
137   /**
138    * Same as {@link #batch(List, Object[])}, but with a callback.
139    * @since 0.96.0
140    */
141   <R> void batchCallback(
142     final List<? extends Row> actions, final Object[] results, final Batch.Callback<R> callback
143   )
144     throws IOException, InterruptedException;
145 
146   /**
147    * Same as {@link #batch(List)}, but with a callback.
148    *
149    * @since 0.96.0
150    * @deprecated If any exception is thrown by one of the actions, there is no way to retrieve the
151    * partially executed results. Use {@link #batchCallback(List, Object[],
152    * org.apache.hadoop.hbase.client.coprocessor.Batch.Callback)} instead.
153    */
154   @Deprecated
155   <R> Object[] batchCallback(
156     List<? extends Row> actions, Batch.Callback<R> callback
157   ) throws IOException,
158     InterruptedException;
159 
160   /**
161    * Extracts certain cells from a given row.
162    * @param get The object that specifies what data to fetch and from which row.
163    * @return The data coming from the specified row, if it exists.  If the row
164    * specified doesn't exist, the {@link Result} instance returned won't
165    * contain any {@link org.apache.hadoop.hbase.KeyValue}, as indicated by {@link Result#isEmpty()}.
166    * @throws IOException if a remote or network exception occurs.
167    * @since 0.20.0
168    */
169   Result get(Get get) throws IOException;
170 
171   /**
172    * Extracts certain cells from the given rows, in batch.
173    *
174    * @param gets The objects that specify what data to fetch and from which rows.
175    * @return The data coming from the specified rows, if it exists.  If the row specified doesn't
176    * exist, the {@link Result} instance returned won't contain any {@link
177    * org.apache.hadoop.hbase.KeyValue}, as indicated by {@link Result#isEmpty()}. If there are any
178    * failures even after retries, there will be a null in the results array for those Gets, AND an
179    * exception will be thrown.
180    * @throws IOException if a remote or network exception occurs.
181    * @since 0.90.0
182    */
183   Result[] get(List<Get> gets) throws IOException;
184 
185   /**
186    * Returns a scanner on the current table as specified by the {@link Scan}
187    * object.
188    * Note that the passed {@link Scan}'s start row and caching properties
189    * maybe changed.
190    *
191    * @param scan A configured {@link Scan} object.
192    * @return A scanner.
193    * @throws IOException if a remote or network exception occurs.
194    * @since 0.20.0
195    */
196   ResultScanner getScanner(Scan scan) throws IOException;
197 
198   /**
199    * Gets a scanner on the current table for the given family.
200    *
201    * @param family The column family to scan.
202    * @return A scanner.
203    * @throws IOException if a remote or network exception occurs.
204    * @since 0.20.0
205    */
206   ResultScanner getScanner(byte[] family) throws IOException;
207 
208   /**
209    * Gets a scanner on the current table for the given family and qualifier.
210    *
211    * @param family The column family to scan.
212    * @param qualifier The column qualifier to scan.
213    * @return A scanner.
214    * @throws IOException if a remote or network exception occurs.
215    * @since 0.20.0
216    */
217   ResultScanner getScanner(byte[] family, byte[] qualifier) throws IOException;
218 
219 
220   /**
221    * Puts some data in the table.
222    * 
223    * @param put The data to put.
224    * @throws IOException if a remote or network exception occurs.
225    * @since 0.20.0
226    */
227   void put(Put put) throws IOException;
228 
229   /**
230    * Puts some data in the table, in batch.
231    * <p>
232    * This can be used for group commit, or for submitting user defined
233    * batches.  The writeBuffer will be periodically inspected while the List
234    * is processed, so depending on the List size the writeBuffer may flush
235    * not at all, or more than once.
236    * @param puts The list of mutations to apply. The batch put is done by
237    * aggregating the iteration of the Puts over the write buffer
238    * at the client-side for a single RPC call.
239    * @throws IOException if a remote or network exception occurs.
240    * @since 0.20.0
241    */
242   void put(List<Put> puts) throws IOException;
243 
244   /**
245    * Atomically checks if a row/family/qualifier value matches the expected
246    * value. If it does, it adds the put.  If the passed value is null, the check
247    * is for the lack of column (ie: non-existance)
248    *
249    * @param row to check
250    * @param family column family to check
251    * @param qualifier column qualifier to check
252    * @param value the expected value
253    * @param put data to put if check succeeds
254    * @throws IOException e
255    * @return true if the new put was executed, false otherwise
256    */
257   boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
258     byte[] value, Put put) throws IOException;
259 
260   /**
261    * Atomically checks if a row/family/qualifier value matches the expected
262    * value. If it does, it adds the put.  If the passed value is null, the check
263    * is for the lack of column (ie: non-existance)
264    *
265    * @param row to check
266    * @param family column family to check
267    * @param qualifier column qualifier to check
268    * @param compareOp comparison operator to use
269    * @param value the expected value
270    * @param put data to put if check succeeds
271    * @throws IOException e
272    * @return true if the new put was executed, false otherwise
273    */
274   boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
275     CompareFilter.CompareOp compareOp, byte[] value, Put put) throws IOException;
276 
277   /**
278    * Deletes the specified cells/row.
279    *
280    * @param delete The object that specifies what to delete.
281    * @throws IOException if a remote or network exception occurs.
282    * @since 0.20.0
283    */
284   void delete(Delete delete) throws IOException;
285 
286   /**
287    * Deletes the specified cells/rows in bulk.
288    * @param deletes List of things to delete.  List gets modified by this
289    * method (in particular it gets re-ordered, so the order in which the elements
290    * are inserted in the list gives no guarantee as to the order in which the
291    * {@link Delete}s are executed).
292    * @throws IOException if a remote or network exception occurs. In that case
293    * the {@code deletes} argument will contain the {@link Delete} instances
294    * that have not be successfully applied.
295    * @since 0.20.1
296    */
297   void delete(List<Delete> deletes) throws IOException;
298 
299   /**
300    * Atomically checks if a row/family/qualifier value matches the expected
301    * value. If it does, it adds the delete.  If the passed value is null, the
302    * check is for the lack of column (ie: non-existance)
303    *
304    * @param row to check
305    * @param family column family to check
306    * @param qualifier column qualifier to check
307    * @param value the expected value
308    * @param delete data to delete if check succeeds
309    * @throws IOException e
310    * @return true if the new delete was executed, false otherwise
311    */
312   boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
313     byte[] value, Delete delete) throws IOException;
314 
315   /**
316    * Atomically checks if a row/family/qualifier value matches the expected
317    * value. If it does, it adds the delete.  If the passed value is null, the
318    * check is for the lack of column (ie: non-existance)
319    *
320    * @param row to check
321    * @param family column family to check
322    * @param qualifier column qualifier to check
323    * @param compareOp comparison operator to use
324    * @param value the expected value
325    * @param delete data to delete if check succeeds
326    * @throws IOException e
327    * @return true if the new delete was executed, false otherwise
328    */
329   boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
330     CompareFilter.CompareOp compareOp, byte[] value, Delete delete) throws IOException;
331 
332   /**
333    * Performs multiple mutations atomically on a single row. Currently
334    * {@link Put} and {@link Delete} are supported.
335    *
336    * @param rm object that specifies the set of mutations to perform atomically
337    * @throws IOException
338    */
339   void mutateRow(final RowMutations rm) throws IOException;
340 
341   /**
342    * Appends values to one or more columns within a single row.
343    * <p>
344    * This operation guaranteed atomicity to readers. Appends are done
345    * under a single row lock, so write operations to a row are synchronized, and
346    * readers are guaranteed to see this operation fully completed.
347    *
348    * @param append object that specifies the columns and amounts to be used
349    *                  for the increment operations
350    * @throws IOException e
351    * @return values of columns after the append operation (maybe null)
352    */
353   Result append(final Append append) throws IOException;
354 
355   /**
356    * Increments one or more columns within a single row.
357    * <p>
358    * This operation ensures atomicity to readers. Increments are done
359    * under a single row lock, so write operations to a row are synchronized, and
360    * readers are guaranteed to see this operation fully completed.
361    *
362    * @param increment object that specifies the columns and amounts to be used
363    *                  for the increment operations
364    * @throws IOException e
365    * @return values of columns after the increment
366    */
367   Result increment(final Increment increment) throws IOException;
368 
369   /**
370    * See {@link #incrementColumnValue(byte[], byte[], byte[], long, Durability)}
371    * <p>
372    * The {@link Durability} is defaulted to {@link Durability#SYNC_WAL}.
373    * @param row The row that contains the cell to increment.
374    * @param family The column family of the cell to increment.
375    * @param qualifier The column qualifier of the cell to increment.
376    * @param amount The amount to increment the cell with (or decrement, if the
377    * amount is negative).
378    * @return The new value, post increment.
379    * @throws IOException if a remote or network exception occurs.
380    */
381   long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
382     long amount) throws IOException;
383 
384   /**
385    * Atomically increments a column value. If the column value already exists
386    * and is not a big-endian long, this could throw an exception. If the column
387    * value does not yet exist it is initialized to <code>amount</code> and
388    * written to the specified column.
389    *
390    * <p>Setting durability to {@link Durability#SKIP_WAL} means that in a fail
391    * scenario you will lose any increments that have not been flushed.
392    * @param row The row that contains the cell to increment.
393    * @param family The column family of the cell to increment.
394    * @param qualifier The column qualifier of the cell to increment.
395    * @param amount The amount to increment the cell with (or decrement, if the
396    * amount is negative).
397    * @param durability The persistence guarantee for this increment.
398    * @return The new value, post increment.
399    * @throws IOException if a remote or network exception occurs.
400    */
401   long incrementColumnValue(byte[] row, byte[] family, byte[] qualifier,
402     long amount, Durability durability) throws IOException;
403 
404   /**
405    * Releases any resources held or pending changes in internal buffers.
406    *
407    * @throws IOException if a remote or network exception occurs.
408    */
409   @Override
410   void close() throws IOException;
411 
412   /**
413    * Creates and returns a {@link com.google.protobuf.RpcChannel} instance connected to the
414    * table region containing the specified row.  The row given does not actually have
415    * to exist.  Whichever region would contain the row based on start and end keys will
416    * be used.  Note that the {@code row} parameter is also not passed to the
417    * coprocessor handler registered for this protocol, unless the {@code row}
418    * is separately passed as an argument in the service request.  The parameter
419    * here is only used to locate the region used to handle the call.
420    *
421    * <p>
422    * The obtained {@link com.google.protobuf.RpcChannel} instance can be used to access a published
423    * coprocessor {@link com.google.protobuf.Service} using standard protobuf service invocations:
424    * </p>
425    *
426    * <div style="background-color: #cccccc; padding: 2px">
427    * <blockquote><pre>
428    * CoprocessorRpcChannel channel = myTable.coprocessorService(rowkey);
429    * MyService.BlockingInterface service = MyService.newBlockingStub(channel);
430    * MyCallRequest request = MyCallRequest.newBuilder()
431    *     ...
432    *     .build();
433    * MyCallResponse response = service.myCall(null, request);
434    * </pre></blockquote></div>
435    *
436    * @param row The row key used to identify the remote region location
437    * @return A CoprocessorRpcChannel instance
438    */
439   CoprocessorRpcChannel coprocessorService(byte[] row);
440 
441   /**
442    * Creates an instance of the given {@link com.google.protobuf.Service} subclass for each table
443    * region spanning the range from the {@code startKey} row to {@code endKey} row (inclusive), and
444    * invokes the passed {@link org.apache.hadoop.hbase.client.coprocessor.Batch.Call#call} method
445    * with each {@link com.google.protobuf.Service} instance.
446    *
447    * @param service the protocol buffer {@code Service} implementation to call
448    * @param startKey start region selection with region containing this row.  If {@code null}, the
449    * selection will start with the first table region.
450    * @param endKey select regions up to and including the region containing this row. If {@code
451    * null}, selection will continue through the last table region.
452    * @param callable this instance's {@link org.apache.hadoop.hbase.client.coprocessor.Batch
453    * .Call#call}
454    * method will be invoked once per table region, using the {@link com.google.protobuf.Service}
455    * instance connected to that region.
456    * @param <T> the {@link com.google.protobuf.Service} subclass to connect to
457    * @param <R> Return type for the {@code callable} parameter's {@link
458    * org.apache.hadoop.hbase.client.coprocessor.Batch.Call#call} method
459    * @return a map of result values keyed by region name
460    */
461   <T extends Service, R> Map<byte[],R> coprocessorService(final Class<T> service,
462     byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable)
463     throws ServiceException, Throwable;
464 
465   /**
466    * Creates an instance of the given {@link com.google.protobuf.Service} subclass for each table
467    * region spanning the range from the {@code startKey} row to {@code endKey} row (inclusive), and
468    * invokes the passed {@link org.apache.hadoop.hbase.client.coprocessor.Batch.Call#call} method
469    * with each {@link Service} instance.
470    *
471    * <p> The given {@link org.apache.hadoop.hbase.client.coprocessor.Batch.Callback#update(byte[],
472    * byte[], Object)} method will be called with the return value from each region's {@link
473    * org.apache.hadoop.hbase.client.coprocessor.Batch.Call#call} invocation. </p>
474    *
475    * @param service the protocol buffer {@code Service} implementation to call
476    * @param startKey start region selection with region containing this row.  If {@code null}, the
477    * selection will start with the first table region.
478    * @param endKey select regions up to and including the region containing this row. If {@code
479    * null}, selection will continue through the last table region.
480    * @param callable this instance's {@link org.apache.hadoop.hbase.client.coprocessor.Batch
481    * .Call#call}
482    * method will be invoked once per table region, using the {@link Service} instance connected to
483    * that region.
484    * @param callback
485    * @param <T> the {@link Service} subclass to connect to
486    * @param <R> Return type for the {@code callable} parameter's {@link
487    * org.apache.hadoop.hbase.client.coprocessor.Batch.Call#call} method
488    */
489   <T extends Service, R> void coprocessorService(final Class<T> service,
490     byte[] startKey, byte[] endKey, final Batch.Call<T,R> callable,
491     final Batch.Callback<R> callback) throws ServiceException, Throwable;
492 
493   /**
494    * Returns the maximum size in bytes of the write buffer for this HTable.
495    * <p>
496    * The default value comes from the configuration parameter
497    * {@code hbase.client.write.buffer}.
498    * @return The size of the write buffer in bytes.
499     * @deprecated as of 1.0.1 (should not have been in 1.0.0). Replaced by {@link BufferedMutator#getWriteBufferSize()}
500    */
501   @Deprecated
502   long getWriteBufferSize();
503 
504   /**
505    * Sets the size of the buffer in bytes.
506    * <p>
507    * If the new size is less than the current amount of data in the
508    * write buffer, the buffer gets flushed.
509    * @param writeBufferSize The new write buffer size, in bytes.
510    * @throws IOException if a remote or network exception occurs.
511    * @deprecated as of 1.0.1 (should not have been in 1.0.0). Replaced by {@link BufferedMutator} and
512    * {@link BufferedMutatorParams#writeBufferSize(long)}
513    */
514   @Deprecated
515   void setWriteBufferSize(long writeBufferSize) throws IOException;
516 
517   /**
518    * Creates an instance of the given {@link com.google.protobuf.Service} subclass for each table
519    * region spanning the range from the {@code startKey} row to {@code endKey} row (inclusive), all
520    * the invocations to the same region server will be batched into one call. The coprocessor
521    * service is invoked according to the service instance, method name and parameters.
522    *
523    * @param methodDescriptor
524    *          the descriptor for the protobuf service method to call.
525    * @param request
526    *          the method call parameters
527    * @param startKey
528    *          start region selection with region containing this row. If {@code null}, the
529    *          selection will start with the first table region.
530    * @param endKey
531    *          select regions up to and including the region containing this row. If {@code null},
532    *          selection will continue through the last table region.
533    * @param responsePrototype
534    *          the proto type of the response of the method in Service.
535    * @param <R>
536    *          the response type for the coprocessor Service method
537    * @throws ServiceException
538    * @throws Throwable
539    * @return a map of result values keyed by region name
540    */
541   <R extends Message> Map<byte[], R> batchCoprocessorService(
542     Descriptors.MethodDescriptor methodDescriptor, Message request,
543     byte[] startKey, byte[] endKey, R responsePrototype) throws ServiceException, Throwable;
544 
545   /**
546    * Creates an instance of the given {@link com.google.protobuf.Service} subclass for each table
547    * region spanning the range from the {@code startKey} row to {@code endKey} row (inclusive), all
548    * the invocations to the same region server will be batched into one call. The coprocessor
549    * service is invoked according to the service instance, method name and parameters.
550    *
551    * <p>
552    * The given
553    * {@link org.apache.hadoop.hbase.client.coprocessor.Batch.Callback#update(byte[],byte[],Object)}
554    * method will be called with the return value from each region's invocation.
555    * </p>
556    *
557    * @param methodDescriptor
558    *          the descriptor for the protobuf service method to call.
559    * @param request
560    *          the method call parameters
561    * @param startKey
562    *          start region selection with region containing this row. If {@code null}, the
563    *          selection will start with the first table region.
564    * @param endKey
565    *          select regions up to and including the region containing this row. If {@code null},
566    *          selection will continue through the last table region.
567    * @param responsePrototype
568    *          the proto type of the response of the method in Service.
569    * @param callback
570    *          callback to invoke with the response for each region
571    * @param <R>
572    *          the response type for the coprocessor Service method
573    * @throws ServiceException
574    * @throws Throwable
575    */
576   <R extends Message> void batchCoprocessorService(Descriptors.MethodDescriptor methodDescriptor,
577     Message request, byte[] startKey, byte[] endKey, R responsePrototype,
578     Batch.Callback<R> callback) throws ServiceException, Throwable;
579 
580   /**
581    * Atomically checks if a row/family/qualifier value matches the expected value.
582    * If it does, it performs the row mutations.  If the passed value is null, the check
583    * is for the lack of column (ie: non-existence)
584    *
585    * @param row to check
586    * @param family column family to check
587    * @param qualifier column qualifier to check
588    * @param compareOp the comparison operator
589    * @param value the expected value
590    * @param mutation  mutations to perform if check succeeds
591    * @throws IOException e
592    * @return true if the new put was executed, false otherwise
593    */
594   boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier,
595       CompareFilter.CompareOp compareOp, byte[] value, RowMutations mutation) throws IOException;
596 
597   /**
598    * Set timeout (millisecond) of each operation in this Table instance, will override the value
599    * of hbase.client.operation.timeout in configuration.
600    * Operation timeout is a top-level restriction that makes sure a blocking method will not be
601    * blocked more than this. In each operation, if rpc request fails because of timeout or
602    * other reason, it will retry until success or throw a RetriesExhaustedException. But if the
603    * total time being blocking reach the operation timeout before retries exhausted, it will break
604    * early and throw SocketTimeoutException.
605    * @param operationTimeout the total timeout of each operation in millisecond.
606    */
607   public void setOperationTimeout(int operationTimeout);
608 
609   /**
610    * Get timeout (millisecond) of each operation for in Table instance.
611    */
612   public int getOperationTimeout();
613 
614   /**
615    * Get timeout (millisecond) of each rpc request in this Table instance.
616    *
617    * @returns Currently configured read timeout
618    * @deprecated Use getReadRpcTimeout or getWriteRpcTimeout instead
619    */
620   @Deprecated
621   int getRpcTimeout();
622 
623   /**
624    * Set timeout (millisecond) of each rpc request in operations of this Table instance, will
625    * override the value of hbase.rpc.timeout in configuration.
626    * If a rpc request waiting too long, it will stop waiting and send a new request to retry until
627    * retries exhausted or operation timeout reached.
628    * <p>
629    * NOTE: This will set both the read and write timeout settings to the provided value.
630    *
631    * @param rpcTimeout the timeout of each rpc request in millisecond.
632    *
633    * @deprecated Use setReadRpcTimeout or setWriteRpcTimeout instead
634    */
635   @Deprecated
636   void setRpcTimeout(int rpcTimeout);
637 
638   /**
639    * Get timeout (millisecond) of each rpc read request in this Table instance.
640    */
641   int getReadRpcTimeout();
642 
643   /**
644    * Set timeout (millisecond) of each rpc read request in operations of this Table instance, will
645    * override the value of hbase.rpc.read.timeout in configuration.
646    * If a rpc read request waiting too long, it will stop waiting and send a new request to retry
647    * until retries exhausted or operation timeout reached.
648    *
649    * @param readRpcTimeout
650    */
651   void setReadRpcTimeout(int readRpcTimeout);
652 
653   /**
654    * Get timeout (millisecond) of each rpc write request in this Table instance.
655    */
656   int getWriteRpcTimeout();
657 
658   /**
659    * Set timeout (millisecond) of each rpc write request in operations of this Table instance, will
660    * override the value of hbase.rpc.write.timeout in configuration.
661    * If a rpc write request waiting too long, it will stop waiting and send a new request to retry
662    * until retries exhausted or operation timeout reached.
663    *
664    * @param writeRpcTimeout
665    */
666   void setWriteRpcTimeout(int writeRpcTimeout);
667 }