The execute method of a console class is supposed to return an exit status. This means you should probably "return 1" when the lock can not be acquired. (You are already printing an error message.)