Synchronization occurrence marker

Eclipse has this wonderful feature called Dynamically marking occurrences (along with “Highlight method exit points” and “Mark locations of thrown exceptions”). (No, I don’t care if IDE X has the same features.) What if we took this to the next level?

The idea is to highlight an object and select “Mark Synchronizations” (or something suitable). This would show all methods, statement, etc that are synchronized on the object. The outline and hierarchy views would also indicate other classes and methods that synchronize on the object. This would allow you to know if some other object was synchronizing on the same object. Being able to see all code that synchronizes on an object would greatly simplify writing and maintaining threadsafe code.

One could extend this idea even further by allowing the marked occurrences to be sticky. Select object one and mark its synchronization occurrences then select object two and mark its synchronization occurrences in a different color. The intersection of the two sets could be highlighted in a third (combined) color to indicate points of possible deadlock.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s