Example usage for org.apache.hadoop.yarn.api.protocolrecords.impl.pb AllocateResponsePBImpl AllocateResponsePBImpl

List of usage examples for org.apache.hadoop.yarn.api.protocolrecords.impl.pb AllocateResponsePBImpl AllocateResponsePBImpl

Introduction

In this page you can find the example usage for org.apache.hadoop.yarn.api.protocolrecords.impl.pb AllocateResponsePBImpl AllocateResponsePBImpl.

Prototype

public AllocateResponsePBImpl(AllocateResponseProto proto) 

Source Link

Usage

From source file:io.hops.metadata.util.RMUtilities.java

License:Apache License

public static Map<ApplicationAttemptId, org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse> getAllocateResponses()
        throws IOException {
    LightWeightRequestHandler allocateResponsesHandler = new LightWeightRequestHandler(YARNOperationType.TEST) {

        @Override/*from w ww.java 2  s .  com*/
        public Object performTask() throws IOException {
            connector.beginTransaction();
            connector.writeLock();
            AllocateResponseDataAccess da = (AllocateResponseDataAccess) RMStorageFactory
                    .getDataAccess(AllocateResponseDataAccess.class);
            List<AllocateResponse> hopAllocateResponses = (List<AllocateResponse>) da.getAll();
            connector.commit();
            Map<ApplicationAttemptId, org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse> allocateResponses = new HashMap<ApplicationAttemptId, org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse>();
            if (hopAllocateResponses != null) {
                for (AllocateResponse hopAllocateResponse : hopAllocateResponses) {
                    org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse allocateResponse = new AllocateResponsePBImpl(
                            YarnServiceProtos.AllocateResponseProto
                                    .parseFrom(hopAllocateResponse.getAllocateResponse()));
                    allocateResponses.put(ConverterUtils.toApplicationAttemptId(
                            hopAllocateResponse.getApplicationattemptid()), allocateResponse);
                }
            }
            return allocateResponses;
        }
    };
    return (Map<ApplicationAttemptId, org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse>) allocateResponsesHandler
            .handle();
}