Package com.vmware.vim.cf
Class CacheInstance
java.lang.Object
com.vmware.vim.cf.CacheInstance
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitReady(long timeoutMillis) Block until the cache has received its first update from the server, or until the timeout elapses.voiddestroy()Destroy the caching service when no longer needed.get(ManagedObjectReference mor, String propName) Get the value of cached property whose name is propName.get(ManagedObject mo, String propName) Get the value of cached property whose name is propName.getCopy(ManagedObjectReference mor, String propName) Get a copy of the cached property.getCopy(ManagedObject mo, String propName) Get a copy of the cached property.Get the corresponding ServiceInstancebooleanisReady()Check if the CacheInstance is ready for retrievalvoidstart()Start the caching service.voidwatch(ManagedObject[] mos, String[] props) Add the managed objects and their properties to be watched.voidwatch(PropertyFilterSpec pfs) Add PropertyFilterSpec for advanced settings
-
Constructor Details
-
CacheInstance
-
-
Method Details
-
watch
Add the managed objects and their properties to be watched.- Parameters:
mos- array of managed objects.props- array of properties to watch
-
watch
Add PropertyFilterSpec for advanced settings- Parameters:
pfs- the property filter spec which specifies the managed objects and properties to watch.
-
getCopy
Get a copy of the cached property. You can change the returned object as you like- Parameters:
mo- Managed objectpropName- property name- Returns:
- the data object identified by the propName. NullObject.NULL if the data object is really null
-
getCopy
Get a copy of the cached property. You can change the returned object as you like- Parameters:
mor- Managed object referencepropName- property name- Returns:
- the data object identified by the propName. NullObject.NULL if the data object is really null
-
get
Get the value of cached property whose name is propName. You should NEVER change the returned data object.- Parameters:
mo- Managed object on which the cached property is requestedpropName- Property name, can include "."- Returns:
- the data object identified by the propName. NullObject.NULL if the data object is really null
-
get
Get the value of cached property whose name is propName. You should NEVER change the returned data object.- Parameters:
mor- Managed object reference pointing to the managed objectpropName- Property name- Returns:
- the data object identified by the propName. NullObject.NULL if the data object is really null
-
start
public void start()Start the caching service. Called after specifying the managed objects and their properties to watch. -
destroy
public void destroy()Destroy the caching service when no longer needed. Call this beforeServiceInstance.disconnect(); otherwise the watcher thread will spin on the dead session until vCenter rejects the next call with NotAuthenticated.Cancels any in-flight
waitForUpdatesExon the underlying property collector, destroys the watcher's filters, and joins the watcher thread so this method returns only after the watcher has actually stopped. Safe to call multiple times. -
getServiceInstance
Get the corresponding ServiceInstance- Returns:
- ServiceInstance object
-
isReady
public boolean isReady()Check if the CacheInstance is ready for retrieval- Returns:
- true if ready; false otherwise
-
awaitReady
Block until the cache has received its first update from the server, or until the timeout elapses. Use this afterstart()to avoid the race window whereget(com.vmware.vim25.mo.ManagedObject, java.lang.String)returns null because the watcher thread has not yet delivered an update.- Parameters:
timeoutMillis- maximum time to wait, in milliseconds; non-positive returns immediately- Returns:
- true if the cache became ready before the timeout; false otherwise
- Throws:
InterruptedException- if the current thread is interrupted while waiting
-