Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No commit/rollback on Error #5

Open
witoldsz opened this issue Jun 21, 2018 · 0 comments
Open

No commit/rollback on Error #5

witoldsz opened this issue Jun 21, 2018 · 0 comments
Labels

Comments

@witoldsz
Copy link
Owner

The ThreadLocalTxManager has this method:

    @Override
    public <T> T txUnwrappedResult(UnitOfWorkCall<T> unit) throws Exception {
        begin();
        try {
            T result = unit.call();
            commit();
            return result;
        } catch (Exception e) {
            rollback();
            throw e;
        }
    }

Trouble is when unit throws an Error (for example: JUnit test with fail). The connection will not be released, there will be no commit or rollback.

In my very case, next test after the one which was calling fail was hanging forever because of this.

I think we need a finally clause here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant