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);
    }
  }
Example #2
0
 @Override
 public TaggedUnion<T1, T2> deserialize(DataInputView source) throws IOException {
   byte tag = source.readByte();
   if (tag == 1) {
     return TaggedUnion.one(oneSerializer.deserialize(source));
   } else {
     return TaggedUnion.two(twoSerializer.deserialize(source));
   }
 }
 @Override
 public StreamRecord<T> deserialize(StreamRecord<T> reuse, DataInputView source)
     throws IOException {
   T element = typeSerializer.deserialize(reuse.getValue(), source);
   reuse.replace(element, 0);
   return reuse;
 }
    @Override
    public T next() throws IOException {
      Tuple value = tupleInput.next(this.value);
      if (value != null) {
        this.value = value;
        long pointer = value.<Long>getField(pointerPos);

        recordsInputs.seek(pointer);
        return serializer.deserialize(recordsInputs);
      } else {
        return null;
      }
    }
  @Override
  public C[] deserialize(DataInputView source) throws IOException {
    int len = source.readInt();

    C[] array = create(len);

    for (int i = 0; i < len; i++) {
      boolean isNonNull = source.readBoolean();
      if (isNonNull) {
        array[i] = componentSerializer.deserialize(source);
      } else {
        array[i] = null;
      }
    }

    return array;
  }
 @Override
 public StreamRecord<T> deserialize(DataInputView source) throws IOException {
   T element = typeSerializer.deserialize(source);
   return new StreamRecord<T>(element, 0);
 }