Class QueryTimeManager
- java.lang.Object
-
- org.apache.iotdb.db.query.control.QueryTimeManager
-
- All Implemented Interfaces:
org.apache.iotdb.commons.service.IService
public class QueryTimeManager extends java.lang.Object implements org.apache.iotdb.commons.service.IServiceThis class is used to monitor the executing time of each query. Once one is over the threshold, it will be killed and return the time out exception.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancheckQueryAlive(long queryId)Check given query is alive or not.voidclear()org.apache.iotdb.commons.service.ServiceTypegetID()static QueryTimeManagergetInstance()QueryContextgetQueryContext(long queryId)java.util.Map<java.lang.Long,QueryContext>getQueryContextMap()voidkillQuery(long queryId)voidregisterQuery(QueryContext context)voidstart()voidstop()java.util.concurrent.atomic.AtomicBooleanunRegisterQuery(long queryId, boolean fullQuit)UnRegister query when query quits because of getting enough data or timeout.
-
-
-
Method Detail
-
registerQuery
public void registerQuery(QueryContext context)
-
killQuery
public void killQuery(long queryId)
-
unRegisterQuery
public java.util.concurrent.atomic.AtomicBoolean unRegisterQuery(long queryId, boolean fullQuit)UnRegister query when query quits because of getting enough data or timeout. If getting enough data, we only remove the timeout task. If the query is full quit because of timeout or EndQuery(), we remove them all.- Parameters:
fullQuit- True if timeout or endQuery()
-
checkQueryAlive
public static boolean checkQueryAlive(long queryId)
Check given query is alive or not. We only throw the queryTimeoutRunTimeException once. If the runTimeException is thrown in main thread, it will quit directly while the return value will be used to ask sub query threads to quit. Else if it's thrown in one sub thread, other sub threads will quit by reading the return value, and main thread will catch and throw the same exception by reading the ExceptionBatchData.- Returns:
- True if alive.
-
getQueryContextMap
public java.util.Map<java.lang.Long,QueryContext> getQueryContextMap()
-
clear
public void clear()
-
getQueryContext
public QueryContext getQueryContext(long queryId)
-
getInstance
public static QueryTimeManager getInstance()
-
start
public void start()
- Specified by:
startin interfaceorg.apache.iotdb.commons.service.IService
-
stop
public void stop()
- Specified by:
stopin interfaceorg.apache.iotdb.commons.service.IService
-
getID
public org.apache.iotdb.commons.service.ServiceType getID()
- Specified by:
getIDin interfaceorg.apache.iotdb.commons.service.IService
-
-