Search in sources :

Example 1 with ApplicationUpdateTimeoutMapProto

use of org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto in project hadoop by apache.

the class UpdateApplicationTimeoutsRequestPBImpl method addApplicationTimeouts.

private void addApplicationTimeouts() {
    maybeInitBuilder();
    builder.clearApplicationTimeouts();
    if (applicationTimeouts == null) {
        return;
    }
    Iterable<? extends ApplicationUpdateTimeoutMapProto> values = new Iterable<ApplicationUpdateTimeoutMapProto>() {

        @Override
        public Iterator<ApplicationUpdateTimeoutMapProto> iterator() {
            return new Iterator<ApplicationUpdateTimeoutMapProto>() {

                private Iterator<ApplicationTimeoutType> iterator = applicationTimeouts.keySet().iterator();

                @Override
                public boolean hasNext() {
                    return iterator.hasNext();
                }

                @Override
                public ApplicationUpdateTimeoutMapProto next() {
                    ApplicationTimeoutType key = iterator.next();
                    return ApplicationUpdateTimeoutMapProto.newBuilder().setExpireTime(applicationTimeouts.get(key)).setApplicationTimeoutType(ProtoUtils.convertToProtoFormat(key)).build();
                }

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
    this.builder.addAllApplicationTimeouts(values);
}
Also used : ApplicationTimeoutType(org.apache.hadoop.yarn.api.records.ApplicationTimeoutType) Iterator(java.util.Iterator) ApplicationUpdateTimeoutMapProto(org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto)

Example 2 with ApplicationUpdateTimeoutMapProto

use of org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto in project hadoop by apache.

the class UpdateApplicationTimeoutsRequestPBImpl method initApplicationTimeout.

private void initApplicationTimeout() {
    if (this.applicationTimeouts != null) {
        return;
    }
    UpdateApplicationTimeoutsRequestProtoOrBuilder p = viaProto ? proto : builder;
    List<ApplicationUpdateTimeoutMapProto> lists = p.getApplicationTimeoutsList();
    this.applicationTimeouts = new HashMap<ApplicationTimeoutType, String>(lists.size());
    for (ApplicationUpdateTimeoutMapProto timeoutProto : lists) {
        this.applicationTimeouts.put(ProtoUtils.convertFromProtoFormat(timeoutProto.getApplicationTimeoutType()), timeoutProto.getExpireTime());
    }
}
Also used : ApplicationTimeoutType(org.apache.hadoop.yarn.api.records.ApplicationTimeoutType) UpdateApplicationTimeoutsRequestProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProtoOrBuilder) ApplicationUpdateTimeoutMapProto(org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto)

Aggregations

ApplicationTimeoutType (org.apache.hadoop.yarn.api.records.ApplicationTimeoutType)2 ApplicationUpdateTimeoutMapProto (org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto)2 Iterator (java.util.Iterator)1 UpdateApplicationTimeoutsRequestProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProtoOrBuilder)1