I think having references to or from pages is a bad idea in wicket. We serialize pages so if pages would have listeners then the are also serialized. If others reference pages then after serialization/deserialization they point to the wrong instance.
Way better is pure pull support. Components know where thet get its data from and they pull it on render and/or on a visitor that checks all components if they are changed. (and if changes add them to ajax request target) On 24/01/2009, [email protected] <[email protected]> wrote: > Use weakreferences to hold onto pages instead. > > -igor > > On 1/24/09, Frank van Lankvelt <[email protected]> wrote: >> I'm trying to get a page to observe a business object that can send >> events. The changes don't warrant a full page refresh, so I want to >> update only those parts of the page that have changed as a result of the >> events. >> >> I've seen wicketstuff-push, where a similar kind of observation is >> present in the Application. From what I could see, the chat example has >> the drawback that there is no *unregistering* of listeners when pages >> are disposed of, so there is a memory leak. (all pages will be kept in >> memory, being referenced directly by the service in the application) >> >> There doesn't seem to be any support for cleaning up pages, e.g. in the >> form of listeners that an application could register with the session >> store. An alternative seems to be to implement my own PageMap, but I'm >> reluctant to do that as there will be a lot of copy/paste involved and >> the existing PageMap implementations rely on the fact that they're in >> the same package as Session. A different alternative is to store all >> the listeners in a registry and use a separate thread to remove any >> listeners that are associated with pages that are no longer stored. Is >> there a better way? >> >> Thanks, Frank >> >> >> [email protected] www.onehippo.com >> Amsterdam Hippo B.V. Oosteinde 11 1017 WT Amsterdam >> +31(0)20-5224466 >> San Francisco Hippo USA Inc. 101 H Street, suite Q Petaluma CA >> 94952-5100 +1-877-41-HIPPO >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
