We're updating the issue view to help you get more done. 

AbstractSharedSessionContract#getInterceptor should not call checkTransactionSynchStatus()

Description

From Guillaume Smet on hibernate-dev mailing list:

"In 5.2 SessionImpl, we now use getInterceptor() instead of accessing the
interceptor field directly because the field has been moved to
AbstractSharedSessionContract.

See for instance the change made here in afterTransactionCompletion():
https://github.com/hibernate/hibernate-orm/blame/master/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java#L2443

I think this is an issue as getInterceptor() is not a simple getter but is:

1 2 3 4 5 6 7 8 9 10 @Override public Interceptor getInterceptor() { checkTransactionSynchStatus(); return interceptor; } protected void checkTransactionSynchStatus() { pulseTransactionCoordinator(); delayedAfterCompletion(); }

Thus calling the pulse() method of the TransactionCoordinator, triggering
an implicit join whereas we're in the afterTransactionCompletion() phase.

This is an issue for us as the pulse() method of our TransactionCoordinator
creates Neo4j transactions so when the getInterceptor() method is called in
afterTransactionCompletion(), we create a new Neo4j transaction.

So 2 questions:

  • should we really call checkTransactionSynchStatus(); in getInterceptor()?
    If feels a bit weird.

  • if so, I think we should have a true protected getter (interceptor()
    following Steve's convention?) to avoid SessionImpl "pulsing" the
    transaction coordinator when accessing the interceptor."

Environment

None

Status

Assignee

Gail Badner

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major