package eu.dnetlib.enabling.resultset;

import eu.dnetlib.miscutils.observer.Observer;

/**
 * Instances of ResultSetRegistry manage a set of resultset objects and manage their garbage collection.
 *
 * @author marko
 *
 */
public interface ResultSetRegistry extends Observer<ResultSet> {
	/**
	 * add a resultset object to the registry.
	 *
	 * The given resultset object from now on is managed by the resultset registry.
	 *
	 * @param resultSet
	 *            a resultset object
	 */
	void addResultSet(ResultSet resultSet);

	/**
	 * add a resultset object to the registry.
	 *
	 * The given resultset object from now on is managed by the resultset registry.
	 *
	 * @param resultSet
	 *            a resultset object
	 * @param maxIdleTime
	 *            max idle time
	 */
	void addResultSet(ResultSet resultSet, int maxIdleTime);

	/**
	 * obtain the resultset with the given id.
	 *
	 * @param rsId
	 *            resultset id
	 * @return the resultset object matching the rsId or null
	 */
	ResultSet getResultSetById(String rsId);

}
