One of the subtle aspects to using proxies like VI Java is knowing which calls are remote (eg, VirtualMachine.getName) and which are local
(eg, VirtualMachineConfigInfo.getName). Remote calls (in addition to the performance difference) have extra failure modes that may need
to be dealt with. It would help greatly if the declarations for remote calls always included a throws clause for RemoteException (and actually
threw it).
All the modifying calls in VI Java have this right, but the accessors all go through ManagedObject.retrieveObjectProperties, which does this:
try
{
objs = pc.retrieveProperties(new PropertyFilterSpec[] { pfSpec });
} catch(Exception e)
{
throw new RuntimeException(e);
}
So a connection/session failure with vCenter will cause a RuntimeException to be thrown when calling an accessor. This means
that software that wants to re-establish a session and re-try the operation has to catch RuntimeException, which is generally
not a good idea in Java. My own code currently relies on looking at the getCause of the RuntimeException to see if it
is a RemoteException and therefore retryable.
So please change the above to let RemoteException through. I realize this means changing perhaps hundreds of APIs to
include RemoteException in the throws clause, but I think it will help VI Java users produce better software.
4KPsVf <a href="http://axaiwbzryfmj.com/">axaiwbzryfmj</a>, [url=http://khbgptzavkgh.com/]khbgptzavkgh[/url], [link=http://ioxbvaqnwqji.com/]ioxbvaqnwqji[/link], http://drhnhsncnmdt.com/