@Override
  public void open(ExecutionContext executionContext) throws ItemStreamException {
    super.open(executionContext);
    try {
      doOpen();
    } catch (Exception e) {
      throw new ItemStreamException("Failed to initialize the reader", e);
    }
    if (!isSaveState()) {
      return;
    }

    if (executionContext.containsKey(getExecutionContextKey(READ_COUNT_MAX))) {
      maxItemCount = executionContext.getInt(getExecutionContextKey(READ_COUNT_MAX));
    }

    if (executionContext.containsKey(getExecutionContextKey(READ_COUNT))) {
      int itemCount = executionContext.getInt(getExecutionContextKey(READ_COUNT));

      if (itemCount < maxItemCount) {
        try {
          jumpToItem(itemCount);
        } catch (Exception e) {
          throw new ItemStreamException("Could not move to stored position on restart", e);
        }
      }
      currentItemCount = itemCount;
    }
  }
Exemplo n.º 2
0
 public void open(ExecutionContext executionContext) throws ItemStreamException {
   if (executionContext.containsKey("step2.tickers.page")) {
     curPage = (Integer) executionContext.get("step2.tickers.page");
   } else {
     executionContext.put("step2.tickers.page", curPage);
   }
 }
 public void open(ExecutionContext executionContext) throws ItemStreamException {
   if (executionContext.containsKey(EXPECTED)) {
     localState.expected = executionContext.getLong(EXPECTED);
     localState.actual = executionContext.getLong(ACTUAL);
     if (!waitForResults()) {
       throw new ItemStreamException("Timed out waiting for back log on open");
     }
   }
 }