Module org.autogui

Class ScheduledTaskRunner.DepthStack

java.lang.Object
org.autogui.base.mapping.ScheduledTaskRunner.DepthStack
Enclosing class:
ScheduledTaskRunner<EventType>

public static class ScheduledTaskRunner.DepthStack extends Object
debug features for task-running: the system-property org.autogui.base.mapping.debugDepth can be
  • err : specifies the output to System.err, or
  • a file-path : specifies the output to the file.

  withDepthInfo("contextInfo", //push the string to the thread-local stack
    () -> executor.execute(depthRunner(task))) // copy the thread-local stack and the wrapper of task hold it.
     //when the task is run by the executor-thread, the stack-info will be set the the thread-local stack

  • Field Details

  • Constructor Details

    • DepthStack

      public DepthStack()
  • Method Details

    • getDepthStack

      public List<String> getDepthStack()
      Returns:
      the current stack info
    • withDepthInfo

      public void withDepthInfo(String info, Runnable body)
      run the body with a new context with the info
      Parameters:
      info - the context info, pushed to the stack
      body - the task body
    • withDepthInfo

      public <T> T withDepthInfo(String info, Callable<T> body) throws Exception
      run the body with a new text with the info
      Type Parameters:
      T - the retuned type
      Parameters:
      info - the context info, pushed to the stack
      body - the task body
      Returns:
      the returned value of the body
      Throws:
      Exception - thrown by the body
    • checkQueue

      public void checkQueue()
      if enabled the debugging output, it checks pending-tasks and writes a log-message if some condition satifeed; abs(pendingTasks-(previous pendingTasks)) > 100 or pendingTasks=0
    • depthRunner

      public Runnable depthRunner(Runnable r)
      Parameters:
      r - the task body
      Returns:
      wrappend body by ScheduledTaskRunner.TaskWithContext
    • depthRunner

      public <T> Callable<T> depthRunner(Callable<T> r)
      Type Parameters:
      T - the task returned type
      Parameters:
      r - the task body
      Returns:
      wrapped body by ScheduledTaskRunner.TaskWithContext
    • depthRunner

      public <T> Supplier<T> depthRunner(Supplier<T> r)
      Type Parameters:
      T - the task returned type
      Parameters:
      r - the task body
      Returns:
      wrapped body by ScheduledTaskRunner.TaskWithContext