KAFKA-1185 Improve leader elector module to have a resign API; reviewed by Guozhang Wang and Jun Rao
Rebased from trunk to resolve conflicts between KAFKA-1185 and KAFKA-930