The Mechanism
Lock lock = null; boolean lockTimedOut = false; try { // XXX: Should not hardcode the timeout. lock = adminLock.getLock(command, 30, "asadmin"); ... } catch (AdminCommandLockTimeoutException ex) { lockTimedOut = true; ... logger.warning(logMsg); report.setMessage(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } finally { // command is done, release the lock if (lock != null && lockTimedOut == false) lock.unlock(); } |
ouch: ./asadmin list-commands remote failure: The command was blocked from executing. The domain is either suspended or another command required exclusive access to the domain. The domain was suspend or locked on Tue, 14 Sep 2010 11:05:33 PDT. Command list-commands failed.