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

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

Introduction

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

Prototype

public synchronized AllocateResponseProto getProto() 

Source Link

Usage

From source file:io.hops.ha.common.TransactionStateImpl.java

License:Apache License

private void persistAllocateResponsesToAdd() throws IOException {
    if (!allocateResponsesToAdd.isEmpty()) {
        AllocateResponseDataAccess da = (AllocateResponseDataAccess) RMStorageFactory
                .getDataAccess(AllocateResponseDataAccess.class);
        List<AllocateResponse> toAdd = new ArrayList<AllocateResponse>();
        for (ApplicationAttemptId id : allocateResponsesToAdd.keySet()) {
            if (!allocateResponsesToRemove.remove(id)) {
                AllocateResponseLock lock = allocateResponsesToAdd.get(id);
                synchronized (lock) {
                    AllocateResponsePBImpl lastResponse = (AllocateResponsePBImpl) lock.getAllocateResponse();
                    if (lastResponse != null) {
                        toAdd.add(new AllocateResponse(id.toString(), lastResponse.getProto().toByteArray()));
                    }//  w  w w  . j  av a2 s .  co  m
                }
            }
        }
        da.addAll(toAdd);
    }
}