public class TaskHistoryWriter extends com.google.common.util.concurrent.AbstractIdleService implements Runnable
Just some breadcrumbs so next time, the person that follows me can understand why things are the way they are.
Theory of operation: 1. saveHistoryItem should never block for any significant amount of time. Specifically, it should not block on ZK being in any particular state, and ideally not while a file write is occurring, as the file may get large if ZK has been away for a long time. 2. We limit each job to max 30 events in memory (and in ZK for that matter) 3. Maximum of 600 total events, so as not to consume all available memory.
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_NUMBER_STATUS_EVENTS_TO_RETAIN |
| Constructor and Description |
|---|
TaskHistoryWriter(String hostname,
ZooKeeperClient client,
Path backingFile) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty() |
void |
run() |
void |
saveHistoryItem(com.spotify.helios.common.descriptors.TaskStatus status) |
void |
saveHistoryItem(com.spotify.helios.common.descriptors.TaskStatus status,
long timestamp) |
protected void |
shutDown() |
protected void |
startUp() |
public static final int MAX_NUMBER_STATUS_EVENTS_TO_RETAIN
public TaskHistoryWriter(String hostname, ZooKeeperClient client, Path backingFile) 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 void saveHistoryItem(com.spotify.helios.common.descriptors.TaskStatus status) throws InterruptedException
InterruptedExceptionpublic void saveHistoryItem(com.spotify.helios.common.descriptors.TaskStatus status, long timestamp) throws InterruptedException
InterruptedExceptionpublic boolean isEmpty()
Copyright © 2017. All rights reserved.