How do listeners work in java, where do they live, what is memory management like?

How do listeners work in the JVM? Where do they live? What keeps track of them? I tried the search but could not find the links

+4
source share
1 answer

From Oracle Introduction to Event Listeners :

The event model that you saw in its simplest in the previous example is quite powerful and flexible. Any number of event listener objects can listen to all kinds of events from any number of event source objects. For example, a program can create one listener for each event source. Or a program can have one listener for all events from all sources. A program may even have more than one listener for one type of event from one event source.

enter image description here

Several listeners can register to notify of events of a certain type from a specific source. In addition, the same listener can listen to notifications from different objects.

+3
source

All Articles