Java 类org.apache.hadoop.hbase.protobuf.generated.MasterProtos.SetBalancerRunningRequest 实例源码

项目:ditb    文件:HBaseAdmin.java   
/**
 * Turn the load balancer on or off.
 * @param on If true, enable balancer. If false, disable balancer.
 * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
 * @return Previous balancer value
 */
@Override
public boolean setBalancerRunning(final boolean on, final boolean synchronous)
throws IOException {
  return executeCallable(new MasterCallable<Boolean>(getConnection()) {
    @Override
    public Boolean call(int callTimeout) throws ServiceException {
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      controller.setCallTimeout(callTimeout);

      SetBalancerRunningRequest req =
          RequestConverter.buildSetBalancerRunningRequest(on, synchronous);
      return master.setBalancerRunning(controller, req).getPrevBalanceValue();
    }
  });
}
项目:HIndex    文件:HBaseAdmin.java   
/**
 * Turn the load balancer on or off.
 * @param on If true, enable balancer. If false, disable balancer.
 * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
 * @return Previous balancer value
 */
public boolean setBalancerRunning(final boolean on, final boolean synchronous)
throws MasterNotRunningException, ZooKeeperConnectionException {
  MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
  try {
    SetBalancerRunningRequest req =
      RequestConverter.buildSetBalancerRunningRequest(on, synchronous);
    return stub.setBalancerRunning(null, req).getPrevBalanceValue();
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof MasterNotRunningException) {
      throw (MasterNotRunningException)ioe;
    }
    if (ioe instanceof ZooKeeperConnectionException) {
      throw (ZooKeeperConnectionException)ioe;
    }

    // Throwing MasterNotRunningException even though not really valid in order to not
    // break interface by adding additional exception type.
    throw new MasterNotRunningException("Unexpected exception when calling balanceSwitch",se);
  } finally {
    stub.close();
  }
}
项目:PyroDB    文件:HBaseAdmin.java   
/**
 * Turn the load balancer on or off.
 * @param on If true, enable balancer. If false, disable balancer.
 * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
 * @return Previous balancer value
 */
public boolean setBalancerRunning(final boolean on, final boolean synchronous)
throws MasterNotRunningException, ZooKeeperConnectionException {
  MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
  try {
    SetBalancerRunningRequest req =
      RequestConverter.buildSetBalancerRunningRequest(on, synchronous);
    return stub.setBalancerRunning(null, req).getPrevBalanceValue();
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof MasterNotRunningException) {
      throw (MasterNotRunningException)ioe;
    }
    if (ioe instanceof ZooKeeperConnectionException) {
      throw (ZooKeeperConnectionException)ioe;
    }

    // Throwing MasterNotRunningException even though not really valid in order to not
    // break interface by adding additional exception type.
    throw new MasterNotRunningException("Unexpected exception when calling balanceSwitch",se);
  } finally {
    stub.close();
  }
}
项目:c5    文件:HBaseAdmin.java   
/**
 * Turn the load balancer on or off.
 * @param on If true, enable balancer. If false, disable balancer.
 * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
 * @return Previous balancer value
 */
