// Wait for the task to be restarted in a new container
final TaskStatus thirdTaskStatus = Polling.await(
LONG_WAIT_SECONDS, SECONDS, new Callable<TaskStatus>() {
@Override
public TaskStatus call() throws Exception {
final HostStatus hostStatus = client.hostStatus(testHost()).get();
final TaskStatus taskStatus = hostStatus.getStatuses().get(jobId);
return (taskStatus != null && taskStatus.getContainerId() != null &&
taskStatus.getState() == RUNNING &&
!taskStatus.getContainerId().equals(secondTaskStatus.getContainerId()))
? taskStatus