package com.oguerreiro.resilient.activity;

import java.util.Iterator;

/**
 * 
 * @param <T> is the reader type class
 */
public abstract class AbstractReaderThreadSafeContext <T> {
	private final Iterator<T> reader;
	
	protected AbstractReaderThreadSafeContext(Iterator<T> reader) {
		this.reader = reader;
	}
	
	public synchronized T next() {
		if (this.reader.hasNext())
			return this.reader.next();
		
		return null;
	}
}
