WaitForUpdatesEx
The
WaitForUpdatesEx
method supports a
polling mechanism for property collection that is based on a specified wait
time.
Specify the following parameters when you call
WaitForUpdatesEx
:
- Managed object reference to aPropertyCollectorinstance.
- versionvalue that identifies a sequence value. The first time you callWaitForUpdatesEx, specify an empty string (““) to retrieve a complete set of results for the specified properties. Your subsequent calls should use the version value returned in the previous call. If you don’t include the version value, the server returns everything. For more information about data versions, see Server Data Transmission.
- optionsspecifying the amount of data to transmit in a single response (theWaitOptions.maxObjectUpdatesproperty) and the number of seconds thePropertyCollectorshould wait for updates (theWaitOptions.maxWaitSecondsproperty).
The value of the
WaitOptions.maxWaitSeconds
property determines whether the
PropertyCollector
uses an
instant retrieval or a polling model. When you call
WaitForUpdatesEx
with a wait
time of 0, it checks for updates and returns immediately. When you call
WaitForUpdatesEx
with a wait
time greater than 0, the method waits until the specified time or until a
change.
WaitForUpdatesEx
blocks your
process until updates occur or until it times out. The time-out is affected by
the
maxWaitSeconds
value, the amount
of time it takes to collect updated property values, and
PropertyCollector
policy.
If the property collection operation times out,
and there are no updates to the requested properties, the
PropertyCollector
returns null
for the
WaitForUpdatesEx
response.
- maxWaitSecondsis an optional property. If you do not specify a value, thePropertyCollectorwaits as long as possible for updates. Therefore, ifmaxWaitSecondsis unset, thewaitForUpdatesExmethod will block the thread after all of the data has been retrieved, waiting for the TCP connection with the vSphere server to timeout. Your code can handle this in one of the following ways: callwaitForUpdatesExfrom a separate thread; look for specific updates and then stop calling the method; or change the TCP connection timeout,BindingProviderProperties.CONNECT_TIMEOUT.
- maxWaitSecondsset to zero specifies an immediate call and response. ThePropertyCollectorchecks for updates for all properties specified by the union of all filters associated with that instance of thePropertyCollector. ThePropertyCollectorreturns any results, ornullif there have been no updates.
- maxWaitSecondsgreater than zero specifies a wait followed by polling. ThePropertyCollectorreturnsnullif no updates are available withinmaxWaitSeconds.