From 08dbb21a39b251dc793d6c039f10c6001f33d37c Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Fri, 29 Mar 2013 18:00:46 +0000 Subject: [PATCH] H2 store: Set a 60 second locking timeout to avoid failures when processing large/complex operations. Resolves issue 348. --- .../java/com/google/bitcoin/store/H2FullPrunedBlockStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/google/bitcoin/store/H2FullPrunedBlockStore.java b/core/src/main/java/com/google/bitcoin/store/H2FullPrunedBlockStore.java index cc83437f..7befa826 100644 --- a/core/src/main/java/com/google/bitcoin/store/H2FullPrunedBlockStore.java +++ b/core/src/main/java/com/google/bitcoin/store/H2FullPrunedBlockStore.java @@ -99,7 +99,9 @@ public class H2FullPrunedBlockStore implements FullPrunedBlockStore { public H2FullPrunedBlockStore(NetworkParameters params, String dbName, int fullStoreDepth) throws BlockStoreException { this.params = params; this.fullStoreDepth = fullStoreDepth; - connectionURL = "jdbc:h2:" + dbName + ";create=true"; + // We choose a very lax timeout to avoid the database throwing exceptions on complex operations, as time is not + // a particularly precious resource when just keeping up with the chain. + connectionURL = "jdbc:h2:" + dbName + ";create=true;LOCK_TIMEOUT=60000"; conn = new ThreadLocal(); allConnections = new LinkedList();