private void initApplicationsToCleanup() { if (this.applicationsToCleanup != null) { return; } NodeHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder; List<ApplicationIdProto> list = p.getApplicationsToCleanupList(); this.applicationsToCleanup = new ArrayList<ApplicationId>(); for (ApplicationIdProto c : list) { this.applicationsToCleanup.add(convertFromProtoFormat(c)); } }
private void addApplicationsToCleanupToProto() { maybeInitBuilder(); builder.clearApplicationsToCleanup(); if (applicationsToCleanup == null) return; Iterable<ApplicationIdProto> iterable = new Iterable<ApplicationIdProto>() { @Override public Iterator<ApplicationIdProto> iterator() { return new Iterator<ApplicationIdProto>() { Iterator<ApplicationId> iter = applicationsToCleanup.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ApplicationIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllApplicationsToCleanup(iterable); }
private void initRunningApplications() { if (this.runningApplications != null) { return; } RegisterNodeManagerRequestProtoOrBuilder p = viaProto ? proto : builder; List<ApplicationIdProto> list = p.getRunningApplicationsList(); this.runningApplications = new ArrayList<ApplicationId>(); for (ApplicationIdProto c : list) { this.runningApplications.add(convertFromProtoFormat(c)); } }
private void addRunningApplicationsToProto() { maybeInitBuilder(); builder.clearRunningApplications(); if (runningApplications == null) { return; } Iterable<ApplicationIdProto> it = new Iterable<ApplicationIdProto>() { @Override public Iterator<ApplicationIdProto> iterator() { return new Iterator<ApplicationIdProto>() { Iterator<ApplicationId> iter = runningApplications.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ApplicationIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllRunningApplications(it); }
private synchronized void addKeepAliveApplicationsToProto() { maybeInitBuilder(); builder.clearKeepAliveApplications(); if (keepAliveApplications == null) return; Iterable<ApplicationIdProto> iterable = new Iterable<ApplicationIdProto>() { @Override public Iterator<ApplicationIdProto> iterator() { return new Iterator<ApplicationIdProto>() { Iterator<ApplicationId> iter = keepAliveApplications.iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public ApplicationIdProto next() { return convertToProtoFormat(iter.next()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; builder.addAllKeepAliveApplications(iterable); }
private synchronized void initKeepAliveApplications() { if (this.keepAliveApplications != null) { return; } NodeStatusProtoOrBuilder p = viaProto ? proto : builder; List<ApplicationIdProto> list = p.getKeepAliveApplicationsList(); this.keepAliveApplications = new ArrayList<ApplicationId>(); for (ApplicationIdProto c : list) { this.keepAliveApplications.add(convertFromProtoFormat(c)); } }
private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) { return new ApplicationIdPBImpl(p); }
private ApplicationIdProto convertToProtoFormat(ApplicationId t) { return ((ApplicationIdPBImpl)t).getProto(); }