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

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

            // Initializes some nodes for the client.
            zookeeper.create(ZookeeperStrings.clientPath(clientId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            zookeeper.create(ZookeeperStrings.clientRequestPath(clientId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            zookeeper.create(ZookeeperStrings.clientRequestAckTopPath(clientId),
                             null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);

            final ClientHeartWatcher heartWatcher = new ClientHeartWatcher(master, clientId);
            if (zookeeper.exists(ZookeeperStrings.clientHeartPath(clientId), heartWatcher) != null) {
                heartWatcher.execute();
            }
        }
    }