[vbox-dev] ISession lock/unlock problems

Andrea Turli andrea.turli at email.it
Thu Mar 29 09:37:15 GMT 2012


Thanks Klaus for your answer.

On Wed, Mar 28, 2012 at 6:07 PM, Klaus Espenlaub <klaus.espenlaub at oracle.com
> wrote:

> 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 any other documentation where I can study more the relationship
between those two sessions, cause it is not totally clear to me.



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

I see your point, but what's then the suggested way to implement this kind
of scenario?

I lock and unlock a session to modify a machine
ISession session = vboxmanager.getSession();
machine.lockSession(session, LockType);
...
session.unlockMachine();

and immediately after that if I ask for

vboxmanager.findMachine(machineId);

I got exception cause the session is busy.

What's my error?

Thanks,
Andrea

>
> Klaus
>
>
>> Thanks,
>> Andrea
>>
>> On Tue, Mar 27, 2012 at 3:23 PM, Klaus Espenlaub
>> <klaus.espenlaub at oracle.com <mailto:klaus.espenlaub@**oracle.com<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#**
>> 5f6e112de89f7e1d300738c9a055d5**c9<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>
>>    <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<vbox-dev at virtualbox.org>
>> >
>>
>>     > https://www.virtualbox.org/**mailman/listinfo/vbox-dev<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<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<vbox-dev at virtualbox.org>
>> >
>>    https://www.virtualbox.org/**mailman/listinfo/vbox-dev<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<http://www.oracle.com/commitment>>
>         Oracle is committed to
> developing practices and products that help protect the environment
>
>

 

 

 --

 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:

 ING DIRECT Conto Arancio. 4,20% per 12 mesi, zero spese, aprilo in due minuti!

 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11924&d=29-3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20120329/0a94ef92/attachment.html>


More information about the vbox-dev mailing list