@Override
    public void execute() throws InterruptedException, KeeperException {
        List<String> children = zookeeper.getChildren(ZookeeperStrings.workerRegistrationPath(), this);
        for (String child : children) {
            final int workerId = Integer.valueOf(child);

            try {
                zookeeper.delete(ZookeeperStrings.workerRegistrationPath() + "/" + child, -1);
            } catch (KeeperException ke) {
                // The worker leaved immediately. Ignore it.
                continue;
            }

            zookeeper.create(ZookeeperStrings.workerPath(workerId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            zookeeper.create(ZookeeperStrings.workerRequestPath(workerId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            zookeeper.create(ZookeeperStrings.workerOrderPath(workerId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            final WorkerHeatWatcher heartWatcher = new WorkerHeatWatcher(master, workerId);
            if (zookeeper.exists(ZookeeperStrings.workerHeartPath(workerId), heartWatcher) != null) {
                heartWatcher.execute();
            }
        }
    }