@@ -196,7 +196,9 @@ TableDescriptor getDescriptor(TableName tableName)
196196 * threads, the table may have been created between test-for-existence and attempt-at-creation).
197197 * @throws IOException if a remote or network exception occurs
198198 */
199- void createTable (TableDescriptor desc ) throws IOException ;
199+ default void createTable (TableDescriptor desc ) throws IOException {
200+ get (createTableAsync (desc ), getSyncWaitTimeout (), TimeUnit .MILLISECONDS );
201+ }
200202
201203 /**
202204 * Creates a new table with the specified number of regions. The start key specified will become
@@ -213,7 +215,6 @@ TableDescriptor getDescriptor(TableName tableName)
213215 * @throws org.apache.hadoop.hbase.MasterNotRunningException if master is not running
214216 * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If concurrent
215217 * threads, the table may have been created between test-for-existence and attempt-at-creation).
216- * @throws IOException
217218 */
218219 void createTable (TableDescriptor desc , byte [] startKey , byte [] endKey , int numRegions )
219220 throws IOException ;
@@ -237,22 +238,35 @@ default void createTable(TableDescriptor desc, byte[][] splitKeys) throws IOExce
237238 }
238239
239240 /**
240- * Creates a new table but does not block and wait for it to come online.
241- * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
242- * It may throw ExecutionException if there was an error while executing the operation
243- * or TimeoutException in case the wait timeout was not long enough to allow the
244- * operation to complete.
245- * Throws IllegalArgumentException Bad table name, if the split keys
246- * are repeated and if the split key has empty byte array.
247- *
241+ * Creates a new table but does not block and wait for it to come online. You can use
242+ * Future.get(long, TimeUnit) to wait on the operation to complete. It may throw
243+ * ExecutionException if there was an error while executing the operation or TimeoutException in
244+ * case the wait timeout was not long enough to allow the operation to complete.
245+ * <p/>
246+ * Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split
247+ * key has empty byte array.
248+ * @param desc table descriptor for table
249+ * @throws IOException if a remote or network exception occurs
250+ * @return the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the
251+ * operation to complete.
252+ */
253+ Future <Void > createTableAsync (TableDescriptor desc ) throws IOException ;
254+
255+ /**
256+ * Creates a new table but does not block and wait for it to come online. You can use
257+ * Future.get(long, TimeUnit) to wait on the operation to complete. It may throw
258+ * ExecutionException if there was an error while executing the operation or TimeoutException in
259+ * case the wait timeout was not long enough to allow the operation to complete.
260+ * <p/>
261+ * Throws IllegalArgumentException Bad table name, if the split keys are repeated and if the split
262+ * key has empty byte array.
248263 * @param desc table descriptor for table
249264 * @param splitKeys keys to check if the table has been created with all split keys
250265 * @throws IOException if a remote or network exception occurs
251- * @return the result of the async creation. You can use Future.get(long, TimeUnit)
252- * to wait on the operation to complete.
266+ * @return the result of the async creation. You can use Future.get(long, TimeUnit) to wait on the
267+ * operation to complete.
253268 */
254- Future <Void > createTableAsync (TableDescriptor desc , byte [][] splitKeys )
255- throws IOException ;
269+ Future <Void > createTableAsync (TableDescriptor desc , byte [][] splitKeys ) throws IOException ;
256270
257271 /**
258272 * Deletes a table. Synchronous operation.
0 commit comments