private synchronized void closeIdleClients ( ) { List < Client > candidates = new LinkedList < Client > ( openClients . values ( ) ) ; logger . debug ( "Scanning for idle clients; " + candidates . size ( ) + " candidates." ) ; for ( Client client : candidates ) { if ( ( useCounts . get ( client ) < 1 ) && ( ( timestamps . get ( client ) + idleLimit . get ( ) * 1000 ) <= System . currentTimeMillis ( ) ) ) { logger . debug ( "Idle time reached for unused client {}" , client ) ; closeClient ( client ) ; } } }
Finds any clients which are not currently in use and which have been idle for longer than the idle timeout and closes them .