Exemplo n.º 1
0
  @Override
  public void restoreState(StreamTaskState taskState, long recoveryTimestamp) throws Exception {
    super.restoreState(taskState, recoveryTimestamp);

    final ClassLoader userClassloader = getUserCodeClassloader();

    @SuppressWarnings("unchecked")
    StateHandle<DataInputView> inputState =
        (StateHandle<DataInputView>) taskState.getOperatorState();
    DataInputView in = inputState.getState(userClassloader);

    int numKeys = in.readInt();
    this.windows = new HashMap<>(numKeys);
    this.processingTimeTimers = new HashMap<>();
    this.watermarkTimers = new HashMap<>();

    for (int i = 0; i < numKeys; i++) {
      int numWindows = in.readInt();
      for (int j = 0; j < numWindows; j++) {
        Context context = new Context(in, userClassloader);
        Map<W, Context> keyWindows = windows.get(context.key);
        if (keyWindows == null) {
          keyWindows = new HashMap<>(numWindows);
          windows.put(context.key, keyWindows);
        }
        keyWindows.put(context.window, context);
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public void restoreState(StreamTaskState taskState, long recoveryTimestamp) throws Exception {
    super.restoreState(taskState, recoveryTimestamp);

    final ClassLoader userClassloader = getUserCodeClassloader();

    @SuppressWarnings("unchecked")
    StateHandle<DataInputView> inputState =
        (StateHandle<DataInputView>) taskState.getOperatorState();
    DataInputView in = inputState.getState(userClassloader);

    restoreTimers(in);
  }