how to build a notification center?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to build a notification center?

EstebanLM
Hi,
I program a lot with seaside and I use announcements to trigger events while keeping the system decoupled... just like everybody does, I know :)
but well... now I have a pattern in an application who needs the concept of "notification center"... that is: I announce something to the notification center and the event is triggerer to all the listeners... but well... the listeners can be objects with a life cycle different than a seaside session... so I would want to "unregister" that objects, like a WeakAnnouncementSubscription in pharo.

Last time I check, gemstone does not have weak collections... so I would like to know if there is an equivalent of #makeWeak in gemstone, or a way to simulate it...

thanks,
Esteban
Reply | Threaded
Open this post in threaded view
|

Re: how to build a notification center?

Dale Henrichs
Esteban,

There are no weak references for persistent objects in GemStone ... in GemStone 3.0 we have weak references for temporary objects, but all persistent references are strong...

Let's see, back in the old days (when you still thought about garbage collector overhead for performance:) there was the notion of release (opposite of initialze) that was used to nil out the instance variables and break cyclic links (I'm talking about the real old days, when the smalltalk garbage collector didn't clean up objects with cycles...:). You had to know when you were done with an object and weak references were invented because knowing this wasn't always possible, but perhaps when a session is expired, you can arrange to have the session-based listeners unregistered ... presumably similar techniques could be used for the non-session-based guys as well?

Dale

----- Original Message -----
| From: "Esteban Lorenzano" <[hidden email]>
| To: "GemStone Seaside beta discussion" <[hidden email]>
| Sent: Friday, October 21, 2011 5:46:53 AM
| Subject: [GS/SS Beta] how to build a notification center?
|
| Hi,
| I program a lot with seaside and I use announcements to trigger
| events while keeping the system decoupled... just like everybody
| does, I know :)
| but well... now I have a pattern in an application who needs the
| concept of "notification center"... that is: I announce something to
| the notification center and the event is triggerer to all the
| listeners... but well... the listeners can be objects with a life
| cycle different than a seaside session... so I would want to
| "unregister" that objects, like a WeakAnnouncementSubscription in
| pharo.
|
| Last time I check, gemstone does not have weak collections... so I
| would like to know if there is an equivalent of #makeWeak in
| gemstone, or a way to simulate it...
|
| thanks,
| Esteban