Class TimeOutUtils


  • public class TimeOutUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeOutUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createAndLogTimeOutMessage​(org.slf4j.Logger logger, java.lang.String operationName, long length, java.util.concurrent.TimeUnit unit)
      Creates a time-out message and logs the same to the logger
      static java.lang.String createTimeOutMessage​(java.lang.String operationName, long length, java.util.concurrent.TimeUnit unit)
      Generate a time-out message string.
      static java.lang.RuntimeException logAndGenerateExceptionOnTimeOut​(org.slf4j.Logger logger, java.lang.String operationName, long length, java.util.concurrent.TimeUnit unit)
      Generate a RuntimeException representing the time-out and log the message containerd in the exception
      • Methods inherited from class java.lang.Object

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

      • TIMEOUT_TIME_LENGTH_3

        public static long TIMEOUT_TIME_LENGTH_3
    • Constructor Detail

      • TimeOutUtils

        public TimeOutUtils()
    • Method Detail

      • createTimeOutMessage

        public static java.lang.String createTimeOutMessage​(java.lang.String operationName,
                                                            long length,
                                                            java.util.concurrent.TimeUnit unit)
        Generate a time-out message string.
        Parameters:
        operationName - the name of the operation that timed out
        length - the length of time
        unit - the unit of time
        Returns:
        the message
      • createAndLogTimeOutMessage

        public static java.lang.String createAndLogTimeOutMessage​(org.slf4j.Logger logger,
                                                                  java.lang.String operationName,
                                                                  long length,
                                                                  java.util.concurrent.TimeUnit unit)
        Creates a time-out message and logs the same to the logger
        Parameters:
        logger - to which the message is logged
        operationName - the name of the operation that timed out
        length - the length of time
        unit - the unit of time
        Returns:
        the message logged
      • logAndGenerateExceptionOnTimeOut

        public static java.lang.RuntimeException logAndGenerateExceptionOnTimeOut​(org.slf4j.Logger logger,
                                                                                  java.lang.String operationName,
                                                                                  long length,
                                                                                  java.util.concurrent.TimeUnit unit)
        Generate a RuntimeException representing the time-out and log the message containerd in the exception
        Parameters:
        logger - to which the message is logged
        operationName - the name of the operation that timed out
        length - the length of time
        unit - the unit of time
        Returns:
        the exception generated, ready to throw.