Maybe it's worth amplifying Dave's point: the lock is released as soon as the
thread leaves the block, regardless of
how it leaves it. Whether it leaves it because the thread moves beyond the last curly brace, or because of a return (as in your code), a break, continue, or an exception, the lock is released.
- Peter