private void addLocalContainerStatusesToProto() { maybeInitBuilder(); builder.clearStatus(); if (this.containerStatuses == null) return; List<ContainerStatusProto> protoList = new ArrayList<ContainerStatusProto>(); for (ContainerStatus status : containerStatuses) { protoList.add(convertToProtoFormat(status)); } builder.addAllStatus(protoList); }
private void initLocalContainerStatuses() { if (this.containerStatuses != null) { return; } GetContainerStatusesResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerStatusProto> statuses = p.getStatusList(); this.containerStatuses = new ArrayList<ContainerStatus>(); for (ContainerStatusProto status : statuses) { this.containerStatuses.add(convertFromProtoFormat(status)); } }
private synchronized Iterable<ContainerStatusProto> getContainerStatusProtoIterable( final List<ContainerStatus> newContainersList) { maybeInitBuilder(); return new Iterable<ContainerStatusProto>() { @Override public synchronized Iterator<ContainerStatusProto> iterator() { return new Iterator<ContainerStatusProto>() { Iterator<ContainerStatus> iter = newContainersList.iterator(); @Override public synchronized boolean hasNext() { return iter.hasNext(); } @Override public synchronized ContainerStatusProto next() { return convertToProtoFormat(iter.next()); } @Override public synchronized void remove() { throw new UnsupportedOperationException(); } }; } }; }
private synchronized void initLocalFinishedContainerList() { if (this.completedContainersStatuses != null) { return; } AllocateResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerStatusProto> list = p.getCompletedContainerStatusesList(); completedContainersStatuses = new ArrayList<ContainerStatus>(); for (ContainerStatusProto c : list) { completedContainersStatuses.add(convertFromProtoFormat(c)); } }
private synchronized void addContainersToProto() { maybeInitBuilder(); builder.clearContainersStatuses(); if (containers == null) return; Iterable<ContainerStatusProto> iterable = new Iterable<ContainerStatusProto>() { @Override public Iterator<ContainerStatusProto> iterator() { return new Iterator<ContainerStatusProto>() { Iterator<ContainerStatus> iter = containers.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerStatusProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainersStatuses(iterable); }
private synchronized void initContainers() { if (this.containers != null) { return; } NodeStatusProtoOrBuilder p = viaProto ? proto : builder; List<ContainerStatusProto> list = p.getContainersStatusesList(); this.containers = new ArrayList<ContainerStatus>(); for (ContainerStatusProto c : list) { this.containers.add(convertFromProtoFormat(c)); } }