mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-03 05:57:21 +00:00
Tighten the exception SPVBlockStore throws when the chain file is locked.
This commit is contained in:
committed by
Andreas Schildbach
parent
78e724be3d
commit
32978aa06f
@@ -0,0 +1,14 @@
|
|||||||
|
package org.bitcoinj.store;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown by {@link SPVBlockStore} when the process cannot gain exclusive access to the chain file.
|
||||||
|
*/
|
||||||
|
public class ChainFileLockedException extends BlockStoreException {
|
||||||
|
public ChainFileLockedException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChainFileLockedException(Throwable t) {
|
||||||
|
super(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -103,7 +103,7 @@ public class SPVBlockStore implements BlockStore {
|
|||||||
FileChannel channel = randomAccessFile.getChannel();
|
FileChannel channel = randomAccessFile.getChannel();
|
||||||
fileLock = channel.tryLock();
|
fileLock = channel.tryLock();
|
||||||
if (fileLock == null)
|
if (fileLock == null)
|
||||||
throw new BlockStoreException("Store file is already locked by another process");
|
throw new ChainFileLockedException("Store file is already locked by another process");
|
||||||
|
|
||||||
// Map it into memory read/write. The kernel will take care of flushing writes to disk at the most
|
// Map it into memory read/write. The kernel will take care of flushing writes to disk at the most
|
||||||
// efficient times, which may mean that until the map is deallocated the data on disk is randomly
|
// efficient times, which may mean that until the map is deallocated the data on disk is randomly
|
||||||
|
|||||||
Reference in New Issue
Block a user