public class ZooKeeperAgentModel extends com.google.common.util.concurrent.AbstractIdleService implements AgentModel
This caches ZK state to local disk so the agent can continue to function in the face of a ZK outage.
AgentModel.Listener| Constructor and Description |
|---|
ZooKeeperAgentModel(ZooKeeperClientProvider provider,
String host,
Path stateDirectory,
TaskHistoryWriter historyWriter,
List<EventSender> eventSenders,
String taskStatusEventTopic) |
public ZooKeeperAgentModel(ZooKeeperClientProvider provider, String host, Path stateDirectory, TaskHistoryWriter historyWriter, List<EventSender> eventSenders, String taskStatusEventTopic) throws IOException, InterruptedException
IOExceptionInterruptedExceptionprotected void startUp()
throws Exception
startUp in class com.google.common.util.concurrent.AbstractIdleServiceExceptionprotected void shutDown()
throws Exception
shutDown in class com.google.common.util.concurrent.AbstractIdleServiceExceptionpublic Map<com.spotify.helios.common.descriptors.JobId,com.spotify.helios.common.descriptors.Task> getTasks()
getTasks in interface AgentModelpublic Map<com.spotify.helios.common.descriptors.JobId,com.spotify.helios.common.descriptors.TaskStatus> getTaskStatuses()
TaskStatuses for all tasks assigned to the current agent.getTaskStatuses in interface AgentModelpublic void setTaskStatus(com.spotify.helios.common.descriptors.JobId jobId, com.spotify.helios.common.descriptors.TaskStatus status) throws InterruptedException
TaskStatus for the job identified by jobId.setTaskStatus in interface AgentModeljobId - The job ID.status - The job state.InterruptedException - If the thread is interrupted.public com.spotify.helios.common.descriptors.TaskStatus getTaskStatus(com.spotify.helios.common.descriptors.JobId jobId)
TaskStatus for the job identified by jobId.getTaskStatus in interface AgentModeljobId - The job ID.public void removeTaskStatus(com.spotify.helios.common.descriptors.JobId jobId) throws InterruptedException
TaskStatus for the job identified by jobId.removeTaskStatus in interface AgentModeljobId - The job id.InterruptedException - If the thread is interrupted.public void addListener(AgentModel.Listener listener)
addListener in interface AgentModellistener - A listener that will be called when the set of tasks changes.AgentModel.Listenerpublic void removeListener(AgentModel.Listener listener)
removeListener in interface AgentModellistener - The listener to remove.AgentModel.addListener(Listener)protected void fireTasksUpdated()
Copyright © 2017. All rights reserved.