Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[zk: 127.0.0.1:2181(CONNECTED) 0] create /assign ""
Created /assign
[zk: 127.0.0.1:2181(CONNECTED) 1] create /tasks ""
Created /tasks
[zk: 127.0.0.1:2181(CONNECTED) 2] ls /
[assign, tasks, zookeeper]

Extra credit (testing)

The code you have written works and is dynamic, but doesn't handle every error correctly. Check what happens when errors occur: change the TaskQueueWorker.java to use FailFirstZooKeeper.java and see what happens. (When submitting multiple tasks you will find that one gets assigned to a phantom worker.) How do you fix it?