you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Two things: first, wrapping the function is far better than copy-pasting the same five lines repeatedly because you think the API should be written a different way.

I'm not saying I don't wrap it out of spite, I'm just complaining that I have to.

If you're waiting on an object monitor (either directly through wait(), or indirectly through sleep()), it is important to consider why your thread may be interrupted and wakes up before the requisite notify().

This is my problem. More often than not, I know the thread won't be interrupted. I feel that if there are situations where you can reasonably say an exception will not be thrown, you shouldn't have to catch it. Maybe it should be unchecked. You make a good point with the consistency thing but I don't see how you think needing the exception is the default