Help me find article on Multi-threading and Event Handling in Java
- by JDR
I once read an article on how to properly write event handlers for multi-threading in Java, but I can't for the life of me find it anymore. It described the pitfalls and potentials for deadlocks that can occur when firing events (not Swing events mind you, but general events like model update notifications). To clarify, the situation would be as such:
// let's say this is code from an MVC model somewhere
public void setSomeProperty(String myProperty){
if(!this.myProperty.equals(myProperty)){
this.myProperty = myProperty;
fireMyPropertyChangedEvent(...);
}
}
The article described how passing control to arbitrary external listener code was a potential cause for deadlock. I now find myself in a situation where I need to fire such events in a multithreaded environment and I would very much like to read the article again to see what it has to say before I continue.
Does anyone know the article I'm referring to? I believe it came as a (fairly short) PDF. It started off with an initial naive implementation and incrementally pointed out flaws and improved upon it. It ended with a sort of final proper-way-to-fire-multithreaded-events.
I've searched endlessly in my browse history and on google, but all I could find were endless amounts topics on Swing event dispatch threads.
Thank you.