private void cleanPool(){
  lock.lock();
  try {
    Reference<? extends Transaction> ref;
    while ((ref=referenceQueue.poll()) != null) {
      WeakTransactionReference txRef=(WeakTransactionReference)ref;
      memoryPool.remove(txRef.hash);
    }
  }
  finally {
    lock.unlock();
  }
}

private void cleanPool ( ) { lock . lock ( ) ; try { Reference < ? extends Transaction > ref ; while ( ( ref = referenceQueue . poll ( ) ) != null ) { WeakTransactionReference txRef = ( WeakTransactionReference ) ref ; memoryPool . remove ( txRef . hash ) ; } } finally { lock . unlock ( ) ; } }
if any transactions have expired due to being only weakly reachable through us , go ahead and delete their memorypool 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 .
