Class Timeout


  • public class Timeout
    extends Object
    Represents one timeout.
    Author:
    Alexandre Iline (alexandre.iline@sun.com)
    • Constructor Detail

      • Timeout

        public Timeout​(String name,
                       long value)
        Constructor.
        Parameters:
        name - Timeout name.
        value - Timeout value in milliseconds.
    • Method Detail

      • getName

        public String getName()
        Returns timeout name.
        Returns:
        timeout name.
      • getValue

        public long getValue()
        Returns timeout value.
        Returns:
        timeout value.
      • sleep

        public void sleep()
        Sleeps for timeout value.
      • start

        public void start()
        Starts timeout measuring.
      • expired

        public boolean expired()
        Checks if timeout has been expired after start() invocation.
        Returns:
        true if timeout has been expired.
      • check

        public void check()
        Throws a TimeoutExpiredException exception if timeout has been expired.
        Throws:
        TimeoutExpiredException - if timeout has been expired after start() invocation.