I have a web application that generates a large number of workflow threads in response to requests to a specific endpoint. To provide greater transparency regarding the status of workers, I added an event bus to which workers can send events. Events are transferred to the map, tracking the status of each employee over time. Periodically, the card is removed and moved to a more permanent place, where snapshots are associated with the request through the request token.
This, of course, attracts every request of its own event bus. Then each request receives its own map. When the request completes and the final snapshot is pushed, the map and the event bus go out of scope and therefore garbage collects.
At least that's the theory. But some people I spoke with suggested that the event bus would not be built even if the only explicit link to it was beyond the scope because it manages to create other links for itself during installation. I would really appreciate the more experienced point of view of a Java / Guava practitioner.
source
share