org.dspace.checker.BitstreamDispatcher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dspace-api Show documentation
Show all versions of dspace-api Show documentation
DSpace core data model and service APIs.
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.checker;
import java.sql.SQLException;
import org.dspace.content.Bitstream;
/**
*
* BitstreamDispatchers are strategy objects that hand bitstream ids out to
* workers. Implementations must be threadsafe.
*
*
*
* The rationale behind the use of the Sentinel pattern (rather than the more
* traditional iterator pattern or a cursor c.f. java.sql.ResultSet): -
*
*
* - To make it easy to make implementations thread safe - multithreaded
* invocation of the dispatchers is seen as a next step use case. In simple
* terms, this requires that a single method does all the work.
* - Shouldn't an exception as the sentinel, as reaching the end of a loop is
* not an exceptional condition.
*
*
* @author Jim Downing
* @author Grace Carpenter
* @author Nathan Sarr
*/
public interface BitstreamDispatcher {
/**
* This value should be returned by next()
to indicate that
* there are no more values.
*/
public static int SENTINEL = -1;
/**
* Returns the next id for checking, or a sentinel value if there are no
* more to check.
*
* @return the next bitstream id, or BitstreamDispatcher.SENTINEL if there
* isn't another value
* @throws SQLException if database error
*/
public Bitstream next() throws SQLException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy