|
@@ -80,6 +80,8 @@ public class NodeHeartbeatResponsePBImpl extends NodeHeartbeatResponse {
|
|
private MasterKey nmTokenMasterKey = null;
|
|
private MasterKey nmTokenMasterKey = null;
|
|
private ContainerQueuingLimit containerQueuingLimit = null;
|
|
private ContainerQueuingLimit containerQueuingLimit = null;
|
|
private List<Container> containersToUpdate = null;
|
|
private List<Container> containersToUpdate = null;
|
|
|
|
+ // NOTE: This is required for backward compatibility.
|
|
|
|
+ private List<Container> containersToDecrease = null;
|
|
private List<SignalContainerRequest> containersToSignal = null;
|
|
private List<SignalContainerRequest> containersToSignal = null;
|
|
|
|
|
|
public NodeHeartbeatResponsePBImpl() {
|
|
public NodeHeartbeatResponsePBImpl() {
|
|
@@ -126,6 +128,9 @@ public class NodeHeartbeatResponsePBImpl extends NodeHeartbeatResponse {
|
|
if (this.containersToUpdate != null) {
|
|
if (this.containersToUpdate != null) {
|
|
addContainersToUpdateToProto();
|
|
addContainersToUpdateToProto();
|
|
}
|
|
}
|
|
|
|
+ if (this.containersToDecrease != null) {
|
|
|
|
+ addContainersToDecreaseToProto();
|
|
|
|
+ }
|
|
if (this.containersToSignal != null) {
|
|
if (this.containersToSignal != null) {
|
|
addContainersToSignalToProto();
|
|
addContainersToSignalToProto();
|
|
}
|
|
}
|
|
@@ -572,6 +577,66 @@ public class NodeHeartbeatResponsePBImpl extends NodeHeartbeatResponse {
|
|
builder.addAllContainersToUpdate(iterable);
|
|
builder.addAllContainersToUpdate(iterable);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void initContainersToDecrease() {
|
|
|
|
+ if (this.containersToDecrease != null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ NodeHeartbeatResponseProtoOrBuilder p = viaProto ? proto : builder;
|
|
|
|
+ List<ContainerProto> list = p.getContainersToDecreaseList();
|
|
|
|
+ this.containersToDecrease = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (ContainerProto c : list) {
|
|
|
|
+ this.containersToDecrease.add(convertFromProtoFormat(c));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Container> getContainersToDecrease() {
|
|
|
|
+ initContainersToDecrease();
|
|
|
|
+ return this.containersToDecrease;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void addAllContainersToDecrease(
|
|
|
|
+ final Collection<Container> containersToDecrease) {
|
|
|
|
+ if (containersToDecrease == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ initContainersToDecrease();
|
|
|
|
+ this.containersToDecrease.addAll(containersToDecrease);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void addContainersToDecreaseToProto() {
|
|
|
|
+ maybeInitBuilder();
|
|
|
|
+ builder.clearContainersToDecrease();
|
|
|
|
+ if (this.containersToDecrease == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Iterable<ContainerProto> iterable = new
|
|
|
|
+ Iterable<ContainerProto>() {
|
|
|
|
+ @Override
|
|
|
|
+ public Iterator<ContainerProto> iterator() {
|
|
|
|
+ return new Iterator<ContainerProto>() {
|
|
|
|
+ private Iterator<Container> iter = containersToDecrease.iterator();
|
|
|
|
+ @Override
|
|
|
|
+ public boolean hasNext() {
|
|
|
|
+ return iter.hasNext();
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public ContainerProto next() {
|
|
|
|
+ return convertToProtoFormat(iter.next());
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public void remove() {
|
|
|
|
+ throw new UnsupportedOperationException();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ builder.addAllContainersToDecrease(iterable);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps() {
|
|
public Map<ApplicationId, ByteBuffer> getSystemCredentialsForApps() {
|
|
if (this.systemCredentials != null) {
|
|
if (this.systemCredentials != null) {
|