Class Timed<X,​Y>

  • Type Parameters:
    X - Type of input
    Y - Type of output
    All Implemented Interfaces:
    Func<X,​Y>

    public final class Timed<X,​Y>
    extends Object
    implements Func<X,​Y>
    Function that gets interrupted after a certain time has passed.
    Since:
    0.29.3
    • Constructor Detail

      • Timed

        public Timed​(Func<X,​Y> function,
                     long milliseconds)
        Ctor.
        Parameters:
        function - Origin function
        milliseconds - Milliseconds
      • Timed

        public Timed​(long milliseconds,
                     Func<X,​Future<Y>> async)
        Ctor.
        Parameters:
        milliseconds - Milliseconds
        async - Async function
    • Method Detail

      • apply

        public Y apply​(X input)
                throws Exception
        Description copied from interface: Func
        Apply it.
        Specified by:
        apply in interface Func<X,​Y>
        Parameters:
        input - The argument
        Returns:
        The result
        Throws:
        Exception - If fails