-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refactoring client deregister listener behaviour #17646
Conversation
We were returning `false` as the return value if we were not successuflly deregister from any member and events was able to continue to delivered for non deregistered members. We have changed the behaviour so that we return `true` if a registration is found always. And after this point, user will not get any event. We will cleanup all the local handlers right away to make sure of that. Secondly we have set invocation timeout as infinite so that the deregistartion from a connection is retried as long as the connection is there until it is succesful. I have left logging the exception when there is an unexpected failure. We do not expect any but this is to be able to diagnose if the unexpected happens.
54da2f0
to
b7169be
Compare
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.
LGTM. Left some nits.
...ast/src/main/java/com/hazelcast/client/impl/spi/impl/listener/ClientListenerServiceImpl.java
Outdated
Show resolved
Hide resolved
...ast/src/main/java/com/hazelcast/client/impl/spi/impl/listener/ClientListenerServiceImpl.java
Outdated
Show resolved
Hide resolved
...ast/src/main/java/com/hazelcast/client/impl/spi/impl/listener/ClientListenerServiceImpl.java
Show resolved
Hide resolved
...ast/src/main/java/com/hazelcast/client/impl/spi/impl/listener/ClientListenerServiceImpl.java
Show resolved
Hide resolved
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.
is it possible to write a test for the unhappy path?
@ihsandemir We have tests for failure scenarios like |
Listener service was waiting for the result of the future in a blocking way and, returning the registration id string. This is not in line with our other APIs in which we provide non-blocking API. Also, the slight behaviour change applied to Java client is ported to Python client. hazelcast/hazelcast#17646
Listener service was waiting for the result of the future in a blocking way and, returning the registration id string. This is not in line with our other APIs in which we provide non-blocking API. Also, the slight behaviour change applied to Java client is ported to Python client. hazelcast/hazelcast#17646
* Make ListenerService return Future Listener service was waiting for the result of the future in a blocking way and, returning the registration id string. This is not in line with our other APIs in which we provide non-blocking API. Also, the slight behaviour change applied to Java client is ported to Python client. hazelcast/hazelcast#17646 * add missing .blocking() calls
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix hazelcast#17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes hazelcast#19269
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix #17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes #19269
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix hazelcast#17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes hazelcast#19269 (cherry picked from commit 1a5baf9)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix hazelcast#17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes hazelcast#19269 (cherry picked from commit 1a5baf9) (cherry picked from commit 95d9d4b)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix hazelcast#17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes hazelcast#19269 (cherry picked from commit 1a5baf9) (cherry picked from commit 95d9d4b)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix #17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes #19269 (cherry picked from commit 1a5baf9)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix #17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes #19269 (cherry picked from commit 1a5baf9) (cherry picked from commit 95d9d4b)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix #17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes #19269 (cherry picked from commit 1a5baf9) (cherry picked from commit 95d9d4b)
It turns out that there are some services relying on the removal of a listener on the member when listener is removed from the client. Example: Cache listener count is kept per proxy. When listener is removed, we decrease the listener count from the cache context. Since this operation is async, it could be the case that the cache is destroyed from the calling thread before we decrement the value. In such cases, we decrement but the incremented value is lost. Therefore, we can end up with negative values. The listener derregistration invoctions are not waited. It was sync but we have changed the behavior as a side affect during this fix hazelcast#17646 We may solve this only for CacheListener but there could be more services relying on sync listener removal. Therefore, as a fix, we wait for invocation answer from the remote. fixes hazelcast#19269
We were returning
false
as the return value if we were notsuccessuflly deregister from any member and events was able to
continue to delivered for non deregistered members.
We have changed the behaviour so that we return
true
if aregistration is found always. And after this point, user will not
get any event. We will cleanup all the local handlers right away
to make sure of that.
Secondly we have set invocation timeout as infinite so that the
deregistartion from a connection is retried as long as the
connection is there until it is succesful.
I have left logging the exception when there is an unexpected
failure. We do not expect any but this is to be able to diagnose
if the unexpected happens.