OfferID id = Iterables.getOnlyElement(offerIds);
Offer offer = sentOffers.remove(id);
checkState(offer != null, "Offer " + id + " is invalid.");
final TaskInfo task = Iterables.getOnlyElement(tasks);
synchronized (activeTasks) {
checkState(
!activeTasks.containsKey(task.getTaskId()),
"Task " + task.getTaskId() + " already exists.");
activeTasks.put(task.getTaskId(), new Task(offer, task));
}
executor.schedule(
new Runnable() {
@Override
public void run() {
Futures.getUnchecked(schedulerFuture).statusUpdate(
FakeMaster.this,
TaskStatus.newBuilder()
.setTaskId(task.getTaskId())
.setState(TaskState.TASK_RUNNING)
.build());
}
},
1,