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

https://github.com/atomikos/transactions-essentials/issues/215 #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,23 @@ boolean isInTransaction ( CompositeTransaction tx )
{
return ct.isSameTransaction ( tx );
}

// Fix by Martin Aubele. Without this fix we need one new connection per call when no 2PC is used (no propagation header).
// this leads to a connection shortage if the service is called multiple times.

boolean isInactiveInTransaction ( CompositeTransaction tx )
{
// code is separated in special if statements to allow setting a breakpoint
if (ct.getCompositeCoordinator() != tx.getCompositeCoordinator())
return false;
if (ct.isRoot() != tx.isRoot())
return false;

// we need to check if the branch is active because of this scenario:
// ServiceA on Server 1 uses a jdbc connection and then calls ServiceB on Server 2. ServiceB calls
// back to Service A2 on Server 1. In this case, we cannot use the still ACTIVE jdbc connection.
if (branch.isActive())
return false;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ public boolean isActiveInTransaction ( CompositeTransaction tx )
public boolean isInactiveInTransaction( CompositeTransaction tx )
{
boolean ret = false;
if (closed) { // see case 159940: if not closed then be pessimistic and assume still active in terms of recycling
//if (closed) { // see case 159940: if not closed then be pessimistic and assume still active in terms of recycling
if ( currentContext != null && tx != null ) ret = currentContext.isInactiveInTransaction ( tx );
}
//}
return ret;
}
}