Example usage for org.apache.hadoop.yarn.webapp BadRequestException BadRequestException

List of usage examples for org.apache.hadoop.yarn.webapp BadRequestException BadRequestException

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.webapp BadRequestException BadRequestException.

Prototype

public BadRequestException(String msg) 

Source Link

Usage

From source file:org.apache.slider.server.appmaster.web.rest.application.ApplicationResource.java

License:Apache License

public ConfTree setModelDesiredResources(String json) {
    markPut(SLIDER_SUBPATH_APPLICATION, MODEL_DESIRED_RESOURCES);
    int size = json != null ? json.length() : 0;
    log.info("PUT {} {} bytes:\n{}", MODEL_DESIRED_RESOURCES, size, json);
    if (size == 0) {
        log.warn("No JSON in PUT request; rejecting");
        throw new BadRequestException("No JSON in PUT");
    }//  ww w  .jav  a 2 s. com

    try {
        ConfTreeSerDeser serDeser = new ConfTreeSerDeser();
        ConfTree updated = serDeser.fromJson(json);
        queue(new ActionFlexCluster("flex", 1, TimeUnit.MILLISECONDS, updated));
        // return the updated value, even though it potentially hasn't yet
        // been executed
        return updated;
    } catch (Exception e) {
        throw buildException("PUT to " + MODEL_DESIRED_RESOURCES, e);
    }
}