Details
Description
Current code is:
while (true) { TezAppMasterStatus status = getAppMasterStatus(); if (status.equals(TezAppMasterStatus.SHUTDOWN)) { throw new SessionNotRunning("TezSession has already shutdown"); } if (status.equals(TezAppMasterStatus.READY)) { return; } try { Thread.sleep(SLEEP_FOR_READY); } catch (InterruptedException e) { LOG.info("Sleep interrupted", e); continue; } }
That way you never can stop the wait call since all interrupts are caught and the wait logic just happily proceeds.
Suggestion: InterruptedException could be part of the method signature so the caller can handle this in a way which is adequate to the context.
Nice read on handling interrupts: http://www.ibm.com/developerworks/library/j-jtp05236/