Example usage for org.apache.hadoop.yarn.api.records ApplicationId compareTo

List of usage examples for org.apache.hadoop.yarn.api.records ApplicationId compareTo

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.records ApplicationId compareTo.

Prototype

@Override
    public int compareTo(ApplicationId other) 

Source Link

Usage

From source file:org.apache.samza.validation.YarnJobValidationTool.java

License:Apache License

public ApplicationId validateAppId() throws Exception {
    // fetch only the last created application with the job name and id
    // i.e. get the application with max appId
    ApplicationId appId = null;
    for (ApplicationReport applicationReport : this.client.getApplications()) {
        if (applicationReport.getName().equals(this.jobName)) {
            ApplicationId id = applicationReport.getApplicationId();
            if (appId == null || appId.compareTo(id) < 0) {
                appId = id;/*from   w w w .  j a v a 2 s. com*/
            }
        }
    }
    if (appId != null) {
        log.info("Job lookup success. ApplicationId " + appId.toString());
        return appId;
    } else {
        throw new SamzaException("Job lookup failure " + this.jobName);
    }
}