Skip to content

Update AutorecoveringConnection to call ShutdownListeners before reco… #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

doswell
Copy link

@doswell doswell commented Mar 8, 2016

…nnecting.

Re; #135

this.delegate.addShutdownListener(sh);
}
//Add the auto recovering listener to the new delegate.
addAutomaticRecoveryListener();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it non-obvious how the (user-provided) hooks are recovered.

@michaelklishin
Copy link
Contributor

I need to think if I'm 100% happy with this particular implementation of the idea in #135.

@doswell
Copy link
Author

doswell commented Apr 6, 2016

@michaelklishin I'd probably say "no not happy" I've worked on a more clear, and probably more importantly, more consistent implementation of calling the user hooks.
In short there is a ForwardingRecoveryListener" class where user hooks are added into, and which gets fired prior to the recovery starting. It also applies the same sync blocks that the existing delegate listeners use. I just have to get it up to git.
The hooks are also just maintained within AutorecoveringConnection and not added to the underlying delegate.
I'll try and get that up tomorrow

@michaelklishin
Copy link
Contributor

@doswell thank you. One idea I had is simply subclassing ShutdownListener (to produce a marker class) so that we can tell a recovery shutdown hook from others so that they can be filtered out. How does that sound?

Alternatively we could use annotations but then I'm afraid this cannot be backported into stable.

@doswell
Copy link
Author

doswell commented Apr 6, 2016

I didn't see a need for the subclassing in terms of the shutdown listeners just notifying that a disconnect occurs. ie, keeping separate from #132. But I think the idea of subclassing may be useful for #132 in terms of having a RecoveryStartedListener / RecoveryCompletedListener which can register on the RecoveryListeners without needing API changes.

Add RecoverableConnection to allow easier use of API.
@michaelklishin
Copy link
Contributor

Thank you for your time. There are some class responsibility and cosmetic things in this PRs that I disagree with but I think I understand the intent in #135 well enough now. I will look into an alternative PR for #135.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants