Skip to content

Commit

Permalink
Propagate JNDI context if none exists
Browse files Browse the repository at this point in the history
Passes Concurrency TCK in appserver/tests/tck/concurrency.
Passes tests in appserver/tests/admin and application.
Signed-off-by:Ondro Mihalyi <mihalyi@omnifish.ee>
  • Loading branch information
OndroMih committed Aug 14, 2023
1 parent f1665c1 commit fdcd7ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Expand Up @@ -149,11 +149,18 @@ public ContextHandle setup(ContextHandle contextHandle) {
resetSecurityContext = SecurityContext.getCurrent();
SecurityContext.setCurrent(invocationCtx.getSecurityContext());
}
if (invocation != null) {
// Each invocation needs a ResourceTableKey that returns a unique hashCode for TransactionManager
invocation.setResourceTableKey(new PairKey(invocation.getInstance(), Thread.currentThread()));
invocationManager.preInvoke(invocation);

if (setup.isUnchanged(JNDI) || (!setup.isPropagated(JNDI) && !setup.isClear(JNDI))) {
ComponentInvocation currentInvocation = invocationManager.getCurrentInvocation();
if (currentInvocation != null) {
invocation = currentInvocation;
}
}

// Each invocation needs a ResourceTableKey that returns a unique hashCode for TransactionManager
invocation.setResourceTableKey(new PairKey(invocation.getInstance(), Thread.currentThread()));
invocationManager.preInvoke(invocation);

// Ensure that there is no existing transaction in the current thread
if (transactionManager != null && setup.isClear(StandardContextType.WorkArea)) {
transactionManager.clearThreadTx();
Expand Down Expand Up @@ -237,10 +244,7 @@ private ComponentInvocation getSavedInvocation() {
if (setup.isClear(JNDI)) {
return new ComponentInvocation();
}
if (setup.isPropagated(JNDI)) {
return cloneComponentInvocation(currentInvocation);
}
return null;
return cloneComponentInvocation(currentInvocation);
}


Expand Down
2 changes: 1 addition & 1 deletion appserver/tests/tck/concurrency/pom.xml
Expand Up @@ -53,7 +53,7 @@
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.7.0.Alpha13</version>
<version>1.7.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down

0 comments on commit fdcd7ca

Please sign in to comment.