Cache field ids and method ids for all async operations. Invalidate
unpackers by setting fields, rather than calling a method to do it.
Use javaClose to invalidate the swigCptr for a AsyncOp at the end of
the callback. Any use of an AsyncOp after its lifetime has ended will
give a NullPointerException.
Declare that new_async_op throws WiredTigerException, which happens
when there are no more slots available.
Added a test with a million items that typically does no pauses when
creating ops, but catches WiredTigerException and retries with a short
sleep.
- Created a real async handler for java allowing callbacks
into java code. Code to be registered must implement the
new AsyncCallback interface.
- Renamed classes/methods to Java-ish names.
- Fixes to support 'this' removal for AsyncOp.
- Java's cursor ops, like 'insert' set up the value unpackers
after insert completes. For AsyncOp, we take a different
approach, and invalidate the unpacker when the op completes,
letting the value be fetched when needed.
- Added new test AsyncTest that tests doing different numbers of
async ops with different parameters, and also with different types
of keys/values.
As reported in #485, when a conn/session is closed, any subordinate
open cursors and sessions have dangling handles that refer to freed
memory. But also, if a conn/session/cursor handle is closed, that
handle may still be referenced in Java though it references freed
memory.
This commit uses the event handler for close calls to capture the first
case, and makes explicit calls at the close site for the second case.
For each case, a close will set the Java side 'swigCPtr' for each associated
object being closed to 0.
For detection, typemaps effectively check an arg's swigCPtr to see
if the object has been previously closed. Special cases, like when
a NULL handle is permitted in the API, are accounted for.
Some details:
- WT_HANDLE_NULLABLE() and WT_HANDLE_CLOSED() mark points in the API
(wiredtiger.in) where handles may be used as null and where
handles are closed. This are not exposed to doxygen.
- lang_private fields have been added to WT_CONNECTION_IMPL,
WT_SESSION_IMPL and WT_CURSOR to keep a handle to the
associated java object, needed at the time of the close().