On Thu, Feb 13, 2014 at 04:22:49PM +0100, Claudio Bley wrote:
Remove the public domainEventRegisterAny and
domainEventDeregisterAny
methods. These methods basically were of no use since the only thing you
could register was a "generic" callback.
At runtime, you would have to provide a real callback function matching
the prototype of the native callback type.
Trying to use a generic callback instead quickly leads to failures or
JVM crashes.
For convenience and the sake of type safety we don't let the
user deal with Libvirt.VirDomainEventCallback interfaces directly.
Instead, there will be a specific interface definition for each type
of callback as we soon shall see.
To prevent the garbage collector from reaping registered callback objects
every event callback will be stored along with its eventID and
corresponding listener instance.
This will provide a natural, idiomatic interface using
addListener/removeListener methods.
Signed-off-by: Claudio Bley <cbley(a)av-test.de>
---
src/main/java/org/libvirt/Connect.java | 79 ++++++++++++--------
src/main/java/org/libvirt/event/EventListener.java | 7 ++
src/main/java/org/libvirt/jna/Libvirt.java | 22 ++++--
3 files changed, 73 insertions(+), 35 deletions(-)
create mode 100644 src/main/java/org/libvirt/event/EventListener.java
ACK
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|