Rohith Sharma K S Thanks for the review.
And method reEstablishSession() can be reused rather duplicating same logic over embedded electors. Instead of overriding createConnection() method, reEstablishSession() method can be used in ActiveStandByElector constructor.I'd prefer to make change in hadoop-common rather in embedded elector service.
This will affect the HDFS ZKFS, and they do not want the retry on initialization.
While initializing Elector service createConnection will retry as per configured value i.e maxRetryNum say 10. But if session is closed and reestablished then number of retry count will be maxRetryNum * maxRetryNum i.e 10*10=100 times.
I am not sure if I understand correctly. If we set the maxRetryNum as 10, and zk connect itself would do some retries (10times), the total is 10*10.