BDB does *not* support shared access to the same DB. There can be only 1 writer.
Can't use BDB for this scenario
Thank you, for this answer,
though I am confused sleepycat advertices bdbje as
The architecture of Berkeley DB JE supports high
performance and concurrency for both read-intensive
and write-intensive workloads.
Berkeley DB JE is available with the following feature sets to meet
your application's needs.
Berkeley DB JE Concurrent Data Store
Multiple writers and readers.
would just be fantastic if it worked.
go ask them, this is not what they told me. Please post the response here (I'm interested too)
I asked sleepycat about the concurrency issues and
got this reply
Provides bdbje concurrent access? what's the deal?
First let me explain the capabilities of JE itself, independently of
JBossCache. For a given database environment, a single process may open
that environment for write access at one time. Within than process, any
number of threads may read and write concurrently. JE supports record
locking and highly concurrent read and write access via multiple threads
in a single process.
I am not a JBossCache expert, so please take the following with a grain
of salt and check with JBoss support for details. With JBossCache, I
believe that multiple processes can be configured to share a single
cache via replication. If you configure only one of those processes to
be persistent, using JE as the persistence store, then I think the
entire shared cache will be persistent. I'm not sure how this is
configured, and as I say you'll need to check with JBoss support. But
this type of configuration may be what you're looking for.
Which actually says no concurrency with different processes.
and *one* writer only.
Actually in the dbdje docs there are some remarks.
That it is possible to open a database for read , close it
open it for write .., but this is painful
So you can't have BDBJE as shared CacheLoader.
Solution: either only use BDBJE in *one* of the processes, or use them in unshared (local) mode. See the tutorial for an example.
Another solution might be to write a remote (RMI) interface to BDBJE and access it from multiple processes via RMI. That defeats the purpose of an in-memory DB though