[libvirt] [libvirt-java] [PATCH 0/2] Ensure JNA callbacks cannot be GCed
Chris Ellis
chris at intrbiz.com
Wed Mar 26 02:43:47 UTC 2014
Hi.
This is a small patch set to fix a few issues I've discovered while testing Claudio's patch set.
The first patch is trivial, it adds the ConnectionCloseListener interface and corresponding
enum, which were missing.
The second patch ensures that the JNA callbacks cannot be garbage collected whilst still
registered with the libvirt C library. Durring testing, I was finding that events would
stop working. Wireshark showed the remote daemon sending the event and some time spent
tracing through the libvirt calls led me to discover that the JNA callback objects were
being GCed. The JNA documentation states that a reference to the Callback object must be
held whilst it is in use by the C layer. This patch updates the map of event listeners
to also hold a reference to the callback object.
Regards,
Chris
Chris Ellis (2):
Add close listener types
Ensure JNA callbacks cannot get GCed
src/main/java/org/libvirt/Connect.java | 37 ++++++++++++++--------
.../org/libvirt/event/ConnectionCloseListener.java | 9 ++++++
.../org/libvirt/event/ConnectionCloseReason.java | 8 +++++
3 files changed, 41 insertions(+), 13 deletions(-)
create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseListener.java
create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseReason.java
--
1.8.4.5
More information about the libvir-list
mailing list