}
// Repeatedly poll for status
if (workflow != null) {
ClusterAccessor accessor = connection.createClusterAccessor(clusterId);
TaskDriver driver = new TaskDriver(manager);
while (true) {
System.out.println("CONTAINER STATUS");
System.out.println("----------------");
Cluster cluster = accessor.readCluster();
Collection<Participant> participants = cluster.getParticipantMap().values();
for (Participant participant : participants) {
ContainerConfig containerConfig = participant.getContainerConfig();
if (containerConfig != null) {
System.out.println(participant.getId() + "[" + containerConfig.getId() + "]: "
+ containerConfig.getState());
}
if (participant.isAlive()) {
LiveInstance runningInstance = participant.getLiveInstance();
System.out.println("\tProcess: " + runningInstance.getProcessId());
}
}
System.out.println("----------------");
System.out.println("TASK STATUS");
System.out.println("----------------");
driver.list(workflow);
Thread.sleep(5000);
}
}
}