[libvirt-java] [PATCH 0/2] Ensure JNA callbacks cannot be GCed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]