-
Notifications
You must be signed in to change notification settings - Fork 201
[WIP] tck multithread failures #673
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,8 @@ | |
| package org.jboss.arquillian.container.test.impl.client; | ||
|
|
||
| import java.lang.reflect.Method; | ||
| import java.util.Objects; | ||
|
|
||
| import org.jboss.arquillian.container.spi.Container; | ||
| import org.jboss.arquillian.container.spi.ContainerRegistry; | ||
| import org.jboss.arquillian.container.spi.client.deployment.Deployment; | ||
|
|
@@ -136,12 +138,11 @@ private void createContext(EventContext<? extends TestEvent> context) { | |
| * TODO: This should not rely on direct Reflection, but rather access the metadata through some | ||
| * common metadata layer. | ||
| */ | ||
|
|
||
| private void lookup(Method method, ResultCallback callback) { | ||
| DeploymentTargetDescription deploymentTarget = locateDeployment(method); | ||
|
|
||
| ContainerRegistry containerRegistry = this.containerRegistry.get(); | ||
| DeploymentScenario deploymentScenario = this.deploymentScenario.get(); | ||
| DeploymentScenario deploymentScenario = Objects.requireNonNull(this.deploymentScenario.get(), "deploymentScenario cannot be null"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what we gain here.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not much I was using this as a marker as the main issue I have with parallel tests is the NPE here
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay. I would think then that there is likely an issue activating the context in a multi-threaded environment. That's typically when |
||
|
|
||
| Deployment deployment = deploymentScenario.deployment(deploymentTarget); | ||
| if (deployment == null && deploymentTarget != DeploymentTargetDescription.DEFAULT) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,9 @@ | |
| */ | ||
| package org.jboss.arquillian.core.impl; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.concurrent.CopyOnWriteArrayList; | ||
|
|
||
| import org.jboss.arquillian.core.spi.EventContext; | ||
| import org.jboss.arquillian.core.spi.InvocationException; | ||
| import org.jboss.arquillian.core.spi.NonManagedObserver; | ||
|
|
@@ -32,8 +33,8 @@ | |
| */ | ||
| public class EventContextImpl<T> implements EventContext<T> { | ||
| private ManagerImpl manager; | ||
| private List<ObserverMethod> interceptors; | ||
| private List<ObserverMethod> observers; | ||
| private List<ObserverMethod> interceptors = new CopyOnWriteArrayList<>(); | ||
| private List<ObserverMethod> observers = new CopyOnWriteArrayList<>(); | ||
| private NonManagedObserver<T> nonManagedObserver; | ||
| private RuntimeLogger runtimeLogger; | ||
|
|
||
|
|
@@ -70,8 +71,12 @@ public EventContextImpl(ManagerImpl manager, List<ObserverMethod> interceptors, | |
| Validate.notNull(runtimeLogger, "Runtime logger must be specified"); | ||
|
|
||
| this.manager = manager; | ||
| this.interceptors = interceptors == null ? new ArrayList<ObserverMethod>() : interceptors; | ||
| this.observers = observers == null ? new ArrayList<ObserverMethod>() : observers; | ||
| if(interceptors!=null) { | ||
| this.interceptors.addAll(interceptors); | ||
| } | ||
| if(observers!=null) { | ||
| this.observers.addAll(observers); | ||
| } | ||
|
Comment on lines
-73
to
+79
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use the constructor instead of |
||
| this.nonManagedObserver = nonManagedObserver; | ||
| this.event = event; | ||
| this.runtimeLogger = runtimeLogger; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,10 +17,11 @@ | |
| */ | ||
| package org.jboss.arquillian.test.impl; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.HashSet; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
|
|
||
| import org.jboss.arquillian.core.api.Instance; | ||
| import org.jboss.arquillian.core.api.InstanceProducer; | ||
| import org.jboss.arquillian.core.api.annotation.Inject; | ||
|
|
@@ -59,7 +60,7 @@ public class TestContextHandler { | |
|
|
||
| // Since there can be multiple AfterTestLifecycleEvents (After/AfterRules) | ||
| // and we don't know which is the last one, perform the clean up in AfterClass. | ||
| private Map<Class<?>, Set<Object>> activatedTestContexts = new HashMap<Class<?>, Set<Object>>(); | ||
| private Map<Class<?>, Set<Object>> activatedTestContexts = new ConcurrentHashMap<>(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to already be guarded by itself. I don't think we need to change the type. |
||
|
|
||
| public void createSuiteContext(@Observes(precedence = 100) EventContext<SuiteEvent> context) { | ||
| SuiteContext suiteContext = this.suiteContextInstance.get(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More is likely needed here to really be thread-safe. Especially in the
findDefaultDeploymentmethod.