VirtualBox

Ticket #11521: sample_vbox.scala

File sample_vbox.scala, 712 bytes (added by Chris, 11 years ago)

An obviously incomplete sample, but illustrates example

Line 
1
2
3while(true) {
4 //Open VBOXWEB Session
5 var machine:IMachine = vbox.createMachine("",machineName,null,osType,"")
6 var session:ISession = mgr.getSessionObject
7 vbox.registerMachine(machine)
8 val progress:IProgress = machine.launchVMProcess(session,"gui", "DISPLAY=:0")
9 progress.waitForCompletion(-1)
10 mgr.closeMachineSession(session)
11 //Close VBOXWEB session
12
13 //Open VBOXWEB Session
14 machine = vbox.findMachine(machineName)
15 var progress:IProgress = session.getConsole.powerDown // Locks up here after anywhere between 5 and a few hundred iterations. Very inconsistent
16 progress.waitForCompletion(-1)
17 machine.unregister(org.virtualbox_4_2.CleanupMode.DetachAllReturnHardDisksOnly)
18 //Close VBOXWEB session
19}

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy