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
Throw ClientNotActiveException instead of generic HazelcastException #13525
Merged
sancar
merged 1 commit into
hazelcast:maintenance-3.x
from
sancar:fix/exceptionType/maint3.x
Sep 25, 2018
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HazelcastClientNotActiveException
does not extendHazelcastException
. This is a behaviour change then. Is it possible some user was catching aHazelcastException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HazelcastException is retryable in client invocation system. When hazelcast exception is thrown from here, invocation system catches that throws as ClientNotActiveException to user.
https://github.com/hazelcast/hazelcast/blob/master/hazelcast-client/src/main/java/com/hazelcast/client/spi/impl/ClientInvocation.java#L209
But there is an unncessary wrapping there. It results as a ClientNotActiveException which has HazelcastException("client is shutting down") as cause.
There are a couple, usages of connection manager directly like txns which should handle HazelcastException themselves. In that case, we also convert it to ClientNotActiveException
So in almost all of the cases, user get ClientNotActiveException. Even if there were edge cases that user gets HazelcastException before, I would like to consider them as bug and fix it, rather then thinking this as behaviour change.
How does that sound ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can admit I'm a bit lost here. It's your call. I'm just thinking if this could affect some user code like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also my worry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well as mentioned above, if we are not throwing
ClientNotActiveException
where we supposed to throw it is a bug.And depending on when the clients shutdown we could be throwing
ClientNotActiveException
orHazelcastException
. That means, user should already prepared forClientNotActiveException
. This fix is to correct one more place that we are throwingHazelcastException
instead ofClientNotActiveException
.That is why, I see no problem with backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible (or cause any side affects) if IllegalStateException (base class of HazelcastClientNotActiveException) derive from HazelcastException instead of RuntimeException?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IllegalStateException can't derive from HazelcastException, because it is from java.lang library. It is not our class.