Package org.apache.hadoop.util.functional


@Public @Unstable package org.apache.hadoop.util.functional
Support for functional programming within the Hadoop APIs. Much of this is needed simply to cope with Java's checked exceptions and the fact that the java.util.function can only throw runtime exceptions.

Pretty much all the Hadoop FS APIs raise IOExceptions, hence the need for these classes. If Java had made a different decision about the nature of exceptions, life would be better.

Do note that the RemoteIterators iterators go beyond that of the java ones, in terms of declaring themselves Closeable and implementors of IOStatisticsSource; a chain of wrapped iterators can supply statistics of the inner iterators, and encourage close() to be called after use.
  • Class
    Description
    org.apache.hadoop.util.functional.BiFunctionRaisingIOE<T,U,R>
    Function of arity 2 which may raise an IOException.
    org.apache.hadoop.util.functional.CallableRaisingIOE<R>
    This is a callable which only raises an IOException.
    A task submitter which is closeable, and whose close() call shuts down the pool.
    org.apache.hadoop.util.functional.CommonCallableSupplier<T>
    A bridge from Callable to Supplier; catching exceptions raised by the callable and wrapping them as appropriate.
    org.apache.hadoop.util.functional.ConsumerRaisingIOE<T>
    Version of java.util.function.Consumer which raises exceptions.
    org.apache.hadoop.util.functional.Function4RaisingIOE<I1,I2,I3,I4,R>
    Function of arity 4 which may raise an IOException.
    org.apache.hadoop.util.functional.FunctionalIO
    Functional utilities for IO operations.
    org.apache.hadoop.util.functional.FunctionRaisingIOE<T,R>
    Function of arity 1 which may raise an IOException.
    Future IO Helper methods.
    org.apache.hadoop.util.functional.InvocationRaisingIOE
    This is a lambda-expression which may raises an IOException.
    org.apache.hadoop.util.functional.LazyAtomicReference<T>
    A lazily constructed reference, whose reference constructor is a CallableRaisingIOE so may raise IOExceptions.
    org.apache.hadoop.util.functional.LazyAutoCloseableReference<T extends AutoCloseable>
    A subclass of LazyAtomicReference which holds an AutoCloseable reference and calls close() when it itself is closed.
    A set of remote iterators supporting transformation and filtering, with IOStatisticsSource passthrough, and of conversions of the iterators to lists/arrays and of performing actions on the values.
    org.apache.hadoop.util.functional.RemoteIterators.WrappingRemoteIterator<S,T>
    Wrapper of another remote iterator; IOStatistics and Closeable methods are passed down if implemented.
    org.apache.hadoop.util.functional.RunnableRaisingIOE
    Runnable interface whose RunnableRaisingIOE.apply() method may raise an IOE.
    org.apache.hadoop.util.functional.TaskPool
    Utility class for parallel execution, takes closures for the various actions.
    org.apache.hadoop.util.functional.TaskPool.Builder<I>
    Builder for task execution.
    org.apache.hadoop.util.functional.TaskPool.FailureTask<I,E extends Exception>
    Callback invoked on a failure.
    org.apache.hadoop.util.functional.TaskPool.Submitter
    Interface to whatever lets us submit tasks.
    org.apache.hadoop.util.functional.TaskPool.Task<I,E extends Exception>
    Callback invoked to process an item.
    org.apache.hadoop.util.functional.Tuples
    Tuple support.