protected synchronized void release ( boolean userAccess ) { SessionState . detachSession ( ) ; if ( ThreadWithGarbageCleanup . currentThread ( ) instanceof ThreadWithGarbageCleanup ) { ThreadWithGarbageCleanup currentThread = ( ThreadWithGarbageCleanup ) ThreadWithGarbageCleanup . currentThread ( ) ; currentThread . cacheThreadLocalRawStore ( ) ; } if ( userAccess ) { lastAccessTime = System . currentTimeMillis ( ) ; } if ( opHandleSet . isEmpty ( ) ) { lastIdleTime = System . currentTimeMillis ( ) ; } else { lastIdleTime = 0 ; } }
1 . We ll remove the ThreadLocal SessionState as this thread might now serve other requests . 2 . We ll cache the ThreadLocal RawStore object for this background thread for an orderly cleanup when this thread is garbage collected later .