Package org.apache.pinot.spi.accounting
Interface ThreadResourceUsageAccountant
-
- All Known Implementing Classes:
Tracing.DefaultThreadResourceUsageAccountant
public interface ThreadResourceUsageAccountant
-
-
Method Summary
Modifier and Type Method Description voidclear()clear thread accounting info when a task finishes execution on a threadvoidcreateExecutionContext(String queryId, int taskId, ThreadExecutionContext parentContext)Task tracking infoExceptiongetErrorStatus()get error status if the query is preemptedThreadExecutionContextgetThreadExecutionContext()get the executon context of current threadbooleanisAnchorThreadInterrupted()check if the corresponding anchor thread of current thread is interrupted so that when we preempt a task we only call interrupt on the anchor threadvoidsampleUsage()call to sample usagevoidsetThreadResourceUsageProvider(ThreadResourceUsageProvider threadResourceUsageProvider)set resource usage providervoidstartWatcherTask()start the periodical task
-
-
-
Method Detail
-
clear
void clear()
clear thread accounting info when a task finishes execution on a thread
-
isAnchorThreadInterrupted
boolean isAnchorThreadInterrupted()
check if the corresponding anchor thread of current thread is interrupted so that when we preempt a task we only call interrupt on the anchor thread
-
createExecutionContext
void createExecutionContext(String queryId, int taskId, @Nullable ThreadExecutionContext parentContext)
Task tracking info- Parameters:
queryId- query id stringtaskId- a unique task idparentContext- the parent execution context, null for root(runner) thread
-
getThreadExecutionContext
ThreadExecutionContext getThreadExecutionContext()
get the executon context of current thread
-
setThreadResourceUsageProvider
void setThreadResourceUsageProvider(ThreadResourceUsageProvider threadResourceUsageProvider)
set resource usage provider
-
sampleUsage
void sampleUsage()
call to sample usage
-
startWatcherTask
void startWatcherTask()
start the periodical task
-
getErrorStatus
Exception getErrorStatus()
get error status if the query is preempted- Returns:
- empty string if N/A
-
-