Log whenever the synchronizer can't obtain a blockchain lock, so that blockchain lock issues are more easily noticed.

This commit is contained in:
CalDescent 2022-01-30 19:00:28 +00:00
parent c73cdefe6f
commit 90f3d2568a

View File

@ -571,9 +571,11 @@ public class Synchronizer {
// Make sure we're the only thread modifying the blockchain // Make sure we're the only thread modifying the blockchain
// If we're already synchronizing with another peer then this will also return fast // If we're already synchronizing with another peer then this will also return fast
ReentrantLock blockchainLock = Controller.getInstance().getBlockchainLock(); ReentrantLock blockchainLock = Controller.getInstance().getBlockchainLock();
if (!blockchainLock.tryLock()) if (!blockchainLock.tryLock()) {
// Wasn't peer's fault we couldn't sync // Wasn't peer's fault we couldn't sync
LOGGER.info("Synchronizer couldn't acquire blockchain lock");
return SynchronizationResult.NO_BLOCKCHAIN_LOCK; return SynchronizationResult.NO_BLOCKCHAIN_LOCK;
}
try { try {
try (final Repository repository = RepositoryManager.getRepository()) { try (final Repository repository = RepositoryManager.getRepository()) {