You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Broadcasters are created with a String id everything seems to work normal, but when using arbitrary objects (UUID in our case) some of the lifecycle methods and DefaultBroadcasterFactory.store is not handled properly.
How to reproduce:
We're using AtmosphereHandler, so example uses that.
In GET part this code fails when last resource disconnects and then reconnects:
Internally in Atmosphere some lookups are done by broadcaster name rather than Id and either broadcaster isn't cleaned up correctly (Atmosphere 2.3.1) or 2 copies are kept in DefaultBroadcasterFactory.store, one keyed on String representation and the other on UUID object (Atmosphere 2.2.1).
When using String id following is logged when last resource disconnects:
When using UUID no message is logged and broadcatser stays in factory.
It seems to me that the whole issue boils down to the fact broadcaster name is used internally for lookups and String.toString() returns different object that UUID.toString() and ConcurrentHashMap inside DefaultBroadcasterFactory.store treats them as different objects.
Behaviour change between 2.2.1 and 2.3.1 seems to be due to fixes for #1878
The text was updated successfully, but these errors were encountered:
For any non-string ID the first lookup will fail and the following lines will try to use name rather than ID
which is also not correct (I think).
To fix this I think the signature of setID would need to change to
publicsynchronizedvoidsetID(Objectid) {
and any other related bits of code would need to be adjusted. I don't have enough undertanding of how framework works to change this, but happy to help with some coding.
I've crated a simple example that allows to replicate the issue, I've published it on GitHub https://github.com/silvpol/atmosphere-issue-1988.
I'm not sure what your dev setup is like, but if you use IntelliJ you could just import as Gradle project. If you just want a quick play all you need is git clone and and run from commandline, all is in README.
When Broadcasters are created with a String id everything seems to work normal, but when using arbitrary objects (UUID in our case) some of the lifecycle methods and DefaultBroadcasterFactory.store is not handled properly.
How to reproduce:
We're using AtmosphereHandler, so example uses that.
In GET part this code fails when last resource disconnects and then reconnects:
But this code works fine:
Internally in Atmosphere some lookups are done by broadcaster name rather than Id and either broadcaster isn't cleaned up correctly (Atmosphere 2.3.1) or 2 copies are kept in DefaultBroadcasterFactory.store, one keyed on String representation and the other on UUID object (Atmosphere 2.2.1).
When using String id following is logged when last resource disconnects:
When using UUID no message is logged and broadcatser stays in factory.
It seems to me that the whole issue boils down to the fact broadcaster name is used internally for lookups and String.toString() returns different object that UUID.toString() and ConcurrentHashMap inside DefaultBroadcasterFactory.store treats them as different objects.
Behaviour change between 2.2.1 and 2.3.1 seems to be due to fixes for #1878
The text was updated successfully, but these errors were encountered: