/** * Returns the {@link TransactionConfidence} for the given hash if we have downloaded it, or null if that tx hash * is unknown to the system at this time. */ public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = new TransactionConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }
/** * Returns the {@link TransactionConfidence} for the given hash if we have downloaded it, or null if that tx hash * is unknown to the system at this time. */ public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = new TransactionConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }
/** * Returns the {@link TransactionConfidence} for the given hash if we have downloaded it, or null if that tx hash * is unknown to the system at this time. */ public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = new TransactionConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }
/** * Returns the {@link TransactionConfidence} for the given hash if we have downloaded it, or null if that tx hash * is unknown to the system at this time. */ public TransactionConfidence getOrCreate(Sha256Hash hash) { checkNotNull(hash); lock.lock(); try { WeakConfidenceReference reference = table.get(hash); if (reference != null) { TransactionConfidence confidence = reference.get(); if (confidence != null) return confidence; } TransactionConfidence newConfidence = new TransactionConfidence(hash); table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); return newConfidence; } finally { lock.unlock(); } }