private void addLocalContainerIdsToProto() { maybeInitBuilder(); builder.clearContainerId(); if (this.containerIds == null) return; List<ContainerIdProto> protoList = new ArrayList<ContainerIdProto>(); for (ContainerId id : containerIds) { protoList.add(convertToProtoFormat(id)); } builder.addAllContainerId(protoList); }
private void addSucceededRequestsToProto() { maybeInitBuilder(); builder.clearSucceededRequests(); if (this.succeededRequests == null) { return; } Iterable<ContainerIdProto> iterable = new Iterable<ContainerIdProto>() { @Override public Iterator<ContainerIdProto> iterator() { return new Iterator<ContainerIdProto>() { Iterator<ContainerId> iter = succeededRequests.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllSucceededRequests(iterable); }
private void initSucceededRequests() { if (this.succeededRequests != null) return; StopContainersResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerIdProto> list = p.getSucceededRequestsList(); this.succeededRequests = new ArrayList<ContainerId>(); for (ContainerIdProto c : list) { this.succeededRequests.add(convertFromProtoFormat(c)); } }
private void initReleases() { if (this.release != null) { return; } AllocateRequestProtoOrBuilder p = viaProto ? proto : builder; List<ContainerIdProto> list = p.getReleaseList(); this.release = new ArrayList<ContainerId>(); for (ContainerIdProto c : list) { this.release.add(convertFromProtoFormat(c)); } }
private void addReleasesToProto() { maybeInitBuilder(); builder.clearRelease(); if (release == null) return; Iterable<ContainerIdProto> iterable = new Iterable<ContainerIdProto>() { @Override public Iterator<ContainerIdProto> iterator() { return new Iterator<ContainerIdProto>() { Iterator<ContainerId> iter = release.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllRelease(iterable); }
private void addSucceededContainersToProto() { maybeInitBuilder(); builder.clearSucceededRequests(); if (this.succeededContainers == null) { return; } Iterable<ContainerIdProto> iterable = new Iterable<ContainerIdProto>() { @Override public Iterator<ContainerIdProto> iterator() { return new Iterator<ContainerIdProto>() { Iterator<ContainerId> iter = succeededContainers.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllSucceededRequests(iterable); }
private void initSucceededContainers() { if (this.succeededContainers != null) return; StartContainersResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerIdProto> list = p.getSucceededRequestsList(); this.succeededContainers = new ArrayList<ContainerId>(); for (ContainerIdProto c : list) { this.succeededContainers.add(convertFromProtoFormat(c)); } }
private void initContainersToCleanup() { if (this.containersToCleanup != null) { return; } NodeHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerIdProto> list = p.getContainersToCleanupList(); this.containersToCleanup = new ArrayList<ContainerId>(); for (ContainerIdProto c : list) { this.containersToCleanup.add(convertFromProtoFormat(c)); } }
private void initContainersToBeRemovedFromNM() { if (this.containersToBeRemovedFromNM != null) { return; } NodeHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerIdProto> list = p.getContainersToBeRemovedFromNmList(); this.containersToBeRemovedFromNM = new ArrayList<ContainerId>(); for (ContainerIdProto c : list) { this.containersToBeRemovedFromNM.add(convertFromProtoFormat(c)); } }
private void addContainersToCleanupToProto() { maybeInitBuilder(); builder.clearContainersToCleanup(); if (containersToCleanup == null) return; Iterable<ContainerIdProto> iterable = new Iterable<ContainerIdProto>() { @Override public Iterator<ContainerIdProto> iterator() { return new Iterator<ContainerIdProto>() { Iterator<ContainerId> iter = containersToCleanup.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainersToCleanup(iterable); }
private void addContainersToBeRemovedFromNMToProto() { maybeInitBuilder(); builder.clearContainersToBeRemovedFromNm(); if (containersToBeRemovedFromNM == null) return; Iterable<ContainerIdProto> iterable = new Iterable<ContainerIdProto>() { @Override public Iterator<ContainerIdProto> iterator() { return new Iterator<ContainerIdProto>() { Iterator<ContainerId> iter = containersToBeRemovedFromNM.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ContainerIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllContainersToBeRemovedFromNm(iterable); }
private ContainerIdPBImpl convertFromProtoFormat(ContainerIdProto p) { return new ContainerIdPBImpl(p); }
private ContainerIdProto convertToProtoFormat(ContainerId t) { return ((ContainerIdPBImpl) t).getProto(); }