public void checkValidTransition(OutputBuffers newOutputBuffers) { requireNonNull(newOutputBuffers, "newOutputBuffers is null"); checkState(type == newOutputBuffers.getType(), "newOutputBuffers has a different type"); if (noMoreBufferIds) { checkArgument(this.equals(newOutputBuffers), "Expected buffer to not change after no more buffers is set"); return; } if (version > newOutputBuffers.version) { throw new IllegalArgumentException("newOutputBuffers version is older"); } if (version == newOutputBuffers.version) { checkArgument(this.equals(newOutputBuffers), "newOutputBuffers is the same version but contains different information"); } // assure we have not changed the buffer assignments for (Entry<OutputBufferId, Integer> entry : buffers.entrySet()) { if (!entry.getValue().equals(newOutputBuffers.buffers.get(entry.getKey()))) { throw new IllegalArgumentException("newOutputBuffers has changed the assignment for task " + entry.getKey()); } } }
public void checkValidTransition(OutputBuffers newOutputBuffers) { requireNonNull(newOutputBuffers, "newOutputBuffers is null"); if (version > newOutputBuffers.version) { throw new IllegalArgumentException("newOutputBuffers version is older"); } if (version == newOutputBuffers.version) { checkArgument(this.equals(newOutputBuffers), "newOutputBuffers is the same version but contains different information"); } // assure we are not removing the no more buffers flag if (noMoreBufferIds && !newOutputBuffers.noMoreBufferIds) { throw new IllegalArgumentException("Expected newOutputBuffers to have noMoreBufferIds set"); } // assure we have not changed the buffer assignments for (Entry<TaskId, Integer> entry : buffers.entrySet()) { if (!entry.getValue().equals(newOutputBuffers.buffers.get(entry.getKey()))) { throw new IllegalArgumentException("newOutputBuffers has changed the assignment for task " + entry.getKey()); } } }