Defend with Timeouts You cannot prove that your code has no deadlocks in it, but you can make sure that no deadlock lasts forever. Avoid Java’s infinite wait method; use the version that takes a timeout parameter. Always use Timeouts, even if it means you have to catch InterruptedException

