Skip to content

Commit

Permalink
Merge pull request #24359 from dmatej/concurrency
Browse files Browse the repository at this point in the history
Fixed Concurrency TCK
  • Loading branch information
arjantijms authored Mar 27, 2023
2 parents 4291b87 + 7ed7520 commit a9dbe01
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -18,6 +18,7 @@

import com.sun.enterprise.deployment.annotation.handlers.ContextServiceDefinitionData;

import java.util.Objects;
import java.util.Properties;
import java.util.Set;

Expand Down Expand Up @@ -128,6 +129,21 @@ public ContextServiceDefinitionData getData() {
}


@Override
public boolean equals(Object object) {
if (object instanceof ContextServiceDefinitionDescriptor) {
ContextServiceDefinitionDescriptor another = (ContextServiceDefinitionDescriptor) object;
return getJndiName().equals(another.getJndiName());
}
return false;
}


@Override
public int hashCode() {
return Objects.hash(getName());
}

@Override
public String toString() {
return "ContextServiceDefinitionDescriptor[data=" + data + ']';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -19,6 +19,7 @@
import com.sun.enterprise.deployment.annotation.factory.ManagedExecutorDefinitionData;
import com.sun.enterprise.deployment.annotation.handlers.ContextualResourceDefinition;

import java.util.Objects;
import java.util.Properties;

import org.glassfish.deployment.common.JavaEEResourceType;
Expand Down Expand Up @@ -119,6 +120,22 @@ public ManagedExecutorDefinitionData getData() {
}


@Override
public boolean equals(Object object) {
if (object instanceof ManagedExecutorDefinitionDescriptor) {
ManagedExecutorDefinitionDescriptor another = (ManagedExecutorDefinitionDescriptor) object;
return getJndiName().equals(another.getJndiName());
}
return false;
}


@Override
public int hashCode() {
return Objects.hash(getName());
}


@Override
public String toString() {
return "ManagedExecutorDefinitionDescriptor{data=" + data + ')';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -19,6 +19,7 @@
import com.sun.enterprise.deployment.annotation.handlers.ContextualResourceDefinition;
import com.sun.enterprise.deployment.annotation.handlers.ManagedScheduledExecutorDefinitionData;

import java.util.Objects;
import java.util.Properties;

import org.glassfish.deployment.common.JavaEEResourceType;
Expand Down Expand Up @@ -114,6 +115,22 @@ public ManagedScheduledExecutorDefinitionData getData() {
}


@Override
public boolean equals(Object object) {
if (object instanceof ManagedScheduledExecutorDefinitionDescriptor) {
ManagedScheduledExecutorDefinitionDescriptor another = (ManagedScheduledExecutorDefinitionDescriptor) object;
return getName().equals(another.getName());
}
return false;
}


@Override
public int hashCode() {
return Objects.hash(getName());
}


@Override
public String toString() {
return "ManagedScheduledExecutorDefinitionDescriptor{data=" + data + ')';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Eclipse Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023 Eclipse Foundation and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -18,6 +18,7 @@

import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Properties;
import java.util.Set;

Expand Down Expand Up @@ -108,6 +109,22 @@ public void addContextServiceExecutorDescriptor(String name, String value) {
}


@Override
public boolean equals(Object object) {
if (object instanceof ContextServiceDefinitionData) {
ContextServiceDefinitionData another = (ContextServiceDefinitionData) object;
return getName().equals(another.getName());
}
return false;
}


@Override
public int hashCode() {
return Objects.hash(getName());
}


@Override
public String toString() {
return super.toString() + "[name=" + name + ", cleared=" + cleared + ", propagated=" + propagated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,23 @@
@Service(name="application_deploy")
public class ApplicationValidator extends ComponentValidator implements ApplicationVisitor, ManagedBeanVisitor {

@LogMessageInfo(
message = "Duplicate descriptor found for given jndi-name: {0}.\nDescriptor 1:\n{1}\nDescriptor 2:\n{2}",
level = "SEVERE",
cause = "Two or more resource definitions use the same jndi-name in the same or related contexts",
action = "Make sure that all JNDI names used to define resources in application's resource annotations"
+ " or desciptors are unique in each context. For example java:app/myname conflicts"
+ " with java:comp:myname because myname jndi-name is defined twice in the component context")
private static final String DUPLICATE_DESCRIPTOR = "dol.validation.application.jndiNameConflict";

@LogMessageInfo(
message = "Application validation failed for application: {0}, jndi-name: {1}, resource adapter name: {2} is wrong.",
level="SEVERE",
cause = "For embedded resource adapter, its name should begin with '#' symbol",
action = "Remove application name before the '#' symbol in the resource adapter name.",
comment = "For the method validateResourceDescriptor of com.sun.enterprise.deployment.util.ApplicationValidator"
)
private static final String RESOURCE_ADAPTER_NAME_INVALID = "AS-DEPLOYMENT-00020";
private static final String RESOURCE_ADAPTER_NAME_INVALID = "dol.validation.application.failed";

private static final Logger LOG = DOLUtils.getLogger();

Expand Down Expand Up @@ -531,7 +540,8 @@ private boolean isConflictingDescriptor(SimpleJndiName name, ResourceDescriptor
}

// Same JNDI names, but different descriptors
LOG.log(Level.ERROR, DOLUtils.DUPLICATE_DESCRIPTOR, name);
LOG.log(Level.ERROR, DUPLICATE_DESCRIPTOR, name, existingDescriptor, descriptor);
inValidJndiName = name;
allUniqueResource = false;
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,6 @@ public class DOLUtils {
+ " Ensure that the SAX parser configuration is correct and the descriptor has right permissions.")
public static final String INVALILD_DESCRIPTOR_SHORT = "AS-DEPLOYMENT-00120";

@LogMessageInfo(
message = "DEP0002:Duplicate descriptor found for given jndi-name: {0}",
level = "SEVERE",
cause = "Two or more resource definitions use the same jndi-name in the same or related contexts",
action = "Make sure that all JNDI names used to define resources in application's resource annotations"
+ " or desciptors are unique in each context. For example java:app/myname conflicts"
+ " with java:comp:myname because myname jndi-name is defined twice in the component context")
public static final String DUPLICATE_DESCRIPTOR = "enterprise.deployment.util.descriptor.duplicate";

@LogMessageInfo(
message = "DEP0003:The jndi-name is already used in the global tree failed for given jndi-name: {0}",
level = "SEVERE",
Expand Down

0 comments on commit a9dbe01

Please sign in to comment.