private void runElection(Set<Integer> partitions) throws Exception {
for (final int partition : partitions) {
// Start leader election.
LOG.info("Start leader election for partition {}", partition);
LeaderElection election =
new LeaderElection(zkClient, String.format("/election/%s/part-%d", name, partition), new ElectionHandler() {
@Override
public void leader() {
leaderPartitions.add(partition);
executor.submit(runHandler);
}