From: Mike Bethany Date: 2011-06-26T09:22:12+09:00 Subject: Single Responsibility Question --005045016d9efd2ed204a6926c79 Content-Type: text/plain; charset=ISO-8859-1 I'm trying to figure out who's responsible for a resource. Here's the situation: An object, the listener, tells another object, the watched, to tell it when something happens. When the event happens the watched object creates a thread to call the listener's callback method. My question is who's responsible for the thread? The watched object created it but only to make sure the listener's method doesn't block any other methods the watched object needs to call in any other listeners. Right now the thread goes out of scope almost immediately in the watched object (it's created in a loop) so the listener is the only thing holding a reference open to that thread. This seems like the right way to do it but I'm worried about run away threads. Or if the watched object should even be worried about it. Typing this out makes it seem pretty clear to me that even though the watched object created the thread the listener is responsible for it. The watched object should not be responsible for the listener's code. Right? I want to make sure I'm not just convincing myself though, that I forgotten something I should have thought of. If anyone has any input on this please let me know, thanks. Mike --005045016d9efd2ed204a6926c79--