private synchronized void initLocalDecreasedContainerList() { if (this.decreasedContainers != null) { return; } AllocateResponseProtoOrBuilder p = viaProto ? proto : builder; List<ContainerResourceDecreaseProto> list = p.getDecreasedContainersList(); decreasedContainers = new ArrayList<ContainerResourceDecrease>(); for (ContainerResourceDecreaseProto c : list) { decreasedContainers.add(convertFromProtoFormat(c)); } }
private synchronized Iterable<ContainerResourceDecreaseProto> getChangeProtoIterable( final List<ContainerResourceDecrease> newContainersList) { maybeInitBuilder(); return new Iterable<ContainerResourceDecreaseProto>() { @Override public synchronized Iterator<ContainerResourceDecreaseProto> iterator() { return new Iterator<ContainerResourceDecreaseProto>() { Iterator<ContainerResourceDecrease> iter = newContainersList .iterator(); @Override public synchronized boolean hasNext() { return iter.hasNext(); } @Override public synchronized ContainerResourceDecreaseProto next() { return convertToProtoFormat(iter.next()); } @Override public synchronized void remove() { throw new UnsupportedOperationException(); } }; } }; }
private synchronized ContainerResourceDecrease convertFromProtoFormat( ContainerResourceDecreaseProto p) { return new ContainerResourceDecreasePBImpl(p); }
private synchronized ContainerResourceDecreaseProto convertToProtoFormat( ContainerResourceDecrease t) { return ((ContainerResourceDecreasePBImpl) t).getProto(); }
public ContainerResourceDecreasePBImpl() { builder = ContainerResourceDecreaseProto.newBuilder(); }
public ContainerResourceDecreasePBImpl(ContainerResourceDecreaseProto proto) { this.proto = proto; viaProto = true; }
public ContainerResourceDecreaseProto getProto() { mergeLocalToProto(); proto = viaProto ? proto : builder.build(); viaProto = true; return proto; }
private void maybeInitBuilder() { if (viaProto || builder == null) { builder = ContainerResourceDecreaseProto.newBuilder(proto); } viaProto = false; }