Class Timeout


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

      Constructors 
      Constructor Description
      Timeout​(java.lang.String name, long value)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void check()
      Throws a TimeoutExpiredException exception if timeout has been expired.
      boolean expired()
      Checks if timeout has been expired after start() invocation.
      java.lang.String getName()
      Returns timeout name.
      long getValue()
      Returns timeout value.
      void sleep()
      Sleeps for timeout value.
      void start()
      Starts timeout measuring.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Timeout

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

      • getName

        public java.lang.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.