private void cleanTable ( ) { lock . lock ( ) ; try { Reference < ? extends TransactionConfidence > ref ; while ( ( ref = referenceQueue . poll ( ) ) != null ) { // Find which transaction got deleted by the GC. WeakConfidenceReference txRef = ( WeakConfidenceReference ) ref ; // And remove the associated map entry so the other bits of memory can also be reclaimed. table . remove ( txRef . hash ) ; } } finally { lock . unlock ( ) ; } }
If any transactions have expired due to being only weakly reachable through us go ahead and delete their table entries - it means we downloaded the transaction and sent it to various event listeners none of which bothered to keep a reference . Typically this is because the transaction does not involve any keys that are relevant to any of our wallets .