|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.virtualbox_5_0.IUnknown
org.virtualbox_5_0.ISession
public class ISession
The ISession interface represents a client process and allows for locking
virtual machines (represented by IMachine objects) to prevent conflicting
changes to the machine.
Any caller wishing to manipulate a virtual machine needs to create a session
object first, which lives in its own process space. Such session objects are
then associated withIMachine
objects living in the VirtualBox
server process to coordinate such changes.
There are two typical scenarios in which sessions are used:
IMachine.lockMachine(org.virtualbox_5_0.ISession,org.virtualbox_5_0.LockType)
.
Whereas multiple sessions may control a running virtual machine, only
one process can obtain a write lock on the machine to prevent conflicting
changes. A write lock is also needed if a process wants to actually run a
virtual machine in its own context, such as the VirtualBox GUI or
VBoxHeadless front-ends. They must also lock a machine for their own
sessions before they are allowed to power up the virtual machine.
As a result, no machine settings can be altered while another process is
already using it, either because that process is modifying machine settings
or because the machine is running.IMachine.launchVMProcess(org.virtualbox_5_0.ISession,String,String)
, which also takes a session object
as its first parameter. This session then identifies the caller and lets the
caller control the started machine (for example, pause machine execution or
power it down) as well as be notified about machine execution state changes.IWebsessionManager.logon(String,String)
is called. A managed object reference to that session object can be retrieved by
callingIWebsessionManager.getSessionObject(org.virtualbox_5_0.IVirtualBox)
.
Field Summary |
---|
Fields inherited from class org.virtualbox_5_0.IUnknown |
---|
obj, objMgr, port |
Constructor Summary | |
---|---|
ISession(java.lang.String wrapped,
org.virtualbox_5_0.ObjectRefManager objMgr,
org.virtualbox_5_0.jaxws.VboxPortType port)
|
Method Summary | |
---|---|
IConsole |
getConsole()
Console object associated with this session. |
IMachine |
getMachine()
Machine object associated with this session. |
java.lang.String |
getName()
Name of this session. |
SessionState |
getState()
Current state of this session. |
SessionType |
getType()
Type of this session. |
static ISession |
queryInterface(IUnknown obj)
|
void |
setName(java.lang.String value)
Name of this session. |
void |
unlockMachine()
Unlocks a machine that was previously locked for the current session. |
Methods inherited from class org.virtualbox_5_0.IUnknown |
---|
getObjMgr, getRemoteWSPort, getWrapped, releaseRemote |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ISession(java.lang.String wrapped, org.virtualbox_5_0.ObjectRefManager objMgr, org.virtualbox_5_0.jaxws.VboxPortType port)
Method Detail |
---|
public SessionState getState()
public SessionType getType()
getState()
is Locked), otherwise an error will be returned.
public java.lang.String getName()
public void setName(java.lang.String value)
value
- Stringpublic IMachine getMachine()
public IConsole getConsole()
public static ISession queryInterface(IUnknown obj)
public void unlockMachine()
IMachine.launchVMProcess(org.virtualbox_5_0.ISession,String,String)
orIMachine.lockMachine(org.virtualbox_5_0.ISession,org.virtualbox_5_0.LockType)
calls. Otherwise the state of
the machine will be set toMachineState.Aborted
on the
server, and changes made to the machine settings will be lost.
Generally, it is recommended to unlock all machines explicitly
before terminating the application (regardless of the reason for
the termination).
Expected result codes:
E_UNEXPECTED | Session is not locked. |
getState()
to return to "Unlocked" immediately after you invoke this method,
particularly if you have started a new VM process. The session
state will automatically return to "Unlocked" once the VM is no
longer executing, which can of course take a very long time.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |