Class Task
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetInfo()voidsetTaskDescription(LocalizableMessage description) voidsetTaskState(TaskInfoState state, Object result, LocalizedMethodFault fault) voidupdateProgress(int percentDone) Deprecated.Copyright 2009 NetApp, contribution by Eric ForgettewaitForTask(int runningDelayInMillSecond, int queuedDelayInMillSecond) Copyright 2009 NetApp, contribution by Eric ForgettewaitForTask(int runningDelayInMillSecond, int queuedDelayInMillSecond, long maxWaitMillis) Same aswaitForTask(int, int)but bounded by a maximum wait time.waitForTask(long maxWaitMillis) Wait for the task to complete, giving up after maxWaitMillis.Methods inherited from class com.vmware.vim25.mo.ExtensibleManagedObject
getAvailableField, getValues, setCustomValueMethods inherited from class com.vmware.vim25.mo.ManagedObject
convertMors, getCurrentProperty, getDatastores, getFilter, getHosts, getManagedObject, getManagedObjects, getManagedObjects, getMOR, getNetworks, getPropertiesByPaths, getPropertyByPath, getResourcePools, getScheduledTasks, getServerConnection, getTasks, getViews, getVimService, getVms, retrieveObjectProperties, setCachedProperty, setMOR, setServerConnection, toString, waitForValues
-
Field Details
-
PROPNAME_INFO
- See Also:
-
SUCCESS
- See Also:
-
-
Constructor Details
-
Task
-
-
Method Details
-
getInfo
-
cancelTask
- Throws:
InvalidStateRuntimeFaultRemoteException
-
setTaskState
public void setTaskState(TaskInfoState state, Object result, LocalizedMethodFault fault) throws InvalidState, RuntimeFault, RemoteException - Throws:
InvalidStateRuntimeFaultRemoteException
-
setTaskDescription
- Throws:
RuntimeFaultRemoteException
-
updateProgress
public void updateProgress(int percentDone) throws InvalidState, OutOfBounds, RuntimeFault, RemoteException -
getAssociatedManagedEntity
-
getLockedManagedEntities
-
getTaskInfo
-
waitForMe
Deprecated.If there is another thread or client calling waitForUpdate(), the behavior of this method is not predictable. This usually happens with VI Client plug-in which shares the session with the VI Client which use waitForUpdate() extensively. The safer way is to poll the related info.state and check its value.- Returns:
- Throws:
InvalidPropertyRuntimeFaultRemoteException
-
waitForTask
Copyright 2009 NetApp, contribution by Eric ForgetteThis is a "drop-in" replacement for waitForMe() that uses a timed polling in place of waitForValues.
This method will eat 3 exceptions while trying to get TaskInfo and TaskState. On the fourth try, the captured exception is thrown.
- Returns:
- String based on TaskInfoState
- Throws:
RuntimeFaultRemoteExceptionInterruptedExceptionRuntimeException- if the third exception is not RuntimeFault or RemoteException
-
waitForTask
public String waitForTask(long maxWaitMillis) throws RuntimeFault, RemoteException, InterruptedException, TimeoutException Wait for the task to complete, giving up after maxWaitMillis. Uses the default poll intervals (500ms running, 1000ms queued).- Parameters:
maxWaitMillis- maximum time to wait before giving up; 0 or negative means wait forever- Returns:
- String based on TaskInfoState
- Throws:
TimeoutException- if maxWaitMillis elapses before the task reaches a terminal stateRuntimeFaultRemoteExceptionInterruptedException
-
waitForTask
public String waitForTask(int runningDelayInMillSecond, int queuedDelayInMillSecond) throws RuntimeFault, RemoteException, InterruptedException Copyright 2009 NetApp, contribution by Eric ForgetteThis is a replacement for waitForMe() that uses a timed polling in place of waitForValues. The delay between each poll is configurable based on the last seen task state. The method will sleep for the number of milliseconds specified in runningDelayInMillSecond while the task is in the running state. The method will sleep for the number of milliseconds specified in queuedDelayInMillSecond while the task is in the queued state.
This method will eat 3 exceptions while trying to get TaskInfo and TaskState. On the fourth try, the captured exception is thrown.
- Parameters:
runningDelayInMillSecond- - number of milliseconds to sleep between polls for a running taskqueuedDelayInMillSecond- - number of milliseconds to sleep between polls for a queued task- Returns:
- String based on TaskInfoState
- Throws:
RuntimeFaultRemoteExceptionInterruptedExceptionRuntimeException- if the third exception is not RuntimeFault or RemoteException
-
waitForTask
public String waitForTask(int runningDelayInMillSecond, int queuedDelayInMillSecond, long maxWaitMillis) throws RuntimeFault, RemoteException, InterruptedException, TimeoutException Same aswaitForTask(int, int)but bounded by a maximum wait time. If the task has not reached a terminal state (success or error) withinmaxWaitMillis, throwsTimeoutException. The task itself is not cancelled — callcancelTask()from the caller if desired.- Parameters:
runningDelayInMillSecond- number of milliseconds to sleep between polls for a running taskqueuedDelayInMillSecond- number of milliseconds to sleep between polls for a queued taskmaxWaitMillis- maximum time to wait before giving up; 0 or negative means wait forever- Returns:
- String based on TaskInfoState
- Throws:
TimeoutException- if maxWaitMillis elapses before the task reaches a terminal stateRuntimeFaultRemoteExceptionInterruptedException
-