/** * Disable the table but does not block and wait for it be completely disabled. * You can use Future.get(long, TimeUnit) to wait on the operation to complete. * It may throw ExecutionException if there was an error while executing the operation * or TimeoutException in case the wait timeout was not long enough to allow the * operation to complete. * * @param tableName name of table to delete * @throws IOException if a remote or network exception occurs * @return the result of the async disable. You can use Future.get(long, TimeUnit) * to wait on the operation to complete. */ // TODO: This should be called Async but it will break binary compatibility private Future<Void> disableTableAsyncV2(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); DisableTableResponse response = executeCallable( new MasterCallable<DisableTableResponse>(getConnection()) { @Override public DisableTableResponse call(int callTimeout) throws ServiceException { PayloadCarryingRpcController controller = rpcControllerFactory.newController(); controller.setCallTimeout(callTimeout); controller.setPriority(tableName); LOG.info("Started disable of " + tableName); DisableTableRequest req = RequestConverter.buildDisableTableRequest( tableName, ng.getNonceGroup(), ng.newNonce()); return master.disableTable(controller, req); } }); return new DisableTableFuture(this, tableName, response); }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { long procId = master.disableTable( ProtobufUtil.toTableName(request.getTableName()), request.getNonceGroup(), request.getNonce()); return DisableTableResponse.newBuilder().setProcId(procId).build(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { master.disableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return DisableTableResponse.newBuilder().build(); }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { disableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return DisableTableResponse.newBuilder().build(); }
public DisableTableFuture(final HBaseAdmin admin, final TableName tableName, final DisableTableResponse response) { super(admin, (response != null && response.hasProcId()) ? response.getProcId() : null); this.tableName = tableName; }