private synchronized final boolean _declareDiscardable ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "_declareDiscardable" ) ; boolean linkHasBecomeReleasable = false ; // Only discardable if storage managed (items and item references only). // Putting this check in here liberates the logic which changes the state of the // items from knowing about storage management if ( _isStorageManaged ) { if ( ! _itemIsDiscardableIfPersistentRepresentationStable ) { // if we have become non-discardable, and we were // releasable (stable) then we must notify the cache linkHasBecomeReleasable = _persistentRepresentationIsStable ; // 274012 if ( linkHasBecomeReleasable ) { // Defect 601995 _strongReferenceToItem = NULL_STRONG_REF ; } // This flag must not be set if the item is not storage managed. // Otherwise, we could inadvertently start discarding and restoring // streams. _itemIsDiscardableIfPersistentRepresentationStable = true ; } } else { // Just to make sure :-) _itemIsDiscardableIfPersistentRepresentationStable = false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "_declareDiscardable" , Boolean . valueOf ( linkHasBecomeReleasable ) ) ; return linkHasBecomeReleasable ; }
The state has changed so that the item could be discarded if it has a stable persistent representation . Change the flags that control the discard and return true if this call has resulted in a change to the releasable state .