[vbox-dev] ISession lock/unlock problems

Klaus Espenlaub klaus.espenlaub at oracle.com
Wed Mar 28 17:07:01 GMT 2012


On 27.03.2012 20:54, Andrea Turli wrote:
> So I'm trying to lauch/stop vm but also modify the vm definition.
>
> My question was
> Is it possible that IMachine.getSessionState() and ISession.getState()
> are not
> always in sync?

Yes, that's possible. The IMachine one is more global (should be obvious 
from the scope/location of the corresponding object - IMachine is in 
VBoxSVC, and ISession is in the client), and thus if two sessions exist 
there may be significant differences, especially before/after 
associating the session with an IMachine instance.

> Is there a way to ensure that the ISession ::state is effectively
> Unlocked before another methods tries to use it? Can I loop on the
> ISession::state until the ISession is Unlocked for
> all, and how?

No. If you write code which extrapolates the session state of other 
sessions from the "own" session you're simply doing something wrong. If 
there would be no difference between the methods we would have removed 
one of them.

Klaus

>
> Thanks,
> Andrea
>
> On Tue, Mar 27, 2012 at 3:23 PM, Klaus Espenlaub
> <klaus.espenlaub at oracle.com <mailto:klaus.espenlaub at oracle.com>> wrote:
>
>     On 25.03.2012 18:42, Andrea Turli wrote:
>      > Hi,
>      >
>      > I'm trying to implement a java client able to interact with Vbox API.
>      >
>      > Reading the documentation I've found this document
>      >
>     https://www.virtualbox.org/sdkref/interface_i_machine.html#5f6e112de89f7e1d300738c9a055d5c9
>      > where it is said explicity:
>      > "The caller must eventually release the session's shared lock by
>      > calling ISession::unlockMachine on the local session object once this
>      > call has returned. However, the session's state (see ISession::state)
>      > will not return to "Unlocked" until the remote session has also
>      > unlocked the machine (i.e. the machine has stopped running)."
>      >
>      > In fact IMachine.getSessionState() and ISession.getState() are not
>      > always in sync. Is there a way to ensure that the ISession ::state is
>      > effectively Unlocked before another methods tries to use it?
>      > Can I loop on the ISession::state until the ISession is Unlocked for
>      > all, and how?
>
>     What's the problem you're trying to solve? It's a bit difficult to
>     answer a question you didn't ask.
>
>     Are you launching a VM, or are you trying to make changes to the
>     settings of a running VM? Quite different cases when it comes to
>     sessions.
>
>     Klaus
>
>      >
>      > Thank you,
>      > Andrea
>      >
>      >
>      >   --
>      >   Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP,
>     POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
>      >
>      >   Sponsor:
>      >   Prenota prima e cogli le offerte Costahotels Riccione per le
>     vacanze in famiglia con bambini e risparmia senza rinunciare
>     all'ottimo servizio di strutture selezionate
>      >   Clicca qui:
>     http://adv.email.it/cgi-bin/foclick.cgi?mid=12229&d=25-3
>     <http://adv.email.it/cgi-bin/foclick.cgi?mid=12229&d=25-3>
>      >
>      > _______________________________________________
>      > vbox-dev mailing list
>      > vbox-dev at virtualbox.org <mailto:vbox-dev at virtualbox.org>
>      > https://www.virtualbox.org/mailman/listinfo/vbox-dev
>
>
>     --
>     Oracle <http://www.oracle.com>
>     Dr. Klaus Espenlaub | Snr. Manager Software Development Desktop
>     Virtualization
>     Phone: +49 7151 60405 205 <tel:%2B49%207151%2060405%20205>
>     <tel:+49715160405205 <tel:%2B49715160405205>>
>     Oracle VM VirtualBox
>
>     ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt
>
>     ORACLE Deutschland B.V. & Co. KG
>     Hauptverwaltung: Riesstr. 25, D-80992 München
>     Registergericht: Amtsgericht München, HRA 95603
>     Geschäftsführer: Jürgen Kunz
>
>     Komplementärin: ORACLE Deutschland Verwaltung B.V.
>     Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
>     Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
>     Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher
>
>     Green Oracle <http://www.oracle.com/commitment>         Oracle is
>     committed to
>     developing practices and products that help protect the environment
>
>
>     _______________________________________________
>     vbox-dev mailing list
>     vbox-dev at virtualbox.org <mailto:vbox-dev at virtualbox.org>
>     https://www.virtualbox.org/mailman/listinfo/vbox-dev
>
>


-- 
Oracle <http://www.oracle.com>
Dr. Klaus Espenlaub | Snr. Manager Software Development Desktop
Virtualization
Phone: +49 7151 60405 205 <tel:+49715160405205>
Oracle VM VirtualBox

ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

Green Oracle <http://www.oracle.com/commitment> 	Oracle is committed to
developing practices and products that help protect the environment





More information about the vbox-dev mailing list