Package org.springframework.batch.item

Examples of org.springframework.batch.item.ItemStreamException


          return writer;
        }
      }
      catch (UnsupportedCharsetException ucse) {
        throw new ItemStreamException("Bad encoding configuration for output file " + fileChannel, ucse);
      }
    }
View Full Code Here


      outputBufferedWriter.flush();
      size = fileChannel.size();

      if (size < lastMarkedByteOffsetPosition) {
        throw new ItemStreamException("Current file size is smaller than size at last commit");
      }
    }
View Full Code Here

          headerCallback.write(headerCallbackWriter);
          unclosedHeaderCallbackElements = headerCallbackWriter.getUnclosedElements();
        }
      }
      catch (IOException e) {
        throw new ItemStreamException("Failed to write headerItems", e);
      }
    }

  }
View Full Code Here

      }
      delegateEventWriter.flush();
      endDocument(delegateEventWriter);
    }
    catch (IOException e) {
      throw new ItemStreamException("Failed to write footer items", e);
    }
    catch (XMLStreamException e) {
      throw new ItemStreamException("Failed to write end document tag", e);
    }
    finally {

      try {
        delegateEventWriter.close();
      }
      catch (XMLStreamException e) {
        log.error("Unable to close file resource: [" + resource + "] " + e);
      }
      finally {
        try {
          bufferedWriter.close();
        }
        catch (IOException e) {
          log.error("Unable to close file resource: [" + resource + "] " + e);
        }
        finally {
          if (!transactional) {
            closeStream();
          }
        }
      }
      if (currentRecordCount == 0 && shouldDeleteIfEmpty) {
        try {
          resource.getFile().delete();
        }
        catch (IOException e) {
          throw new ItemStreamException("Failed to delete empty file on close", e);
        }
      }
    }
  }
View Full Code Here

    currentItemCount = 0;
    try {
      doClose();
    }
    catch (Exception e) {
      throw new ItemStreamException("Error while closing item reader", e);
    }
  }
View Full Code Here

    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));
    }

    int itemCount = 0;
    if (executionContext.containsKey(getExecutionContextKey(READ_COUNT))) {
      itemCount = executionContext.getInt(getExecutionContextKey(READ_COUNT));
    }
    else if(currentItemCount > 0) {
      itemCount = currentItemCount;
    }

    if (itemCount > 0 && itemCount < maxItemCount) {
      try {
        jumpToItem(itemCount);
      }
      catch (Exception e) {
        throw new ItemStreamException("Could not move to stored position on restart", e);
      }
    }

    currentItemCount = itemCount;
View Full Code Here

  public void open(ExecutionContext executionContext) throws ItemStreamException {
    if (executionContext.containsKey(EXPECTED)) {
      localState.open(executionContext.getInt(EXPECTED), executionContext.getInt(ACTUAL));
      if (!waitForResults()) {
        throw new ItemStreamException("Timed out waiting for back log on open");
      }
    }
  }
View Full Code Here

      for (int i = 0; i < data.offset; i++) {
        try {
          reader.read();
        }
        catch (Exception e) {
          throw new ItemStreamException("Could not position reader with offset: " + data.offset, e);
        }
      }

      resetOffset();
    }
View Full Code Here

  public void open(ExecutionContext executionContext)
      throws ItemStreamException {
    try {
      doOpen((Serializable) executionContext.get(getExecutionContextKey(checkpointKey)));
    } catch (Exception e) {
      throw new ItemStreamException(e);
    }
  }
View Full Code Here

  public void update(ExecutionContext executionContext)
      throws ItemStreamException {
    try {
      executionContext.put(getExecutionContextKey(checkpointKey), deepCopy(doCheckpoint()));
    } catch (Exception e) {
      throw new ItemStreamException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.item.ItemStreamException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.