[vbox-dev] API questions

Maxime Dor maxime.dor at altherian.org
Wed Aug 7 15:07:53 GMT 2013


Hi Devs,

After playing around with the Java WS API for a while now, I would
appreciate some clarification and confirmation on some assumptions I am
making for a while now. Here we go :

When getting several ISession object accross the code, I ended up realizing
that these objects actually point to the same session on the remote site.
This also mean that I can only have one VM locked at the same time.
1. Is this on purpose to only have one VM lockable at the same time? Is
this also the case in the XPCOM binding? Is it possible to get a different
session for each call of IVirtualbox::getSessionObject()

2. Am I correct to understand that the only way to get a lock on several
machines at the same time is to have several connections, each with its
session? Or will this lead to issues?

3. Is there any recommended way (if even possible) to get several locks in
a thread-safe way?

----------------------------------------

Related to the objects living in on the remote side. In the SDK
documentation, we are informed that we are supposed to use the
releaseRemote() method on objects we get, so they don't build up on the
"other side", being the webservice server or the XPCOM(?). While writing my
code, the way I did at least, I am having a hard time releasing the object
at the proper time. Putting the releaseRemote() a bit too defensively only
ends up producing exception on further calls (Object reference is not
found...), meaning that the actual remote object doesn't exist anymore.
Obviously, since I released it earlier. The fear is to release "too late"
and leave such objects orphan of any control.

1. What is the actual build up rate? Is it dangerous to keep these objets
in memory on the other side? Could it crash the webserver? The context
would be a single java process connected one time (possibly several times
depending on your answer at the previous section).

2. If you use the findMachine() method several times, using the same
machine UUID, would you end up re-using the same remote object or is a
remote object created each time? If the remote object is the same, I could
live with the object residing in memory, this can only make things faster
at the cost of using memory. Am I right in this assumption?

3. Is there a auto-release in Java code using the finalize() method of the
object? or such cleanup must be done by the developper?

4. Any recommended way to deal with this? I am thinking of using a helper
tatic class to fetch the objects and a timeout logic to release them. Some
kind of cache really.

-----------------------------------------

Thank you in advance for your time and wisdom on this.

Best regards,
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130807/f3dcb956/attachment.html>


More information about the vbox-dev mailing list