This happens when constructing the
SPVBlockStore. For some reason
RandomAccessFile.getChannel().tryLock() is raising
java.nio.channels.OverlappingFileLockException indicating an overlapping lock is already held by the invoking JVM, or another thread is already blocked in
tryLock() and is attempting to lock the block chain file. My only interaction with the SPV block chain file is through the
WalletAppKit, so I don't think I'm doing anything that would be locking the file.
Unfortunately I don't know much about how files are locked, whether it's in the kernel or some bit is set on the disk somewhere. Maybe it's system-dependent. I'm using FreeBSD. Is it possible that shutting down the application improperly leaves the block chain file locked until it runs again? I'm stopping my application by interrupting it with control-C.
In constructing my WalletAppKit I also override onSetupCompleted() like this
WalletAppKit kit = new WalletAppKit(networkParams, new File("."), "myApp") {
@override void onSetupCompleted() {
if (wallet.getKeychainSize() < 1) wallet.addKeys(allKeys);
wallet.addEventListener(onCoinsReceived);
Could this be causing the OverlappingFileLockException on the SPV block chain file? I don't think this should be happening. I'm probably doing something wrong. I'm going to keep thinking about it, but if posting any diagnostics would make it possible for anyone to give me a clue, I'll be glad to do so.
Thanks,
--
Adam Mackler