public void clearUnused ( ConfigImpl config ) { SystemOut . printDate ( config . getOutWriter ( ) , "PagePool: " + size ( ) + ">(" + maxSize + ")" ) ; if ( size ( ) > maxSize ) { String [ ] keys = keys ( ) ; LongKeyList list = new LongKeyList ( ) ; for ( int i = 0 ; i < keys . length ; i ++ ) { PageSource ps = getPageSource ( keys [ i ] , false ) ; long updateTime = ps . getLastAccessTime ( ) ; if ( updateTime + timeout < System . currentTimeMillis ( ) ) { long add = ( ( ps . getAccessCount ( ) - 1 ) * 10000 ) ; if ( add > timeout ) add = timeout ; list . add ( updateTime + add , keys [ i ] ) ; } } while ( size ( ) > maxSize ) { Object key = list . shift ( ) ; if ( key == null ) break ; remove ( key . toString ( ) ) ; } } }
clear unused pages from page pool