[libvirt-users] Using Java bindings to event callback
Bruno Costa
brunogain at gmail.com
Tue Jul 27 12:42:44 UTC 2010
Any help on this subject?
Thanks,
Bruno Costa
On Fri, 2010-07-16 at 13:49 +0100, Bruno Costa wrote:
> I'm trying to build a trivial example code. Something like this in the
> main():
>
>
> conn = new Connect("qemu:///session", false);
>
> VirConnectDomainEventGenericCallback cb = new
> VirConnectDomainEventGenericCallback() {
> public void eventCallback(ConnectionPointer arg0, DomainPointer(arg1,
> Pointer arg2) {
> System.out.println("event happened!");
> }
> };
>
> int pointer = conn.domainEventRegisterAny(null, 0, cb);
>
> Is this example, I'm trying to catch events of type 0
> ( VIR_DOMAIN_EVENT_ID_LIFECYCLE) to a callback(cb). But I think this way
> is not correct, because the execution should stop and I should see the
> events in the output.
>
> The idea is to write my own callbacks to catch the events, without
> having to poll the state of the resources. I have seen the code in
> python, namely event-test.py, and realized that there are helper classes
> (such virEventLoop*) and I might need something similar in Java... But I
> can't find any examples.
>
> Thanks,
> Bruno Costa
>
>
> On Fri, 2010-07-16 at 07:34 -0400, Bryan Kearney wrote:
> > On 07/16/2010 05:58 AM, Bruno Costa wrote:
> > > I'm having some trouble using java bindings for domain events. Can
> > > anyone provide me an example on how to use this, namely
> > > conn.domainEventRegisterAny?
> >
> > This is pretty new code, so there may not be many examples. What issues
> > are you seeing, maybe we can figure them out.
> >
> > -- bk
> >
>
More information about the libvirt-users
mailing list