Class DumpStackTracesTimer

  • All Implemented Interfaces:
    java.lang.Runnable

    public class DumpStackTracesTimer
    extends java.util.TimerTask
    Starts a task which will dump stack trace information after some time. Mostly a copy of org.eclipse.test.EclipseTestRunner.startStackDumpTimeoutTimer(). Necessary to know whether and where tests are hanging if a timeout occurred during tests.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int SECONDS_BEFORE_TIMEOUT_BUFFER
      SECONDS_BEFORE_TIMEOUT_BUFFER is the time we allow ourselves to take stack traces delay "SECONDS_BETWEEN_DUMPS", then do it again.
      private static int SECONDS_BETWEEN_DUMPS
      SECONDS_BETWEEN_DUMPS is the time we wait from first to second dump of stack trace.
      private java.lang.String timeoutArg  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DumpStackTracesTimer​(java.lang.String timeoutArg)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void dump​(int num)  
      private void dumpStackTraces​(int num, java.io.PrintStream out)  
      private static void log​(org.eclipse.core.runtime.IStatus warningStatus)  
      private static void logError​(java.lang.String message, java.lang.Exception exception)  
      private static void logInfo​(java.lang.String message)  
      private void logStackTraces​(int num)  
      private static void logWarning​(java.lang.String message)  
      void run()  
      (package private) static void startStackDumpTimeoutTimer​(java.lang.String timeoutArg)
      Starts a timer that dumps interesting debugging information shortly before the given timeout expires.
      • Methods inherited from class java.util.TimerTask

        cancel, scheduledExecutionTime
      • Methods inherited from class java.lang.Object

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

      • SECONDS_BEFORE_TIMEOUT_BUFFER

        private static final int SECONDS_BEFORE_TIMEOUT_BUFFER
        SECONDS_BEFORE_TIMEOUT_BUFFER is the time we allow ourselves to take stack traces delay "SECONDS_BETWEEN_DUMPS", then do it again. On current build machine, it takes about 30 seconds to do all that, so 2 minutes should be sufficient time allowed for most machines. Though, should increase, say, if we increase the "time between dumps" to a minute or more.
        See Also:
        Constant Field Values
      • SECONDS_BETWEEN_DUMPS

        private static final int SECONDS_BETWEEN_DUMPS
        SECONDS_BETWEEN_DUMPS is the time we wait from first to second dump of stack trace. In most cases, this should suffice to determine if still busy doing something, or, hung, or waiting for user input.
        See Also:
        Constant Field Values
      • timeoutArg

        private final java.lang.String timeoutArg
    • Constructor Detail

      • DumpStackTracesTimer

        private DumpStackTracesTimer​(java.lang.String timeoutArg)
    • Method Detail

      • startStackDumpTimeoutTimer

        static void startStackDumpTimeoutTimer​(java.lang.String timeoutArg)
        Starts a timer that dumps interesting debugging information shortly before the given timeout expires.
        Parameters:
        timeoutArg - the -timeout argument from the command line
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in class java.util.TimerTask
      • dump

        private void dump​(int num)
      • logStackTraces

        private void logStackTraces​(int num)
      • dumpStackTraces

        private void dumpStackTraces​(int num,
                                     java.io.PrintStream out)
      • logInfo

        private static void logInfo​(java.lang.String message)
      • logWarning

        private static void logWarning​(java.lang.String message)
      • logError

        private static void logError​(java.lang.String message,
                                     java.lang.Exception exception)
      • log

        private static void log​(org.eclipse.core.runtime.IStatus warningStatus)