java.lang.Object
org.autogui.base.mapping.ScheduledTaskRunner.DepthStack
- Enclosing class:
ScheduledTaskRunner<EventType>
debug features for task-running:
the system-property
org.autogui.base.mapping.debugDepth
can be
err
: specifies the output toSystem.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 Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicInteger
protected PrintStream
protected AtomicInteger
protected ThreadLocal
<List<String>> protected AtomicInteger
protected AtomicInteger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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<T> Callable
<T> depthRunner
(Callable<T> r) <T> Supplier
<T> depthRunner
(Supplier<T> r) void
withDepthInfo
(String info, Runnable body) run the body with a new context with the info<T> T
withDepthInfo
(String info, Callable<T> body) run the body with a new text with the info
-
Field Details
-
depthStack
-
depthDebug
-
depthDebugMax
-
pendingTasks
-
startedTasks
-
debugLastTasks
-
-
Constructor Details
-
DepthStack
public DepthStack()
-
-
Method Details
-
getDepthStack
- Returns:
- the current stack info
-
withDepthInfo
run the body with a new context with the info- Parameters:
info
- the context info, pushed to the stackbody
- the task body
-
withDepthInfo
run the body with a new text with the info- Type Parameters:
T
- the retuned type- Parameters:
info
- the context info, pushed to the stackbody
- 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
- Parameters:
r
- the task body- Returns:
- wrappend body by
ScheduledTaskRunner.TaskWithContext
-
depthRunner
- Type Parameters:
T
- the task returned type- Parameters:
r
- the task body- Returns:
- wrapped body by
ScheduledTaskRunner.TaskWithContext
-
depthRunner
- Type Parameters:
T
- the task returned type- Parameters:
r
- the task body- Returns:
- wrapped body by
ScheduledTaskRunner.TaskWithContext
-