-
Notifications
You must be signed in to change notification settings - Fork 58
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
Improve the event processors #374
Conversation
7eed6ad
to
c73f675
Compare
...ams/src/main/java/org/eclipse/sirius/web/spring/collaborative/diagrams/DiagramEventFlux.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/eclipse/sirius/web/spring/collaborative/forms/PropertiesEventProcessor.java
Show resolved
Hide resolved
...in/java/org/eclipse/sirius/web/spring/collaborative/representations/SubscriptionManager.java
Outdated
Show resolved
Hide resolved
.../java/org/eclipse/sirius/web/spring/collaborative/projects/EditingContextEventProcessor.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/sirius/web/spring/collaborative/projects/RepresentationEventProcessorEntry.java
Show resolved
Hide resolved
...g/eclipse/sirius/web/spring/collaborative/projects/EditingContextEventProcessorRegistry.java
Outdated
Show resolved
Hide resolved
...g/eclipse/sirius/web/spring/collaborative/projects/EditingContextEventProcessorRegistry.java
Outdated
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.
See comments.
var subscriptionCount = this.username2subscriptionCount.getOrDefault(username, new AtomicInteger()); | ||
subscriptionCount.getAndIncrement(); | ||
|
||
this.username2subscriptionCount.put(username, subscriptionCount); |
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.
Actually re-reading this I think this is not thread-safe either. From the initial state, two threads can enter add
, both calling getOrDefault
will return 2 AtomicInteger
, increment them both to 1, and both but 1
into the map. The last one to call put
will "win" but we still end with 1
for this username.
I think we should use ConcurrentMap.computeIfAbsent()
instead of getOrDefault
and then put
to atomically get/initialize the AtomicInteger
and then atomically mutate it.
Same logic for remove
.
Bug: #367 Signed-off-by: Stéphane Bégaudeau <[email protected]>
Bug: #368 Signed-off-by: Stéphane Bégaudeau <[email protected]>
Signed-off-by: Stéphane Bégaudeau <[email protected]>
This first commit will make sure that the disposal of the representation event processors do not rely on SubscriptionDescription anymore. Thanks to this commit it will be possible to remove the SubscriptionDescription during the retrieval of the payload flux and then to update the lifecycle of the APIs used to disposed the representations event processors. Bug: #357 Signed-off-by: Stéphane Bégaudeau <[email protected]>
Bug: #357 Signed-off-by: Stéphane Bégaudeau <[email protected]>
…tion event processors Bug: #357 Signed-off-by: Stéphane Bégaudeau <[email protected]>
Signed-off-by: Stéphane Bégaudeau <[email protected]>
Bug: #268 Signed-off-by: Stéphane Bégaudeau <[email protected]>
- Remove useless code in the dipose since no one is present anymore to receive complete events - Use SLF4J native formatting capabilities instead of MessageFormat - Improve the thread safety of the subscription manager Signed-off-by: Stéphane Bégaudeau <[email protected]>
Bug: #377 Signed-off-by: Stéphane Bégaudeau <[email protected]>
Signed-off-by: Stéphane Bégaudeau <[email protected]>
2c22f4f
to
0239300
Compare
No description provided.