[vbox-dev] The given session is busy

Barash, Danny danny.barash at intel.com
Sat Sep 3 12:57:39 GMT 2011


I believe that the reason the machine is locked is because you are already locking it at
" IProgress progress = machine.launchVMProcess(session, "gui", "");"


Please refer to the SDK ref for more information.

Regards,
Danny.

From: vbox-dev-bounces at virtualbox.org [mailto:vbox-dev-bounces at virtualbox.org] On Behalf Of Rafael Braga
Sent: Thursday, September 01, 2011 21:49
To: vbox-dev at virtualbox.org
Subject: [vbox-dev] The given session is busy

Hello, I am beginner in virtualbox java API and now I need
change the memory size of a vm. I am using the following code:

    public void setMemorySize() {
        VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
        ISession session = mgr.getSessionObject();
        IVirtualBox vbox = mgr.getVBox();

        IMachine machine = vbox.getMachines().get(1);
        IProgress progress = machine.launchVMProcess(session, "gui", "");
        progress.waitForCompletion(-1);
        machine.lockMachine(session, LockType.Write); // machine is now locked for writing
        IMachine mutable = session.getMachine();
        // obtain the mutable machine copy
        mutable.setMemorySize((long) 1024);
        mutable.saveSettings();
        // write settings to XML
        session.unlockMachine();
    }

But, returns the following error:

Exception in thread "main" org.virtualbox_4_1.VBoxException: The function "lockMachine" returned an error condition: "The given session is busy"  (0x80bb0007)
    at org.virtualbox_4_1.IMachine.lockMachine(IMachine.java:798)
    at teste.elasticidade.IniciaVM.setMemorySize(IniciaVM.java:51)
    at teste.elasticidade.IniciaVM.main(IniciaVM.java:37)


what may be happening?

thanks a lot.

--
Rafael Braga
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20110903/1518c032/attachment.html>


More information about the vbox-dev mailing list