Порядок выполнения ControllerRunner - PullRequest
0 голосов
/ 30 августа 2018

это исходный код activeweb2.0

protected void run(Route route) throws Exception {
    Configuration.injectFilters(); //no worries, will execute once, as filters have a life span of the app
    try {
        try { //nested try , a bit ugly, but we need to ensure filter.after() methods are executed.
            filterBefore(route);
            executeController(route);
        } finally {
            filterAfter(route);
        }
    }
    catch(ActionNotFoundException e){
        throw e;
    }
    catch (RuntimeException e) {
        RequestContext.setControllerResponse(null);//must blow away, as this response is not valid anymore.

        if (exceptionHandled(e, route)) {
            LOGGER.debug("A filter has called render(..) method, proceeding to render it...");
            renderResponse(route);//a filter has created an instance of a controller response, need to render it.
        }else{
            throw e;//if exception was not handled by filter, re-throw
        }
    }
}

если в ExecuController произойдет исключение DBException, соединение с базой данных будет закрыто. Тогда rollbackTransaction не будет выполнено. Поэтому в базе данных будет некоторый результат ошибки

1 Ответ

0 голосов
/ 30 августа 2018

Вы правы. Эта проблема была зарегистрирована и исправлена ​​в: https://github.com/javalite/activeweb/issues/389.

Пожалуйста, обновитесь до версии 2.2 , чтобы получить правильное поведение.

...