Why do most Xbeans only support a single listener?
Created May 7, 2012
The reason for this is if an Xbean has multiple listeners for its resulting document, the document can either be a shared, concurrently accessed document or it can be copied for each listener. The appropriate behavior is usually not dictated by the source Xbean but by the application itself. For example, if the multiple listeners all read the document without modifying it, they can easily share the resulting document. Only the application knows that the Xbeans were configured this way.
To make this explicit in the chaining of Xbeans into an application, the parallelizer Xbean supports multiple listeners. It contains properties to indicate whether the document should be concurrently shared among the multiple listeners or whether the document should be copied. In case the document is concurrently shared, the synchronizer Xbean can be used to wait until all concurrent Xbeans are done.