class RetrySampleItemWriter<T> implements ItemWriter<T> {

	private int counter = 0;

	@Override
	public void write(Chunk<? extends T> items) throws Exception {<FILL_FUNCTION_BODY>}

	/**
	 * @return number of times {@link #write(Chunk)} method was called.
	 */
	public int getCounter() {
		return counter;
	}

}

		int current = counter;
		counter += items.size();
		if (current < 3 && (counter >= 2 || counter >= 3)) {
			throw new IllegalStateException("Temporary error");
		}
	
<no_super_class>