@Override
    public void checkTimeout() {
	if (!engine.allowRequestTimeout()) return;

	// print.e(MonitorState.checkForBlockedThreads(runningPcs.values()));
	// print.e(MonitorState.checkForBlockedThreads(runningChildPcs.values()));

	// synchronized (runningPcs) {
	// int len=runningPcs.size();
	// we only terminate child threads

	Map<Integer, PageContextImpl> map = engine.exeRequestAsync() ? runningChildPcs : runningPcs;

	{
	    Iterator<Entry<Integer, PageContextImpl>> it = map.entrySet().iterator();
	    PageContextImpl pc;
	    Entry<Integer, PageContextImpl> e;
	    while (it.hasNext()) {
		e = it.next();
		pc = e.getValue();

		long timeout = pc.getRequestTimeout();
		if (pc.getStartTime() + timeout < System.currentTimeMillis() && Long.MAX_VALUE != timeout) {
		    Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
		    if (log != null) {
			log.log(Log.LEVEL_ERROR, "controller",
				"stop " + (pc.getParentPageContext() == null ? "request" : "thread") + " (" + pc.getId() + ") because run into a timeout " + getPath(pc) + "."
					+ MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
		    }
		    terminate(pc, true);
		    runningPcs.remove(Integer.valueOf(pc.getId()));
		    it.remove();
		}
		// after 10 seconds downgrade priority of the thread
		else if (pc.getStartTime() + 10000 < System.currentTimeMillis() && pc.getThread().getPriority() != Thread.MIN_PRIORITY) {
		    Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
		    if (log != null) {
			log.log(Log.LEVEL_WARN, "controller", "downgrade priority of the a " + (pc.getParentPageContext() == null ? "request" : "thread") + " at " + getPath(pc)
				+ ". " + MonitorState.getBlockedThreads(pc) + RequestTimeoutException.locks(pc) + "\n" + MonitorState.toString(pc.getThread().getStackTrace()));
		    }
		    try {
			pc.getThread().setPriority(Thread.MIN_PRIORITY);
		    }
		    catch (Throwable t) {
			ExceptionUtil.rethrowIfNecessary(t);
		    }
		}
	    }
	}
    }
@ Override public void checkTimeout ( ) { if ( ! engine . allowRequestTimeout ( ) ) return ; Map < Integer , PageContextImpl > map = engine . exeRequestAsync ( ) ? runningChildPcs : runningPcs ; { Iterator < Entry < Integer , PageContextImpl > > it = map . entrySet ( ) . iterator ( ) ; PageContextImpl pc ; Entry < Integer , PageContextImpl > e ; while ( it . hasNext ( ) ) { e = it . next ( ) ; pc = e . getValue ( ) ; long timeout = pc . getRequestTimeout ( ) ; if ( pc . getStartTime ( ) + timeout < System . currentTimeMillis ( ) && Long . MAX_VALUE != timeout ) { Log log = ( ( ConfigImpl ) pc . getConfig ( ) ) . getLog ( "requesttimeout" ) ; if ( log != null ) { log . log ( Log . LEVEL_ERROR , "controller" , "stop " + ( pc . getParentPageContext ( ) == null ? "request" : "thread" ) + " (" + pc . getId ( ) + ") because run into a timeout " + getPath ( pc ) + "." + MonitorState . getBlockedThreads ( pc ) + RequestTimeoutException . locks ( pc ) + "\n" + MonitorState . toString ( pc . getThread ( ) . getStackTrace ( ) ) ) ; } terminate ( pc , true ) ; runningPcs . remove ( Integer . valueOf ( pc . getId ( ) ) ) ; it . remove ( ) ; } else if ( pc . getStartTime ( ) + 10000 < System . currentTimeMillis ( ) && pc . getThread ( ) . getPriority ( ) != Thread . MIN_PRIORITY ) { Log log = ( ( ConfigImpl ) pc . getConfig ( ) ) . getLog ( "requesttimeout" ) ; if ( log != null ) { log . log ( Log . LEVEL_WARN , "controller" , "downgrade priority of the a " + ( pc . getParentPageContext ( ) == null ? "request" : "thread" ) + " at " + getPath ( pc ) + ". " + MonitorState . getBlockedThreads ( pc ) + RequestTimeoutException . locks ( pc ) + "\n" + MonitorState . toString ( pc . getThread ( ) . getStackTrace ( ) ) ) ; } try { pc . getThread ( ) . setPriority ( Thread . MIN_PRIORITY ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } } } } }
check timeout of all running threads, downgrade also priority from all thread run longer than 10
seconds