From: Dave Thomas Date: 2001-12-05T00:05:00+09:00 Subject: [ruby-talk:27451] Re: Checking objects in a drb net Massimiliano Mirra writes: > I'm trying to make my app (an ICQ LAN-only clone) a bit real-world > compliant, and must handle the case where a client is shutted down > without first calling its logout method first (because of a kill > signal, of a crash, or whatever). In other words the server has to > handle refs to remote objects that stopped existing without telling > it. You could rescue the exception and remove the client. Here's a trivial module based on the standard Observable module that does just that: module DRbObservable def add_observer(observer) @observer_peers ||= [] unless observer.respond_to? :update raise NameError, "observer needs to respond to `update'" end @observer_peers.push observer end def delete_observer(observer) @observer_peers.delete observer if defined? @observer_peers end def notify_observers(*arg) return unless defined? @observer_peers for i in @observer_peers.dup begin i.update(*arg) rescue delete_observer(i) end end end end Regards Dave