On 02/18/2014 07:02 AM, Pasquale Dir wrote:
I am using the java api bindings.
I'd like to set a connection timeout on the Connect class as sometimes it
takes just too long.
Which particular API takes too long? There are some APIs like migration
that take a long time, but where you can use another thread on the same
connection object (or even a separate connection object) to track the
status of it. Newer APIs such as block-pull were designed to start an
asynchronous job and return immediately, where you can then track job
status and/or abort the job early via separate API calls. We already
need to enhance our job control APIs to support parallel jobs (qemu just
added the concept of a block-backup for image fleecing, and there is
some desire to be able to fleece images from multiple points in time
which would require multiple jobs) - as part of enhancing job support
there, we might also be able to enhance migration to have a asynchronous
mode instead of blocking for the entire operation. We also want to add
job control for various storage volume operations, which are currently
long-running but can't be interrupted easily.
Most APIs return as fast as possible after taking effect (although on a
heavily loaded machine, that can take a while). Depending on the
command, aborting early because of a timeout may actually be worse than
using a different thread to track progress, unless the command is
already associated with job control.
Is there any way/workaround?
Without knowing your exact goal, it's hard to say.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org