/**
* The {@link GlobalCommitter} is responsible for committing an aggregated committable, which we called global committables.
*
* @param <CommT> The type of the committable data
* @param <GCommT> The type of the aggregated committable
*/
interface GlobalCommitter<CommT, GCommT> {
/**
* This method is called when restoring from a failover.
* @param globalCommittables the global committable that are not committed in the previous session.
* @return the global committables that should be committed again in the current session.
*/
List<GCommT> filterRecoveredCommittables(List<GCommT> globalCommittables);
/**
* Compute an aggregated committable from a collection of committables.
* @param committables a collection of committables that are needed to combine
* @return an aggregated committable
*/
GCommT combine(List<CommT> committables);
CommitResult commit(GCommT globalCommittable);
/**
* There is no committable any more.
*/
void endOfInput();
enum CommitResult {
SUCCESS, FAILURE, RETRY
}
}
|