com.vmware.vim25.mo
Class Task

java.lang.Object
  extended by com.vmware.vim25.mo.ManagedObject
      extended by com.vmware.vim25.mo.ExtensibleManagedObject
          extended by com.vmware.vim25.mo.Task

public class Task
extends ExtensibleManagedObject

The managed object class corresponding to the one defined in VI SDK API reference.

Author:
Steve JIN (sjin@vmware.com)

Field Summary
static String PROPNAME_INFO
           
static String SUCCESS
           
 
Constructor Summary
Task(ServerConnection serverConnection, ManagedObjectReference mor)
           
 
Method Summary
 void cancelTask()
           
 ManagedEntity getAssociatedManagedEntity()
           
 ManagedEntity[] getLockedManagedEntities()
           
 TaskInfo getTaskInfo()
           
 void setTaskDescription(LocalizableMessage description)
           
 void setTaskState(TaskInfoState tis, Object result, LocalizedMethodFault fault)
           
 void updateProgress(int percentDone)
           
 String waitForMe()
          Deprecated.  
 String waitForTask()
          Copyright 2009 NetApp, contribution by Eric Forgette This is a "drop-in" replacement for waitForMe() that uses a timed polling in place of waitForValues.
 String waitForTask(int runningDelayInMillSecond, int queuedDelayInMillSecond)
          Copyright 2009 NetApp, contribution by Eric Forgette This is a replacement for waitForMe() that uses a timed polling in place of waitForValues.
 
Methods inherited from class com.vmware.vim25.mo.ExtensibleManagedObject
getAvailableField, getValues, setCustomValue
 
Methods 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, setMOR, setServerConnection, toString, waitForValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPNAME_INFO

public static final String PROPNAME_INFO
See Also:
Constant Field Values

SUCCESS

public static final String SUCCESS
See Also:
Constant Field Values
Constructor Detail

Task

public Task(ServerConnection serverConnection,
            ManagedObjectReference mor)
Method Detail

getTaskInfo

public TaskInfo getTaskInfo()
                     throws InvalidProperty,
                            RuntimeFault,
                            RemoteException
Throws:
InvalidProperty
RuntimeFault
RemoteException

getAssociatedManagedEntity

public ManagedEntity getAssociatedManagedEntity()

getLockedManagedEntities

public ManagedEntity[] getLockedManagedEntities()

cancelTask

public void cancelTask()
                throws RuntimeFault,
                       RemoteException
Throws:
RuntimeFault
RemoteException

setTaskState

public void setTaskState(TaskInfoState tis,
                         Object result,
                         LocalizedMethodFault fault)
                  throws InvalidState,
                         RuntimeFault,
                         RemoteException
Throws:
InvalidState
RuntimeFault
RemoteException

updateProgress

public void updateProgress(int percentDone)
                    throws InvalidState,
                           OutOfBounds,
                           RuntimeFault,
                           RemoteException
Throws:
InvalidState
OutOfBounds
RuntimeFault
RemoteException

setTaskDescription

public void setTaskDescription(LocalizableMessage description)
                        throws RuntimeFault,
                               RemoteException
Throws:
RuntimeFault
RemoteException
Since:
SDK4.0

waitForMe

public String waitForMe()
                 throws InvalidProperty,
                        RuntimeFault,
                        RemoteException
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:
InvalidProperty
RuntimeFault
RemoteException

waitForTask

public String waitForTask()
                   throws RuntimeFault,
                          RemoteException,
                          InterruptedException
Copyright 2009 NetApp, contribution by Eric Forgette This 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:
RuntimeFault
RemoteException
InterruptedException
RuntimeException - if the third exception is not RuntimeFault or RemoteException

waitForTask

public String waitForTask(int runningDelayInMillSecond,
                          int queuedDelayInMillSecond)
                   throws RuntimeFault,
                          RemoteException,
                          InterruptedException
Copyright 2009 NetApp, contribution by Eric Forgette This 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 task
queuedDelayInMillSecond - - number of milliseconds to sleep between polls for a queued task
Returns:
String based on TaskInfoState
Throws:
RuntimeFault
RemoteException
InterruptedException
RuntimeException - if the third exception is not RuntimeFault or RemoteException


Copyright © 2011-2012. All Rights Reserved.