Hi below is snippet of code. The last line of the code(which is bold) is call multiple times. Its performance bottle neck for us. Can you suggest ways to improve it?
This code is eventually use to fetch datastore information.
//input parameters: user name - user name on Vsphere
password - password of user
hostname - hostname of system.
//create connection to ESX.
//create service refernce
ManagedObjectReference _svcRef = new ManagedObjectReference();
_svcRef.setType("ServiceInstance");
_svcRef.set_value("ServiceInstance");
VimServiceLocator _locator = new VimServiceLocator();
_locator.setMaintainSession(true);
VimPortType _service = _locator.getVimPort(new URL(urlStr));
ServiceContent _sic = _service.retrieveServiceContent(_svcRef);
ManagedObjectReference _propCol = _sic.getPropertyCollector();
ManagedObjectReference _rootFolder = _sic.getRootFolder();
if (_sic.getSessionManager() != null) {
_service.login(_sic.getSessionManager(), username, password, null);
//Create connection to ESX host - end
//The above menthod is called once during the class instantion.(aka constructor
//this line is call mutiple times to fetch datastore object.
//customer has reported a performance issue with this code. When datastore number is around 100 , it takes around 1+ hour to fetch details.
_service.findByDnsName(_sic.getSearchIndex(),null,hostname,false);