本文整理汇总了Java中com.vmware.vim25.mo.ServiceInstance.getTaskManager方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceInstance.getTaskManager方法的具体用法?Java ServiceInstance.getTaskManager怎么用?Java ServiceInstance.getTaskManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.vim25.mo.ServiceInstance
的用法示例。
在下文中一共展示了ServiceInstance.getTaskManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.vmware.vim25.mo.ServiceInstance; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
if(args.length != 3)
{
System.out.println("Usage: java PrintTaskManager "
+ "<url> <username> <password>");
return;
}
ServiceInstance si = new ServiceInstance(
new URL(args[0]), args[1], args[2], true);
TaskManager taskMgr = si.getTaskManager();
int maxCollector = taskMgr.getMaxCollector();
System.out.println("Maximum number of collectors to " +
"retrive historical tasks: " + maxCollector);
System.out.println("\nTask description:");
TaskDescription td = taskMgr.getDescriptioin();
printTaskDescription(td);
System.out.println("\nRecent tasks:");
Task[] recentTasks = taskMgr.getRecentTasks();
for(int i=0; recentTasks!=null && i<recentTasks.length; i++)
{
TaskInfo ti = recentTasks[i].getTaskInfo();
System.out.println("\nName:" + ti.getName());
System.out.println("Key:" + ti.getKey());
System.out.println("State:" + ti.getState());
}
si.getServerConnection().logout();
}
示例2: main
import com.vmware.vim25.mo.ServiceInstance; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
if(args.length != 3)
{
System.out.println("Usage: java TaskHistoryMonitor "
+ "<url> <username> <password>");
return;
}
ServiceInstance si = new ServiceInstance(
new URL(args[0]), args[1], args[2], true);
TaskManager taskMgr = si.getTaskManager();
if(taskMgr!=null)
{
Folder root = si.getRootFolder();
TaskFilterSpec tfs = createTaskFilterSpec(root);
TaskHistoryCollector thc =
taskMgr.createCollectorForTasks(tfs);
// Note: 10 <= pagesize <= 62
thc.setCollectorPageSize(15);
System.out.println("Tasks in latestPage:");
TaskInfo[] tis = thc.getLatestPage();
printTaskInfos(tis);
System.out.println("\nAll tasks:");
int total = 0;
while(true)
{
tis= thc.readNextTasks(50);
if(tis==null)
{
break;
}
total += tis.length;
printTaskInfos(tis);
}
System.out.println("\nTotal number " +
"of tasks retrieved:" + total);
thc.destroyCollector();
}
si.getServerConnection().logout();
}