@Override public ClusterMetrics getClusterMetrics(EnumSet<Option> options) throws IOException { return executeCallable(new MasterCallable<ClusterMetrics>(getConnection(), this.rpcControllerFactory) { @Override protected ClusterMetrics rpcCall() throws Exception { GetClusterStatusRequest req = RequestConverter.buildGetClusterStatusRequest(options); return ClusterMetricsBuilder.toClusterMetrics( master.getClusterStatus(getRpcController(), req).getClusterStatus()); } }); }
@Override public TableDescriptor getDescriptor(TableName tableName) throws TableNotFoundException, IOException { return getTableDescriptor(tableName, getConnection(), rpcCallerFactory, rpcControllerFactory, operationTimeout, rpcTimeout); }
@Override public HTableDescriptor getTableDescriptor(final TableName tableName) throws IOException { return getHTableDescriptor(tableName, getConnection(), rpcCallerFactory, rpcControllerFactory, operationTimeout, rpcTimeout); }
@Override public boolean balancerSwitch(final boolean on, final boolean synchronous) throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { SetBalancerRunningRequest req = RequestConverter.buildSetBalancerRunningRequest(on, synchronous); return master.setBalancerRunning(getRpcController(), req).getPrevBalanceValue(); } }); }
@Override public boolean balance() throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return master.balance(getRpcController(), RequestConverter.buildBalanceRequest(false)).getBalancerRan(); } }); }
@Override public boolean isBalancerEnabled() throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return master.isBalancerEnabled(getRpcController(), RequestConverter.buildIsBalancerEnabledRequest()).getEnabled(); } }); }
@Override public boolean isCatalogJanitorEnabled() throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return master.isCatalogJanitorEnabled(getRpcController(), RequestConverter.buildIsCatalogJanitorEnabledRequest()).getValue(); } }); }
@Override public synchronized void shutdown() throws IOException { executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) { @Override protected Void rpcCall() throws Exception { setPriority(HConstants.HIGH_QOS); master.shutdown(getRpcController(), ShutdownRequest.newBuilder().build()); return null; } }); }
@Override public String getLocks() throws IOException { return executeCallable(new MasterCallable<String>(getConnection(), getRpcControllerFactory()) { @Override protected String rpcCall() throws Exception { GetLocksRequest request = GetLocksRequest.newBuilder().build(); GetLocksResponse response = master.getLocks(getRpcController(), request); return ProtobufUtil.toLockJson(response.getLockList()); } }); }
@Override public void decommissionRegionServers(List<ServerName> servers, boolean offload) throws IOException { executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) { @Override public Void rpcCall() throws ServiceException { master.decommissionRegionServers(getRpcController(), RequestConverter.buildDecommissionRegionServersRequest(servers, offload)); return null; } }); }
@Override public boolean switchRpcThrottle(final boolean enable) throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return this.master .switchRpcThrottle(getRpcController(), MasterProtos.SwitchRpcThrottleRequest .newBuilder().setRpcThrottleEnabled(enable).build()) .getPreviousRpcThrottleEnabled(); } }); }
@Override public boolean balance(final boolean force) throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return master.balance(getRpcController(), RequestConverter.buildBalanceRequest(force)).getBalancerRan(); } }); }
@Override public boolean cleanerChoreSwitch(final boolean on) throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override public Boolean rpcCall() throws Exception { return master.setCleanerChoreRunning(getRpcController(), RequestConverter.buildSetCleanerChoreRunningRequest(on)).getPrevValue(); } }); }
@Override public boolean isCleanerChoreEnabled() throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override public Boolean rpcCall() throws Exception { return master.isCleanerChoreEnabled(getRpcController(), RequestConverter.buildIsCleanerChoreEnabledRequest()).getValue(); } }); }
@Override public synchronized void stopMaster() throws IOException { executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) { @Override protected Void rpcCall() throws Exception { setPriority(HConstants.HIGH_QOS); master.stopMaster(getRpcController(), StopMasterRequest.newBuilder().build()); return null; } }); }
private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException { executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) { @Override protected Void rpcCall() throws Exception { this.master.deleteSnapshot(getRpcController(), DeleteSnapshotRequest.newBuilder() .setSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot)).build()); return null; } }); }
@Override public boolean isMergeEnabled() throws IOException { return executeCallable(new MasterCallable<Boolean>(getConnection(), getRpcControllerFactory()) { @Override protected Boolean rpcCall() throws Exception { return master.isSplitOrMergeEnabled(getRpcController(), RequestConverter.buildIsSplitOrMergeEnabledRequest(MasterSwitchType.MERGE)).getEnabled(); } }); }
@Override public void revoke(UserPermission userPermission) throws IOException { executeCallable(new MasterCallable<Void>(getConnection(), getRpcControllerFactory()) { @Override protected Void rpcCall() throws Exception { RevokeRequest req = ShadedAccessControlUtil.buildRevokeRequest(userPermission); this.master.revoke(getRpcController(), req); return null; } }); } }
@Override public String getProcedures() throws IOException { return executeCallable(new MasterCallable<String>(getConnection(), getRpcControllerFactory()) { @Override protected String rpcCall() throws Exception { GetProceduresRequest request = GetProceduresRequest.newBuilder().build(); GetProceduresResponse response = master.getProcedures(getRpcController(), request); return ProtobufUtil.toProcedureJson(response.getProcedureList()); } }); }
@Override protected Void postOperationResult(final Void result, final long deadlineTs) throws IOException, TimeoutException { // Delete cached information to prevent clients from using old locations ((ClusterConnection) getAdmin().getConnection()).clearRegionCache(getTableName()); return super.postOperationResult(result, deadlineTs); } }