private void enforceCpuLimits ( ) { for ( QueryExecution query : queryTracker . getAllQueries ( ) ) { Duration cpuTime = query . getTotalCpuTime ( ) ; Duration sessionLimit = getQueryMaxCpuTime ( query . getSession ( ) ) ; Duration limit = Ordering . natural ( ) . min ( maxQueryCpuTime , sessionLimit ) ; if ( cpuTime . compareTo ( limit ) > 0 ) { query . fail ( new ExceededCpuLimitException ( limit ) ) ; } } }
Enforce query CPU time limits