Thanks Klaus for your answer.<br><br><div class="gmail_quote">On Wed, Mar 28, 2012 at 6:07 PM, Klaus Espenlaub <span dir="ltr"><<a href="mailto:klaus.espenlaub@oracle.com">klaus.espenlaub@oracle.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 27.03.2012 20:54, Andrea Turli wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So I'm trying to lauch/stop vm but also modify the vm definition.<br>
<br>
My question was<br>
Is it possible that IMachine.getSessionState() and ISession.getState()<br>
are not<br>
always in sync?<br>
</blockquote>
<br></div>
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.</blockquote>
<div><br></div><div>Is there any other documentation where I can study more the relationship between those two sessions, cause it is not totally clear to me.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there a way to ensure that the ISession ::state is effectively<br>
Unlocked before another methods tries to use it? Can I loop on the<br>
ISession::state until the ISession is Unlocked for<br>
all, and how?<br>
</blockquote>
<br></div>
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.<br>
</blockquote><div><br></div><div>I see your point, but what's then the suggested way to implement this kind of scenario?</div><div><br></div><div>I lock and unlock a session to modify a machine</div><div>ISession session = vboxmanager.getSession();</div>
<div>machine.lockSession(session, LockType);</div><div>...</div><div>session.unlockMachine();</div><div><br></div><div>and immediately after that if I ask for</div><div><br></div><div>vboxmanager.findMachine(machineId);</div>








<div><br></div><div>I got exception cause the session is busy.</div><div><br></div><div>What's my error?</div><div><br></div><div>Thanks,</div><div>Andrea</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Klaus<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
Thanks,<br>
Andrea<br>
<br>
On Tue, Mar 27, 2012 at 3:23 PM, Klaus Espenlaub<br></div><div><div class="h5">
<<a href="mailto:klaus.espenlaub@oracle.com" target="_blank">klaus.espenlaub@oracle.com</a> <mailto:<a href="mailto:klaus.espenlaub@oracle.com" target="_blank">klaus.espenlaub@<u></u>oracle.com</a>>> wrote:<br>

<br>
    On 25.03.2012 18:42, Andrea Turli wrote:<br>
     > Hi,<br>
     ><br>
     > I'm trying to implement a java client able to interact with Vbox API.<br>
     ><br>
     > Reading the documentation I've found this document<br>
     ><br>
    <a href="https://www.virtualbox.org/sdkref/interface_i_machine.html#5f6e112de89f7e1d300738c9a055d5c9" target="_blank">https://www.virtualbox.org/<u></u>sdkref/interface_i_machine.<u></u>html#<u></u>5f6e112de89f7e1d300738c9a055d5<u></u>c9</a><br>

     > where it is said explicity:<br>
     > "The caller must eventually release the session's shared lock by<br>
     > calling ISession::unlockMachine on the local session object once this<br>
     > call has returned. However, the session's state (see ISession::state)<br>
     > will not return to "Unlocked" until the remote session has also<br>
     > unlocked the machine (i.e. the machine has stopped running)."<br>
     ><br>
     > In fact IMachine.getSessionState() and ISession.getState() are not<br>
     > always in sync. Is there a way to ensure that the ISession ::state is<br>
     > effectively Unlocked before another methods tries to use it?<br>
     > Can I loop on the ISession::state until the ISession is Unlocked for<br>
     > all, and how?<br>
<br>
    What's the problem you're trying to solve? It's a bit difficult to<br>
    answer a question you didn't ask.<br>
<br>
    Are you launching a VM, or are you trying to make changes to the<br>
    settings of a running VM? Quite different cases when it comes to<br>
    sessions.<br>
<br>
    Klaus<br>
