org.gcube.data.streams.handlers
Class CountingHandler
java.lang.Object
org.gcube.data.streams.handlers.CountingHandler
- All Implemented Interfaces:
- FaultHandler
public abstract class CountingHandler
- extends Object
- implements FaultHandler
A partial implementation for FaultHandler that count failures and keep track of the last observed failure.
- Author:
- Fabio Simeoni
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CountingHandler
public CountingHandler()
handle
public final FaultResponse handle(RuntimeException failure)
- Description copied from interface:
FaultHandler
- Indicates whether iteration should continue or stop the iteration on the occurrence of an iteration failure.
- Specified by:
handle in interface FaultHandler
- Parameters:
failure - the failure
- Returns:
- the
FaultResponse
handle
protected abstract FaultResponse handle(RuntimeException failure,
Exception lastFailure,
int failureCount)
throws StreamContingencyException,
RuntimeException
- Indicates whether iteration should continue or stop the iteration on the occurrence of an iteration failure.
- Parameters:
failure - the failurelastFailure - the failure observed previously, or null if this is the first observed failurefailureCount - the number of failures counted so far, 0 if this is the first observed failure
- Returns:
true if iteration should continue, false if it should stop
- Throws:
StreamContingencyException - if no element can be yielded, because the input element violates
pre-conditions
RuntimeException - if no element can be yielded from the input element, because of an unrecoverable
condition
Copyright © 2012. All Rights Reserved.