Class QueryTimeManager

  • All Implemented Interfaces:
    org.apache.iotdb.commons.service.IService

    public class QueryTimeManager
    extends java.lang.Object
    implements org.apache.iotdb.commons.service.IService
    This 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 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)
      • start

        public void start()
        Specified by:
        start in interface org.apache.iotdb.commons.service.IService
      • stop

        public void stop()
        Specified by:
        stop in interface org.apache.iotdb.commons.service.IService
      • getID

        public org.apache.iotdb.commons.service.ServiceType getID()
        Specified by:
        getID in interface org.apache.iotdb.commons.service.IService