@Override
  public void doQuery(List<@Nullable ITmfStateInterval> currentStateInfo, long t)
      throws TimeRangeException, StateSystemDisposedException {
    /* Wait for required steps to be done */
    waitForCheckpoints();
    fPartialSS.getUpstreamSS().waitUntilBuilt();

    if (!checkValidTime(t)) {
      throw new TimeRangeException(
          fSSID
              + " Time:"
              + t
              + ", Start:"
              + getStartTime()
              + ", End:"
              + getEndTime()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }

    /* Reload the previous checkpoint */
    long checkpointTime = fCheckpoints.floorKey(t);
    fInnerHistory.doQuery(currentStateInfo, checkpointTime);

    /*
     * Set the initial contents of the partial state system (which is the
     * contents of the query at the checkpoint).
     */
    List<@NonNull ITmfStateInterval> filledStateInfo =
        checkNotNullContents(currentStateInfo.stream()).collect(Collectors.toList());

    fPartialSS.takeQueryLock();
    fPartialSS.replaceOngoingState(filledStateInfo);

    /* Send an event request to update the state system to the target time. */
    TmfTimeRange range =
        new TmfTimeRange(
            /*
             * The state at the checkpoint already includes any state change
             * caused by the event(s) happening exactly at 'checkpointTime',
             * if any. We must not include those events in the query.
             */
            TmfTimestamp.fromNanos(checkpointTime + 1), TmfTimestamp.fromNanos(t));
    ITmfEventRequest request = new PartialStateSystemRequest(fPartialInput, range);
    fPartialInput.getTrace().sendRequest(request);

    try {
      request.waitForCompletion();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }

    /*
     * Now the partial state system should have the ongoing time we are
     * looking for. However, the method expects a List of *state intervals*,
     * not state values, so we'll create intervals with a dummy end time.
     */
    for (int i = 0; i < currentStateInfo.size(); i++) {
      long start = 0;
      start = ((ITmfStateSystem) fPartialSS).getOngoingStartTime(i);
      ITmfStateValue val = ((ITmfStateSystem) fPartialSS).queryOngoingState(i);

      ITmfStateInterval interval = new TmfStateInterval(start, t, i, checkNotNull(val));
      currentStateInfo.set(i, interval);
    }

    fPartialSS.releaseQueryLock();
  }
 @Override
 public void dispose() {
   fPartialInput.dispose();
   fPartialSS.dispose();
   fInnerHistory.dispose();
 }