@ Override @ FFDCIgnore ( Exception . class ) //manually logged protected int overQualLastAccessTimeUpdate ( BackedSession sess , long nowTime ) { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; String id = sess . getId ( ) ; int updateCount ; try { if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionMetaCache , "get" , id ) ; synchronized ( sess ) { ArrayList < ? > oldValue = sessionMetaCache . get ( id ) ; if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionMetaCache , "get" , oldValue ) ; SessionInfo sessionInfo = oldValue == null ? null : new SessionInfo ( oldValue ) . clone ( ) ; long curAccessTime = sess . getCurrentAccessTime ( ) ; if ( sessionInfo == null || sessionInfo . getLastAccess ( ) != curAccessTime ) { if ( trace && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "session current access time: " + curAccessTime ) ; updateCount = 0 ; } else if ( sessionInfo . getLastAccess ( ) >= nowTime ) { // avoid setting last access when the cache already has a later time updateCount = 1 ; // be consistent with Statement.executeUpdate which returns 1 when the row matches but no changes are made } else { sessionInfo . setLastAccess ( nowTime ) ; ArrayList < ? > newValue = sessionInfo . getArrayList ( ) ; if ( trace && tc . isDebugEnabled ( ) ) tcInvoke ( tcSessionMetaCache , "replace" , id , oldValue , newValue ) ; boolean replaced = sessionMetaCache . replace ( id , oldValue , newValue ) ; if ( trace && tc . isDebugEnabled ( ) ) tcReturn ( tcSessionMetaCache , "replace" , replaced ) ; if ( replaced ) { sess . updateLastAccessTime ( nowTime ) ; updateCount = 1 ; } else { updateCount = 0 ; } } } } catch ( Exception ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.session.store.cache.CacheHashMap.overQualLastAccessTimeUpdate" , "859" , this , new Object [ ] { sess } ) ; Tr . error ( tc , "ERROR_CACHE_ACCESS" , ex ) ; throw new RuntimeException ( Tr . formatMessage ( tc , "INTERNAL_SERVER_ERROR" ) ) ; } return updateCount ; }
Attempts to update the last access time ensuring the old value matches . This verifies that the copy we have in cache is still valid .