}
private Throwable map( Object input )
{
Throwable localThrowable = null;
TupleEntryIterator iterator = null;
try
{
next.start( this );
// input may be null
iterator = source.openForRead( flowProcess, input );
while( iterator.hasNext() )
{
TupleEntry tupleEntry;
try
{
tupleEntry = iterator.next();
flowProcess.increment( StepCounters.Tuples_Read, 1 );
flowProcess.increment( SliceCounters.Tuples_Read, 1 );
}
catch( OutOfMemoryError error )
{
handleReThrowableException( "out of memory, try increasing task memory allocation", error );
continue;
}
catch( CascadingException exception )
{
handleException( exception, null );
continue;
}
catch( Throwable throwable )
{
handleException( new DuctException( "internal error", throwable ), null );
continue;
}
next.receive( this, tupleEntry );
}
next.complete( this );
}
catch( Throwable throwable )
{
if( !( throwable instanceof OutOfMemoryError ) )
LOG.error( "caught throwable", throwable );
return throwable;
}
finally
{
try
{
if( iterator != null )
iterator.close();
}
catch( Throwable currentThrowable )
{
if( !( currentThrowable instanceof OutOfMemoryError ) )
LOG.warn( "failed closing iterator", currentThrowable );