<br>
     ><br>
     > Thank you,<br>
     > Andrea<br>
     ><br>
     ><br>
     >   --<br>
     >   Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP,<br>
    POP3 e SMTP autenticato? GRATIS solo con Email.it <a href="http://www.email.it/f" target="_blank">http://www.email.it/f</a><br>
     ><br>
     >   Sponsor:<br>
     >   Prenota prima e cogli le offerte Costahotels Riccione per le<br>
    vacanze in famiglia con bambini e risparmia senza rinunciare<br>
    all'ottimo servizio di strutture selezionate<br>
     >   Clicca qui:<br>
    <a href="http://adv.email.it/cgi-bin/foclick.cgi?mid=12229&d=25-3" target="_blank">http://adv.email.it/cgi-bin/<u></u>foclick.cgi?mid=12229&d=25-3</a><br>
    <<a href="http://adv.email.it/cgi-bin/foclick.cgi?mid=12229&d=25-3" target="_blank">http://adv.email.it/cgi-bin/<u></u>foclick.cgi?mid=12229&d=25-3</a>><br>
     ><br>
     > ______________________________<u></u>_________________<br>
     > vbox-dev mailing list<br></div></div>
     > <a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.org</a> <mailto:<a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.<u></u>org</a>><div class="im"><br>

     > <a href="https://www.virtualbox.org/mailman/listinfo/vbox-dev" target="_blank">https://www.virtualbox.org/<u></u>mailman/listinfo/vbox-dev</a><br>
<br>
<br>
    --<br>
    Oracle <<a href="http://www.oracle.com" target="_blank">http://www.oracle.com</a>><br>
    Dr. Klaus Espenlaub | Snr. Manager Software Development Desktop<br>
    Virtualization<br></div>
    Phone: <a href="tel:%2B49%207151%2060405%20205" value="+49715160405205" target="_blank">+49 7151 60405 205</a> <tel:%2B49%207151%2060405%<u></u>20205><br>
    <tel:<a href="tel:%2B49715160405205" value="+49715160405205" target="_blank">+49715160405205</a> <tel:%2B49715160405205>><div class="im"><br>
    Oracle VM VirtualBox<br>
<br>
    ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt<br>
<br>
    ORACLE Deutschland B.V. & Co. KG<br>
    Hauptverwaltung: Riesstr. 25, D-80992 München<br>
    Registergericht: Amtsgericht München, HRA 95603<br>
    Geschäftsführer: Jürgen Kunz<br>
<br>
    Komplementärin: ORACLE Deutschland Verwaltung B.V.<br>
    Hertogswetering 163/167, 3543 AS Utrecht, Niederlande<br>
    Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697<br>
    Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher<br>
<br>
    Green Oracle <<a href="http://www.oracle.com/commitment" target="_blank">http://www.oracle.com/<u></u>commitment</a>>         Oracle is<br>
    committed to<br>
    developing practices and products that help protect the environment<br>
<br>
<br>
    ______________________________<u></u>_________________<br>
    vbox-dev mailing list<br></div>
    <a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.org</a> <mailto:<a href="mailto:vbox-dev@virtualbox.org" target="_blank">vbox-dev@virtualbox.<u></u>org</a>><br>
    <a href="https://www.virtualbox.org/mailman/listinfo/vbox-dev" target="_blank">https://www.virtualbox.org/<u></u>mailman/listinfo/vbox-dev</a><br>
<br>
<br>
</blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
Oracle <<a href="http://www.oracle.com" target="_blank">http://www.oracle.com</a>><br>
Dr. Klaus Espenlaub | Snr. Manager Software Development Desktop<br>
Virtualization<br>
Phone: <a href="tel:%2B49%207151%2060405%20205" value="+49715160405205" target="_blank">+49 7151 60405 205</a> <tel:<a href="tel:%2B49715160405205" value="+49715160405205" target="_blank">+49715160405205</a>><br>
Oracle VM VirtualBox<br>
<br>
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt<br>
<br>
ORACLE Deutschland B.V. & Co. KG<br>
Hauptverwaltung: Riesstr. 25, D-80992 München<br>
Registergericht: Amtsgericht München, HRA 95603<br>
Geschäftsführer: Jürgen Kunz<br>
<br>
Komplementärin: ORACLE Deutschland Verwaltung B.V.<br>
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande<br>
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697<br>
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher<br>
<br>
Green Oracle <<a href="http://www.oracle.com/commitment" target="_blank">http://www.oracle.com/<u></u>commitment</a>>         Oracle is committed to<br>
developing practices and products that help protect the environment<br>
<br>
</div></div></blockquote></div><br>