class CommandQueue {

    public void execute(final CclCommandTerminal cclTerminal) {
        if (isEmpty())
            return;

        try {
            for (final AbstractCclCommand command : getOnCclStartCommands())
                command.run(cclTerminal);

            for (final AbstractCclCommand command : getInCclSessionCommands())
                command.run(cclTerminal);
        } finally {
            /*
             * Run end-of-session commands, such as cleanup commands, even if the other commands fail
             */
            for (final AbstractCclCommand command : getOnCclCloseCommands())
                command.run(cclTerminal);
        }
    }

}