hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/web/client/OzoneRestClient.java
private void executeCreateVolume(HttpPost httppost,
      final CloseableHttpClient httpClient)
      throws IOException, OzoneException {
    HttpEntity entity = null;
    try {
      HttpResponse response = httpClient.execute(httppost);
      int errorCode = response.getStatusLine().getStatusCode();
      entity = response.getEntity();

      if ((errorCode == HTTP_OK) || (errorCode == HTTP_CREATED)) {
        return;
      }

      if (entity != null) {
        throw OzoneException.parse(EntityUtils.toString(entity));
      } else {
        throw new OzoneRestClientException("Unexpected null in http payload");
      }
    } finally {
      if (entity != null) {
        EntityUtils.consume(entity);
      }
    }
  }
/**
   * Sends the create Volume request to the server.
   *
   * @param httppost   - http post class
   * @param httpClient - httpClient
   * @throws IOException    -
   * @throws OzoneException
   */
Sends the create Volume request to the server.
@param httppost   - http post class
@param httpClient - httpClient
@throws IOException
@throws OzoneException
Sends the create Volume request to the server . @param httppost - http post class @param httpClient - httpClient @throws IOException @throws OzoneException
private void executeCreateVolume(HttpPost httppost,
      final CloseableHttpClient httpClient)
      throws IOException, OzoneException {
    HttpEntity entity = null;
    try {
      HttpResponse response = httpClient.execute(httppost);
      int errorCode = response.getStatusLine().getStatusCode();
      entity = response.getEntity();
      if ((errorCode == HTTP_OK) || (errorCode == HTTP_CREATED)) {
        return;
      }
      if (entity != null) {
        throw OzoneException.parse(EntityUtils.toString(entity));
      } else {
        throw new OzoneRestClientException("Unexpected null in http payload");
      }
    } finally {
      if (entity != null) {
        EntityUtils.consume(entity);
      }
    }
  }
private void executeCreateVolume ( HttpPost httppost , final CloseableHttpClient httpClient ) throws IOException , OzoneException { HttpEntity entity = null ; try { HttpResponse response = httpClient . execute ( httppost ) ; int errorCode = response . getStatusLine ( ) . getStatusCode ( ) ; entity = response . getEntity ( ) ; if ( ( errorCode == HTTP_OK ) || ( errorCode == HTTP_CREATED ) ) { return ; } if ( entity != null ) { throw OzoneException . parse ( EntityUtils . toString ( entity ) ) ; } else { throw new OzoneRestClientException ( "Unexpected null in http payload" ) ; } } finally { if ( entity != null ) { EntityUtils . consume ( entity ) ; } } }
Sends the create Volume request to the server.
Sends the create Volume request to the server .