aspose file tools*
The moose likes Performance and the fly likes Removing self as a listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Removing self as a listener" Watch "Removing self as a listener" New topic
Author

Removing self as a listener

Kenneth Winn
Greenhorn

Joined: Apr 17, 2000
Posts: 8
What is the best way for an object to remove itself as a
listener of another object. It was added as a listener in
its ctor.
1) in the finalize method of the object?
2) create a new release() method that can be called by a third
object that 'has a' instance of the listening object?
3) other?
Thanks, Ken
Christope Roudet
Greenhorn

Joined: Oct 12, 2000
Posts: 2
You can use WeakReferences in your listener container.
see Tip 79 in on JavaWorld www.javaworld.com/javaworld/javatips/jw-javatip70_p.html
Christophe
 
Consider Paul's rocket mass heater.
 
subject: Removing self as a listener