/** * Constructs a new {@code Context} by reading from a {@link DataInputView} that contains a * serialized context that we wrote in {@link * #writeToState(StateBackend.CheckpointStateOutputView)} */ @SuppressWarnings("unchecked") protected Context(DataInputView in, ClassLoader userClassloader) throws Exception { this.key = keySerializer.deserialize(in); this.window = windowSerializer.deserialize(in); this.watermarkTimer = in.readLong(); this.processingTimeTimer = in.readLong(); int stateSize = in.readInt(); byte[] stateData = new byte[stateSize]; in.read(stateData); state = InstantiationUtil.deserializeObject(stateData, userClassloader); this.windowBuffer = windowBufferFactory.create(); int numElements = in.readInt(); MultiplexingStreamRecordSerializer<IN> recordSerializer = new MultiplexingStreamRecordSerializer<>(inputSerializer); for (int i = 0; i < numElements; i++) { windowBuffer.storeElement(recordSerializer.deserialize(in).<IN>asRecord()); } }