An implementation of the Store interface that persists information in the
volatile JVM heap memory. Each Area in the store is represented by a byte[]
array from the Java heap.
Note that in Java there is no way to cast a reference to a numeric value,
or to cast a numeric value back into a reference. This means that
Area lookup has to be coordinated via a hashing algorithm over an array.
There would prehaps be a more efficient way to achieve this with JNI but
it would mean we can't be pure Java and it would require locking the address
of objects in the heap.
Another alternative way of implementing this class would be to use JNI to
access a C style 'malloc' function in the operating system and wrap the
memory with a native Area implementation.
author: Tobias Downer |