better logging

This commit is contained in:
Fangjin Yang 2013-03-01 19:25:25 -08:00
parent 49e61d00fd
commit cbe0555d00
1 changed files with 6 additions and 3 deletions

View File

@ -408,9 +408,12 @@ public class RemoteTaskRunner implements TaskRunner
public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception
{
try {
if (event.getData() != null) {
log.info("Event[%s]: %s", event.getType(), event.getData().getPath());
}
if (event.getType().equals(PathChildrenCacheEvent.Type.CHILD_ADDED) ||
event.getType().equals(PathChildrenCacheEvent.Type.CHILD_UPDATED)) {
log.info("Event[%s]: %s", event.getType(), event.getData().getPath());
final String taskId = ZKPaths.getNodeFromPath(event.getData().getPath());
final TaskStatus taskStatus;
@ -471,8 +474,8 @@ public class RemoteTaskRunner implements TaskRunner
cleanup(worker.getHost(), taskId);
runPendingTasks();
}
} else if (event.getType().equals(PathChildrenCacheEvent.Type.CHILD_REMOVED)) {
log.info("Event[%s]: %s", event.getType(), event.getData().getPath());
} else if (event.getType().equals(PathChildrenCacheEvent.Type.CHILD_REMOVED)
|| event.getType().equals(PathChildrenCacheEvent.Type.CONNECTION_LOST)) {
final String taskId = ZKPaths.getNodeFromPath(event.getData().getPath());
if (runningTasks.containsKey(taskId)) {
log.info("Task %s just disappeared!", taskId);