List of usage examples for org.springframework.batch.item ReaderNotOpenException ReaderNotOpenException
public ReaderNotOpenException(String message)
From source file:org.springframework.batch.sample.common.StagingItemReader.java
@Override public ProcessIndicatorItemWrapper<T> read() { if (!initialized) { throw new ReaderNotOpenException("Reader must be open before it can be used."); }/*from w ww. java 2 s . c o m*/ Long id = null; synchronized (lock) { if (keys.hasNext()) { id = keys.next(); } } logger.debug("Retrieved key from list: " + id); if (id == null) { return null; } @SuppressWarnings("unchecked") T result = (T) jdbcTemplate.queryForObject("SELECT VALUE FROM BATCH_STAGING WHERE ID=?", new RowMapper<Object>() { @Override public Object mapRow(ResultSet rs, int rowNum) throws SQLException { byte[] blob = rs.getBytes(1); return SerializationUtils.deserialize(blob); } }, id); return new ProcessIndicatorItemWrapper<T>(id, result); }