public boolean setBalancerRunning(final boolean on, final boolean synchronous)
throws MasterNotRunningException, ZooKeeperConnectionException {
  MasterKeepAliveConnection stub = connection.getKeepAliveMasterService();
  try {
    SetBalancerRunningRequest req =
      RequestConverter.buildSetBalancerRunningRequest(on, synchronous);
    return stub.setBalancerRunning(null, req).getPrevBalanceValue();
  } catch (ServiceException se) {
    IOException ioe = ProtobufUtil.getRemoteException(se);
    if (ioe instanceof MasterNotRunningException) {
      throw (MasterNotRunningException)ioe;
    }
    if (ioe instanceof ZooKeeperConnectionException) {
      throw (ZooKeeperConnectionException)ioe;
    }

    // Throwing MasterNotRunningException even though not really valid in order to not
    // break interface by adding additional exception type.
    throw new MasterNotRunningException("Unexpected exception when calling balanceSwitch",se);
  } finally {
    stub.close();
  }
}
项目:ditb    文件:MasterRpcServices.java   
@Override
public SetBalancerRunningResponse setBalancerRunning(RpcController c,
    SetBalancerRunningRequest req) throws ServiceException {
  try {
    master.checkInitialized();
    boolean prevValue = (req.getSynchronous())?
      synchronousBalanceSwitch(req.getOn()) : master.balanceSwitch(req.getOn());
    return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:pbase    文件:MasterRpcServices.java   
@Override
public SetBalancerRunningResponse setBalancerRunning(RpcController c,
    SetBalancerRunningRequest req) throws ServiceException {
  try {
    master.checkInitialized();
    boolean prevValue = (req.getSynchronous())?
      synchronousBalanceSwitch(req.getOn()) : master.balanceSwitch(req.getOn());
    return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:pbase    文件:HBaseAdmin.java   
/**
 * Turn the load balancer on or off.
 * @param on If true, enable balancer. If false, disable balancer.
 * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
 * @return Previous balancer value
 */
@Override
public boolean setBalancerRunning(final boolean on, final boolean synchronous)
throws IOException {
  return executeCallable(new MasterCallable<Boolean>(getConnection()) {
    @Override
    public Boolean call(int callTimeout) throws ServiceException {
      SetBalancerRunningRequest req =
          RequestConverter.buildSetBalancerRunningRequest(on, synchronous);
      return master.setBalancerRunning(null, req).getPrevBalanceValue();
    }
  });
}
项目:HIndex    文件:HMaster.java   
@Override
public SetBalancerRunningResponse setBalancerRunning(
    RpcController controller, SetBalancerRunningRequest req) throws ServiceException {
  try {
    boolean prevValue = (req.getSynchronous())?
      synchronousBalanceSwitch(req.getOn()):balanceSwitch(req.getOn());
    return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:PyroDB    文件:MasterRpcServices.java   
@Override
public SetBalancerRunningResponse setBalancerRunning(RpcController c,
    SetBalancerRunningRequest req) throws ServiceException {
  try {
    master.checkInitialized();
    boolean prevValue = (req.getSynchronous())?
      synchronousBalanceSwitch(req.getOn()) : master.balanceSwitch(req.getOn());
    return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:c5    文件:HMaster.java   
@Override
public SetBalancerRunningResponse setBalancerRunning(
    RpcController controller, SetBalancerRunningRequest req) throws ServiceException {
  try {
    boolean prevValue = (req.getSynchronous())?
      synchronousBalanceSwitch(req.getOn()):balanceSwitch(req.getOn());
    return SetBalancerRunningResponse.newBuilder().setPrevBalanceValue(prevValue).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:ditb    文件:RequestConverter.java   
/**
 * Creates a protocol buffer SetBalancerRunningRequest
 *
 * @param on
 * @param synchronous
 * @return a SetBalancerRunningRequest
 */
public static SetBalancerRunningRequest buildSetBalancerRunningRequest(
    boolean on,
    boolean synchronous) {
  return SetBalancerRunningRequest.newBuilder().setOn(on).setSynchronous(synchronous).build();
}
项目:pbase    文件:RequestConverter.java   
/**
 * Creates a protocol buffer SetBalancerRunningRequest
 *
 * @param on
 * @param synchronous
 * @return a SetBalancerRunningRequest
 */
public static SetBalancerRunningRequest buildSetBalancerRunningRequest(boolean on, boolean synchronous) {
  return SetBalancerRunningRequest.newBuilder().setOn(on).setSynchronous(synchronous).build();
}
项目:HIndex    文件:RequestConverter.java   
/**
 * Creates a protocol buffer SetBalancerRunningRequest
 *
 * @param on
 * @param synchronous
 * @return a SetBalancerRunningRequest
 */
public static SetBalancerRunningRequest buildSetBalancerRunningRequest(boolean on, boolean synchronous) {
  return SetBalancerRunningRequest.newBuilder().setOn(on).setSynchronous(synchronous).build();
}
项目:PyroDB    文件:RequestConverter.java   
/**
 * Creates a protocol buffer SetBalancerRunningRequest
 *
 * @param on
 * @param synchronous
 * @return a SetBalancerRunningRequest
 */
public static SetBalancerRunningRequest buildSetBalancerRunningRequest(boolean on, boolean synchronous) {
  return SetBalancerRunningRequest.newBuilder().setOn(on).setSynchronous(synchronous).build();
}
项目:c5    文件:RequestConverter.java   
/**
 * Creates a protocol buffer SetBalancerRunningRequest
 *
 * @param on
 * @param synchronous
 * @return a SetBalancerRunningRequest
 */
public static SetBalancerRunningRequest buildSetBalancerRunningRequest(boolean on, boolean synchronous) {
  return SetBalancerRunningRequest.newBuilder().setOn(on).setSynchronous(synchronous).build();
}