better path validation

This commit is contained in:
fjy 2013-05-13 15:21:45 -07:00
parent 2c45f33497
commit 5c9df85883
1 changed files with 9 additions and 10 deletions

View File

@ -498,16 +498,15 @@ public class RemoteTaskRunner implements TaskRunner, TaskLogProvider
throw new ISE("Length of raw bytes for task too large[%,d > %,d]", rawBytes.length, config.getMaxNumBytes());
}
String taskPath = JOINER.join(config.getIndexerTaskPath(), theWorker.getHost(), task.getId());
if (cf.checkExists().forPath(taskPath) == null) {
cf.create()
.withMode(CreateMode.EPHEMERAL)
.forPath(
JOINER.join(
config.getIndexerTaskPath(),
theWorker.getHost(),
task.getId()
),
rawBytes
taskPath, rawBytes
);
}
runningTasks.put(task.getId(), pendingTasks.remove(task.getId()));
log.info("Task %s switched from pending to running", task.getId());