java/kudu-client/src/test/java/org/apache/kudu/client/MiniKuduCluster.java
private synchronized ControlShellResponsePB sendRequestToCluster(ControlShellRequestPB req)
      throws IOException {
    // Send the request's size (4 bytes, big endian) followed by the request.
    LOG.debug("Request: {}", req);
    miniClusterStdin.writeInt(req.getSerializedSize());
    miniClusterStdin.write(req.toByteArray());
    miniClusterStdin.flush();

    // Read the response's size (4 bytes, big endian) followed by the response.
    int respLength = miniClusterStdout.readInt();
    byte[] respBody = new byte[respLength];
    miniClusterStdout.readFully(respBody);
    ControlShellResponsePB resp = ControlShellResponsePB.parseFrom(respBody);
    LOG.debug("Response: {}", resp);

    // Convert any error into an exception.
    if (resp.hasError()) {
      throw new NonRecoverableException(Status.fromPB(resp.getError()));
    }
    return resp;
  }
/**
   * Sends a command to the control shell and receives its response.
   * <p>
   * The method is synchronized to prevent interleaving of requests and responses.
   * @param req control shell request
   * @return control shell response
   * @throws IOException if there was some kind of transport error, or if the
   *                     response indicates an error
   */
Sends a command to the control shell and receives its response.

The method is synchronized to prevent interleaving of requests and responses.
@param req control shell request
@return control shell response
@throws IOException if there was some kind of transport error, or if the
response indicates an error
Sends a command to the control shell and receives its response . The method is synchronized to prevent interleaving of requests and responses . @param req control shell request @return control shell response @throws IOException if there was some kind of transport error or if the response indicates an error
private synchronized ControlShellResponsePB sendRequestToCluster(ControlShellRequestPB req)
      throws IOException {
    LOG.debug("Request: {}", req);
    miniClusterStdin.writeInt(req.getSerializedSize());
    miniClusterStdin.write(req.toByteArray());
    miniClusterStdin.flush();
    int respLength = miniClusterStdout.readInt();
    byte[] respBody = new byte[respLength];
    miniClusterStdout.readFully(respBody);
    ControlShellResponsePB resp = ControlShellResponsePB.parseFrom(respBody);
    LOG.debug("Response: {}", resp);
    if (resp.hasError()) {
      throw new NonRecoverableException(Status.fromPB(resp.getError()));
    }
    return resp;
  }
private synchronized ControlShellResponsePB sendRequestToCluster ( ControlShellRequestPB req ) throws IOException { LOG . debug ( "Request: {}" , req ) ; miniClusterStdin . writeInt ( req . getSerializedSize ( ) ) ; miniClusterStdin . write ( req . toByteArray ( ) ) ; miniClusterStdin . flush ( ) ; int respLength = miniClusterStdout . readInt ( ) ; byte [ ] respBody = new byte [ respLength ] ; miniClusterStdout . readFully ( respBody ) ; ControlShellResponsePB resp = ControlShellResponsePB . parseFrom ( respBody ) ; LOG . debug ( "Response: {}" , resp ) ; if ( resp . hasError ( ) ) { throw new NonRecoverableException ( Status . fromPB ( resp . getError ( ) ) ) ; } return resp ; }
Sends a command to the control shell and receives its response.
Sends a command to the control shell and receives its response .
// Send the request's size (4 bytes, big endian) followed by the request. // Read the response's size (4 bytes, big endian) followed by the response. // Convert any error into an exception.