Message-ID: From: "kneeraj (@kneeraj)" To: "pgjdbc/pgjdbc" Date: Fri, 08 Nov 2024 04:56:14 +0000 Subject: Re: [pgjdbc/pgjdbc] PR #3409: feat: add support for plugging in custom HostChooser In-Reply-To: References: List-Id: X-GitHub-Author-Login: kneeraj X-GitHub-Comment-Id: 2463766029 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 3409 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/3409#issuecomment-2463766029 Content-Type: text/plain; charset=utf-8 > Thank you for the draft, and sorry for the delay with the review. In general, it looks like a good start. > > However, it looks like `GlobalHostStatusTracker` duplicates the logic of `registerFailure` and `registerSuccess`, so I would like to make the current host chooser a plugin, so should not rely on `GlobalHostStatusTracker.reportHostStatus` from `ConnectionFactoryImpl`. In other words, currently the PR suggests a set of new APIs, however, it is not clear if the old balancer could be implemented as an external plugin that uses the new APIs only. > > What do you think? Thank you for starting the review @vlsi . I see your point about duplicating the logic. If I understand correctly the current hostchoosers i.e SingleHostChooser and MultiHostChooser should track the host status through `register*` methods only and the GlobalHostStatusTracker's majority logic should go inside these two inbuilt HostChoosers. Let me know if I have understood correctly and if I should try to refactor accordingly.