Re: [libvirt-java] [PATCH 36/65] jna: Wrap the virEvent(Add, Remove)Timeout libvirt functions

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

 



At Mon, 3 Mar 2014 15:58:25 +0000,
Daniel P. Berrange wrote:
> 
> On Mon, Mar 03, 2014 at 04:46:51PM +0100, Claudio Bley wrote:
> > At Fri, 21 Feb 2014 11:01:47 +0000,
> > Daniel P. Berrange wrote:
> > > 
> > > ACK, if you also add the virEventUpdateTimeout  method
> > 
> > OK, but why should I add it? It's useless (for the user) and unused by
> > the wrapping code. I want to keep the JNA library definition clean --
> > e.g. in a later patch I remove all the *UUIDString functions.
> 
> What makes you say it is useless ?

I don't regard the JNA mappings part of the public API of the Java
bindings. It is a private implementation detail, which is (alas)
public solely due to technical/historical reasons.

So, it is useless for the user, because there is no way that he can
use it (via the /public/ API)...

Furthermore, I think there is no reason to expose those functions to
the user at all. There are other means to program timeouts in Java
than using the JNA wrapped libvirt functions where you have to run an
event loop and take some speed drawbacks into account (libffi / native
code to Java transition).

> The UpdateTimeout method lets you
> alter the timeout value for an existing timer, without having to go
> through Remove+Add of it. This might seem like a subtle distinction,
> but the difference is that the UpdateTimeout is guaranteed not to
> fail, where as Remove+Add may fail.

At Mon, 03 Mar 2014 13:05:01 -0700,
Eric Blake wrote:
> 
> In fact, in my recent 'virsh event' additions, I explicitly used code
> that adds a timer with a -1 initial period (never fires), then use
> Update to turn it on and back off for each use of the 'event' command,
> rather than having to worry about Add failing on a per-command
> basis.

For the Java event loop I've only used the Add / Remove timeout
functions in order to break out of the event loop. In light of what
both of you say, I think that is indeed better to do it using a
disabled timer with updating it and I'll post a followup patch to
change the implementation.

Thanks,
Claudio
-- 
BSc (Comp) Claudio Bley - Principal Software Engineer
AV-TEST GmbH, Klewitzstr. 7, 39112 Magdeburg, Germany
Phone: +49 391 6075460, Fax: +49 391 6075469
Web: <http://www.av-test.org>

* https://twitter.com/avtestorg * https://facebook.com/avtestorg *
* https://plus.google.com/100383867141221115206/ *

Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076)
Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

Our services shall be effected on the basis of the General Terms
and Conditions of AV-TEST GmbH, which are accessible under
<http://www.av-test.org/en/av-test/terms-and-conditions/> or
obtainable upon request.

Unsere Leistungen erfolgen auf der Grundlage der Allgemeinen
Geschäftsbedingungen der AV-TEST GmbH, die unter
<http://www.av-test.org/av-test/agb/> abrufbar sind oder auf
Anfrage übersandt werden.

--
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]