class SynchronizedItemWriter<T> implements ItemWriter<T> {

	private final ItemWriter<T> delegate;

	private final Lock lock = new ReentrantLock();

	public SynchronizedItemWriter(ItemWriter<T> delegate) {
		Assert.notNull(delegate, "The delegate must not be null");
		this.delegate = delegate;
	}

	/**
	 * This method delegates to the {@code write} method of the delegate and is
	 * synchronized with a lock.
	 */
	@Override
	public void write(Chunk<? extends T> items) throws Exception {<FILL_FUNCTION_BODY>}

}

		this.lock.lock();
		try {
			this.delegate.write(items);
		}
		finally {
			this.lock.unlock();
		}
	
<no_super_class>