Esempio n. 1
0
  private void restoreTimers(DataInputView in) throws IOException {
    int numWatermarkTimers = in.readInt();
    watermarkTimers = new HashSet<>(numWatermarkTimers);
    watermarkTimersQueue = new PriorityQueue<>(Math.max(numWatermarkTimers, 1));
    for (int i = 0; i < numWatermarkTimers; i++) {
      K key = keySerializer.deserialize(in);
      W window = windowSerializer.deserialize(in);
      long timestamp = in.readLong();
      Timer<K, W> timer = new Timer<>(timestamp, key, window);
      watermarkTimers.add(timer);
      watermarkTimersQueue.add(timer);
    }

    int numProcessingTimeTimers = in.readInt();
    processingTimeTimersQueue = new PriorityQueue<>(Math.max(numProcessingTimeTimers, 1));
    processingTimeTimers = new HashSet<>();
    for (int i = 0; i < numProcessingTimeTimers; i++) {
      K key = keySerializer.deserialize(in);
      W window = windowSerializer.deserialize(in);
      long timestamp = in.readLong();
      Timer<K, W> timer = new Timer<>(timestamp, key, window);
      processingTimeTimersQueue.add(timer);
      processingTimeTimers.add(timer);
    }

    int numProcessingTimeTimerTimestamp = in.readInt();
    processingTimeTimerTimestamps = HashMultiset.create();
    for (int i = 0; i < numProcessingTimeTimerTimestamp; i++) {
      long timestamp = in.readLong();
      int count = in.readInt();
      processingTimeTimerTimestamps.add(timestamp, count);
    }
  }
Esempio n. 2
0
    /**
     * 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());
      }
    }
Esempio n. 3
0
 @Override
 public void read(DataInputView in) throws IOException {
   this.lowerPart = in.readLong();
   this.upperPart = in.readLong();
 }