org.gcube.data.streams.handlers
Class CountingHandler

java.lang.Object
  extended by 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

Field Summary
 
Fields inherited from interface org.gcube.data.streams.handlers.FaultHandler
iteration
 
Constructor Summary
CountingHandler()
           
 
Method Summary
protected abstract  void handle(Exception failure, Exception lastFailure, int failureCount)
          Indicates whether iteration should continue or stop the iteration on the occurrence of an iteration failure.
 void handle(RuntimeException failure)
          Indicates whether iteration should continue or stop the iteration on the occurrence of an iteration failure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountingHandler

public CountingHandler()
Method Detail

handle

public final void 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

handle

protected abstract void handle(Exception failure,
                               Exception lastFailure,
                               int failureCount)
Indicates whether iteration should continue or stop the iteration on the occurrence of an iteration failure.

Parameters:
failure - the failure
lastFailure - the failure observed previously, or null if this is the first observed failure
failureCount - the number of failures counted so far, 0 if this is the first observed failure
Throws:
RuntimeException - if no element can be yielded from the input element


Copyright © 2012. All Rights Reserved.