Re: [libvirt] [PATCH 1/2] Java bindings for domain events

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

 



On Tue, Nov 18, 2008 at 11:06:10AM -0500, David Lively wrote:
> The attached patch (against libvirt-java) implements Java bindings for
> libvirt domain events.  This version provides a libvirt EventImpl
> running in its own Java Thread, and provides per-Connect synchronization
> that makes using the bindings thread-safe.  (Note the Domain, Network,
> StoragePool, and StorageVol methods also synchronize on their Connect
> object, as required by libvirt.  I have similar changes for
> NodeDevice.java that need to be made when that code is checked in.)

I don't particularly like the event loop code because it is adding a huge 
pile of non-portable JNI code that won't work on Windows, which lacks
pipe() and poll(). Java already provides a portable pure Java API for 
building a poll() like event loop in form of NIO.

  http://www.xhaus.com/alan/python/jynio/select.html

The addition of the 'synchronized' annotatioons is something we need 
regardless of the rest of the patch, since our API contract dictates
that only a single thread is allowed to use a single virConnectPtr
at once.

> This version of the patch also implements and uses an enum class
> (DomainEvent.Type), as suggested by Tóth István.
> 
> IMPORTANT: THIS PATCH WILL BREAK THINGS UNLESS THE NEXT [PATCH 2/2] IS
> APPLIED TO libvirt FIRST.  Also, libvirt must be compiled WITH_PTHREADS
> for Java events to work.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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