This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new d7af34fe60 Keep the Artifact Info graph consistent when artifacts are
loaded in parallel
d7af34fe60 is described below
commit d7af34fe602bad9fe039112c3c714140bd5845c1
Author: Mridul Pathak <[email protected]>
AuthorDate: Fri Oct 30 13:29:25 2026 +0530
Keep the Artifact Info graph consistent when artifacts are loaded in
parallel
ArtifactInfoFactory loads services and components on the fork-join pool,
but each get*ArtifactInfo method did a get, built a new info and then a put, so
two tasks could build the same artifact and the later one replaced the earlier.
The reverse references were added with UtilMisc.addToSortedSetInMap, which does
the same check-then-act and then adds to a plain TreeSet from many tasks at
once, so a set could be replaced, losing the references already in it, or
corrupted.
Each info is now registered with putIfAbsent and only the registered one is
populated. The reverse-reference sets are created with computeIfAbsent and,
like each info's own reference sets, are ConcurrentSkipListSets, so the
Artifact Info screens can also iterate them while another request loads
artifacts.
---
.../webtools/artifactinfo/ArtifactInfoBase.java | 14 +++++
.../webtools/artifactinfo/ArtifactInfoFactory.java | 68 +++++++++++++++-------
.../ControllerRequestArtifactInfo.java | 17 +++---
.../artifactinfo/ControllerViewArtifactInfo.java | 3 +-
.../webtools/artifactinfo/EntityArtifactInfo.java | 6 +-
.../artifactinfo/FormWidgetArtifactInfo.java | 21 ++++---
.../artifactinfo/ScreenWidgetArtifactInfo.java | 19 +++---
.../webtools/artifactinfo/ServiceArtifactInfo.java | 14 ++---
.../artifactinfo/ServiceEcaArtifactInfo.java | 7 +--
9 files changed, 103 insertions(+), 66 deletions(-)
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java
index 4dd7d39e70..b885f96290 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoBase.java
@@ -20,6 +20,9 @@ package org.apache.ofbiz.webtools.artifactinfo;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentSkipListSet;
/**
*
@@ -42,6 +45,17 @@ public abstract class ArtifactInfoBase implements
Comparable<ArtifactInfoBase> {
this.aif = aif;
}
+ /**
+ * Adds an artifact to the sorted set kept under a key of a
reverse-reference map.
+ * The artifact graph is built from several threads at once, so the set is
created atomically and is thread-safe.
+ * @param element the artifact to add
+ * @param theMap the reverse-reference map
+ * @param setKey the key of the set
+ */
+ static <K, V> void addToSortedSetInMap(V element, Map<K, Set<V>> theMap, K
setKey) {
+ theMap.computeIfAbsent(setKey, k -> new
ConcurrentSkipListSet<>()).add(element);
+ }
+
@Override
public int compareTo(ArtifactInfoBase that) {
if (that == null) {
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
index 02d661fe41..ffb63f9d9d 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
@@ -443,9 +443,13 @@ public class ArtifactInfoFactory {
public EntityArtifactInfo getEntityArtifactInfo(String entityName) throws
GeneralException {
EntityArtifactInfo curInfo = this.allEntityInfos.get(entityName);
if (curInfo == null) {
- curInfo = new EntityArtifactInfo(entityName, this);
- this.allEntityInfos.put(entityName, curInfo);
- curInfo.populateAll();
+ EntityArtifactInfo newInfo = new EntityArtifactInfo(entityName,
this);
+ // if another thread registered the same artifact meanwhile, use
that one and leave its population to that thread
+ curInfo = this.allEntityInfos.putIfAbsent(entityName, newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
}
return curInfo;
}
@@ -459,9 +463,13 @@ public class ArtifactInfoFactory {
public ServiceArtifactInfo getServiceArtifactInfo(String serviceName)
throws GeneralException {
ServiceArtifactInfo curInfo = this.allServiceInfos.get(serviceName);
if (curInfo == null) {
- curInfo = new ServiceArtifactInfo(serviceName, this);
- this.allServiceInfos.put(serviceName, curInfo);
- curInfo.populateAll();
+ ServiceArtifactInfo newInfo = new ServiceArtifactInfo(serviceName,
this);
+ // if another thread registered the same artifact meanwhile, use
that one and leave its population to that thread
+ curInfo = this.allServiceInfos.putIfAbsent(serviceName, newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
}
return curInfo;
}
@@ -475,9 +483,13 @@ public class ArtifactInfoFactory {
public ServiceEcaArtifactInfo getServiceEcaArtifactInfo(ServiceEcaRule
ecaRule) throws GeneralException {
ServiceEcaArtifactInfo curInfo = this.allServiceEcaInfos.get(ecaRule);
if (curInfo == null) {
- curInfo = new ServiceEcaArtifactInfo(ecaRule, this);
- this.allServiceEcaInfos.put(ecaRule, curInfo);
- curInfo.populateAll();
+ ServiceEcaArtifactInfo newInfo = new
ServiceEcaArtifactInfo(ecaRule, this);
+ // if another thread registered the same artifact meanwhile, use
that one and leave its population to that thread
+ curInfo = this.allServiceEcaInfos.putIfAbsent(ecaRule, newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
}
return curInfo;
}
@@ -503,9 +515,13 @@ public class ArtifactInfoFactory {
public FormWidgetArtifactInfo getFormWidgetArtifactInfo(String formName,
String formLocation) throws GeneralException {
FormWidgetArtifactInfo curInfo = this.allFormInfos.get(formLocation +
"#" + formName);
if (curInfo == null) {
- curInfo = new FormWidgetArtifactInfo(formName, formLocation, this);
- this.allFormInfos.put(curInfo.getUniqueId(), curInfo);
- curInfo.populateAll();
+ FormWidgetArtifactInfo newInfo = new
FormWidgetArtifactInfo(formName, formLocation, this);
+ // if another thread registered the same artifact meanwhile, use
that one and leave its population to that thread
+ curInfo = this.allFormInfos.putIfAbsent(newInfo.getUniqueId(),
newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
}
return curInfo;
}
@@ -520,9 +536,13 @@ public class ArtifactInfoFactory {
ScreenWidgetArtifactInfo curInfo =
this.allScreenInfos.get(screenLocation + "#" + screenName);
if (curInfo == null) {
try {
- curInfo = new ScreenWidgetArtifactInfo(screenName,
screenLocation, this);
- this.allScreenInfos.put(curInfo.getUniqueId(), curInfo);
- curInfo.populateAll();
+ ScreenWidgetArtifactInfo newInfo = new
ScreenWidgetArtifactInfo(screenName, screenLocation, this);
+ // if another thread registered the same artifact meanwhile,
use that one and leave its population to that thread
+ curInfo =
this.allScreenInfos.putIfAbsent(newInfo.getUniqueId(), newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
} catch (GeneralException e) {
Debug.logWarning("Error loading screen [" + screenName + "]
from resource [" + screenLocation + "]: " + e.toString(), MODULE);
return null;
@@ -547,9 +567,13 @@ public class ArtifactInfoFactory {
}
ControllerRequestArtifactInfo curInfo =
this.allControllerRequestInfos.get(controllerXmlUrl.toExternalForm() + "#" +
requestUri);
if (curInfo == null) {
- curInfo = new ControllerRequestArtifactInfo(controllerXmlUrl,
requestUri, this);
- this.allControllerRequestInfos.put(curInfo.getUniqueId(), curInfo);
- curInfo.populateAll();
+ ControllerRequestArtifactInfo newInfo = new
ControllerRequestArtifactInfo(controllerXmlUrl, requestUri, this);
+ // if another thread registered the same artifact meanwhile, use
that one and leave its population to that thread
+ curInfo =
this.allControllerRequestInfos.putIfAbsent(newInfo.getUniqueId(), newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ curInfo.populateAll();
+ }
}
return curInfo;
}
@@ -564,8 +588,12 @@ public class ArtifactInfoFactory {
public ControllerViewArtifactInfo getControllerViewArtifactInfo(URL
controllerXmlUrl, String viewUri) throws GeneralException {
ControllerViewArtifactInfo curInfo =
this.allControllerViewInfos.get(controllerXmlUrl.toExternalForm() + "#" +
viewUri);
if (curInfo == null) {
- curInfo = new ControllerViewArtifactInfo(controllerXmlUrl,
viewUri, this);
- this.allControllerViewInfos.put(curInfo.getUniqueId(), curInfo);
+ ControllerViewArtifactInfo newInfo = new
ControllerViewArtifactInfo(controllerXmlUrl, viewUri, this);
+ // if another thread registered the same view meanwhile, use that
one
+ curInfo =
this.allControllerViewInfos.putIfAbsent(newInfo.getUniqueId(), newInfo);
+ if (curInfo == null) {
+ curInfo = newInfo;
+ }
}
return curInfo;
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
index a699f12da2..accc32d119 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
@@ -23,12 +23,11 @@ import java.net.URL;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
import org.apache.ofbiz.base.util.UtilGenerics;
-import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilURL;
import org.apache.ofbiz.webapp.control.ConfigXMLReader;
@@ -42,8 +41,8 @@ public class ControllerRequestArtifactInfo extends
ArtifactInfoBase {
private String requestUri;
private ConfigXMLReader.RequestMap requestInfoMap;
private ServiceArtifactInfo serviceCalledByRequestEvent = null;
- private Set<ControllerRequestArtifactInfo>
requestsThatAreResponsesToThisRequest = new TreeSet<>();
- private Set<ControllerViewArtifactInfo> viewsThatAreResponsesToThisRequest
= new TreeSet<>();
+ private Set<ControllerRequestArtifactInfo>
requestsThatAreResponsesToThisRequest = new ConcurrentSkipListSet<>();
+ private Set<ControllerViewArtifactInfo> viewsThatAreResponsesToThisRequest
= new ConcurrentSkipListSet<>();
public ControllerRequestArtifactInfo(URL controllerXmlUrl, String
requestUri, ArtifactInfoFactory aif) throws GeneralException {
super(aif);
@@ -69,7 +68,7 @@ public class ControllerRequestArtifactInfo extends
ArtifactInfoBase {
this.serviceCalledByRequestEvent =
this.getAif().getServiceArtifactInfo(serviceName);
if (this.serviceCalledByRequestEvent != null) {
// add the reverse association
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllRequestInfosReferringToServiceName(),
+ addToSortedSetInMap(this,
getAif().getAllRequestInfosReferringToServiceName(),
this.serviceCalledByRequestEvent.getUniqueId());
}
}
@@ -85,7 +84,7 @@ public class ControllerRequestArtifactInfo extends
ArtifactInfoBase {
ControllerViewArtifactInfo artInfo =
this.getAif().getControllerViewArtifactInfo(controllerXmlUrl, viewUri);
this.viewsThatAreResponsesToThisRequest.add(artInfo);
// add the reverse association
- UtilMisc.addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToView(), artInfo.getUniqueId());
+ addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToView(), artInfo.getUniqueId());
} catch (GeneralException e) {
Debug.logWarning(e.toString(), MODULE);
}
@@ -97,7 +96,7 @@ public class ControllerRequestArtifactInfo extends
ArtifactInfoBase {
try {
ControllerRequestArtifactInfo artInfo =
this.getAif().getControllerRequestArtifactInfo(controllerXmlUrl,
otherRequestUri);
this.requestsThatAreResponsesToThisRequest.add(artInfo);
- UtilMisc.addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
+ addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
} catch (GeneralException e) {
Debug.logWarning(e.toString(), MODULE);
}
@@ -105,12 +104,12 @@ public class ControllerRequestArtifactInfo extends
ArtifactInfoBase {
String otherRequestUri = response.getValue();
ControllerRequestArtifactInfo artInfo =
this.getAif().getControllerRequestArtifactInfo(controllerXmlUrl,
otherRequestUri);
this.requestsThatAreResponsesToThisRequest.add(artInfo);
- UtilMisc.addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
+ addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
} else if ("request-redirect-noparam".equals(response.getType())) {
String otherRequestUri = response.getValue();
ControllerRequestArtifactInfo artInfo =
this.getAif().getControllerRequestArtifactInfo(controllerXmlUrl,
otherRequestUri);
this.requestsThatAreResponsesToThisRequest.add(artInfo);
- UtilMisc.addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
+ addToSortedSetInMap(this,
this.getAif().getAllRequestInfosReferringToRequest(), artInfo.getUniqueId());
}
}
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
index 2459195eb7..9f1cdfcc42 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
@@ -24,7 +24,6 @@ import java.util.Objects;
import java.util.Set;
import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilURL;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.webapp.control.ConfigXMLReader;
@@ -64,7 +63,7 @@ public class ControllerViewArtifactInfo extends
ArtifactInfoBase {
fullScreenName.substring(0, poundIndex));
if (this.screenCalledByThisView != null) {
// add the reverse association
- UtilMisc.addToSortedSetInMap(this,
aif.getAllViewInfosReferringToScreen(),
this.screenCalledByThisView.getUniqueId());
+ addToSortedSetInMap(this,
aif.getAllViewInfosReferringToScreen(),
this.screenCalledByThisView.getUniqueId());
}
}
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
index f4d0058b83..91d07357ce 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java
@@ -23,7 +23,7 @@ import java.net.URL;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.GeneralException;
@@ -37,8 +37,8 @@ import org.apache.ofbiz.entityext.eca.EntityEcaRule;
*/
public class EntityArtifactInfo extends ArtifactInfoBase {
private ModelEntity modelEntity;
- private Set<EntityArtifactInfo> entitiesRelatedOne = new TreeSet<>();
- private Set<EntityArtifactInfo> entitiesRelatedMany = new TreeSet<>();
+ private Set<EntityArtifactInfo> entitiesRelatedOne = new
ConcurrentSkipListSet<>();
+ private Set<EntityArtifactInfo> entitiesRelatedMany = new
ConcurrentSkipListSet<>();
public EntityArtifactInfo(String entityName, ArtifactInfoFactory aif)
throws GenericEntityException {
super(aif);
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
index 4ea7307aa9..03da6a76bd 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java
@@ -22,14 +22,13 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilURL;
import org.apache.ofbiz.widget.artifact.ArtifactInfoContext;
import org.apache.ofbiz.widget.artifact.ArtifactInfoGatherer;
@@ -49,11 +48,11 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
private String formName;
private String formLocation;
- private Set<EntityArtifactInfo> entitiesUsedInThisForm = new TreeSet<>();
- private Set<ServiceArtifactInfo> servicesUsedInThisForm = new TreeSet<>();
+ private Set<EntityArtifactInfo> entitiesUsedInThisForm = new
ConcurrentSkipListSet<>();
+ private Set<ServiceArtifactInfo> servicesUsedInThisForm = new
ConcurrentSkipListSet<>();
private FormWidgetArtifactInfo formThisFormExtends = null;
- private Set<ControllerRequestArtifactInfo> requestsLinkedToInForm = new
TreeSet<>();
- private Set<ControllerRequestArtifactInfo> requestsTargetedByInForm = new
TreeSet<>();
+ private Set<ControllerRequestArtifactInfo> requestsLinkedToInForm = new
ConcurrentSkipListSet<>();
+ private Set<ControllerRequestArtifactInfo> requestsTargetedByInForm = new
ConcurrentSkipListSet<>();
public FormWidgetArtifactInfo(String formName, String formLocation,
ArtifactInfoFactory aif) throws GeneralException {
super(aif);
@@ -110,7 +109,7 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.formThisFormExtends =
getAif().getFormWidgetArtifactInfo(formName);
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllFormInfosExtendingForm(), formName);
+ addToSortedSetInMap(this, getAif().getAllFormInfosExtendingForm(),
formName);
}
}
@@ -133,7 +132,7 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.entitiesUsedInThisForm.add(getAif().getEntityArtifactInfo(entityName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToEntityName(), entityName);
+ addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToEntityName(), entityName);
}
}
@@ -158,7 +157,7 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.servicesUsedInThisForm.add(getAif().getServiceArtifactInfo(serviceName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToServiceName(), serviceName);
+ addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToServiceName(), serviceName);
}
}
@@ -178,7 +177,7 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.requestsLinkedToInForm.add(getAif().getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl),
requestUri));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToRequest(), requestUniqueId);
+ addToSortedSetInMap(this,
getAif().getAllFormInfosReferringToRequest(), requestUniqueId);
}
}
}
@@ -201,7 +200,7 @@ public class FormWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.requestsTargetedByInForm.add(getAif().getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl),
requestUri));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllFormInfosTargetingRequest(), requestUniqueId);
+ addToSortedSetInMap(this,
getAif().getAllFormInfosTargetingRequest(), requestUniqueId);
}
}
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
index 6a65f4231b..dd3474fc1b 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java
@@ -23,14 +23,13 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilURL;
import org.apache.ofbiz.widget.artifact.ArtifactInfoContext;
import org.apache.ofbiz.widget.artifact.ArtifactInfoGatherer;
@@ -48,10 +47,10 @@ public class ScreenWidgetArtifactInfo extends
ArtifactInfoBase {
private String screenName;
private String screenLocation;
- private Set<EntityArtifactInfo> entitiesUsedInThisScreen = new TreeSet<>();
- private Set<ServiceArtifactInfo> servicesUsedInThisScreen = new
TreeSet<>();
- private Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = new
TreeSet<>();
- private Set<ControllerRequestArtifactInfo> requestsLinkedToInScreen = new
TreeSet<>();
+ private Set<EntityArtifactInfo> entitiesUsedInThisScreen = new
ConcurrentSkipListSet<>();
+ private Set<ServiceArtifactInfo> servicesUsedInThisScreen = new
ConcurrentSkipListSet<>();
+ private Set<FormWidgetArtifactInfo> formsIncludedInThisScreen = new
ConcurrentSkipListSet<>();
+ private Set<ControllerRequestArtifactInfo> requestsLinkedToInScreen = new
ConcurrentSkipListSet<>();
public ScreenWidgetArtifactInfo(String screenName, String screenLocation,
ArtifactInfoFactory aif) throws GeneralException {
super(aif);
@@ -104,7 +103,7 @@ public class ScreenWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.servicesUsedInThisScreen.add(getAif().getServiceArtifactInfo(serviceName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToServiceName(), serviceName);
+ addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToServiceName(), serviceName);
}
}
@@ -129,7 +128,7 @@ public class ScreenWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.entitiesUsedInThisScreen.add(getAif().getEntityArtifactInfo(entityName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToEntityName(), entityName);
+ addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToEntityName(), entityName);
}
}
@@ -155,7 +154,7 @@ public class ScreenWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.formsIncludedInThisScreen.add(getAif().getFormWidgetArtifactInfo(formName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToForm(), formName);
+ addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToForm(), formName);
}
}
@@ -177,7 +176,7 @@ public class ScreenWidgetArtifactInfo extends
ArtifactInfoBase {
// the forward reference
this.requestsLinkedToInScreen.add(getAif().getControllerRequestArtifactInfo(UtilURL.fromUrlString(controllerXmlUrl),
requestUri));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToRequest(), requestUniqueId);
+ addToSortedSetInMap(this,
getAif().getAllScreenInfosReferringToRequest(), requestUniqueId);
}
}
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
index 2516c35c29..d7d87e60b5 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java
@@ -29,7 +29,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
@@ -59,9 +59,9 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
private ModelService modelService;
private String displayPrefix = null;
- private Set<EntityArtifactInfo> entitiesUsedByThisService = new
TreeSet<>();
- private Set<ServiceArtifactInfo> servicesCalledByThisService = new
TreeSet<>();
- private Set<ServiceEcaArtifactInfo> serviceEcasTriggeredByThisService =
new TreeSet<>();
+ private Set<EntityArtifactInfo> entitiesUsedByThisService = new
ConcurrentSkipListSet<>();
+ private Set<ServiceArtifactInfo> servicesCalledByThisService = new
ConcurrentSkipListSet<>();
+ private Set<ServiceEcaArtifactInfo> serviceEcasTriggeredByThisService =
new ConcurrentSkipListSet<>();
public ServiceArtifactInfo(String serviceName, ArtifactInfoFactory aif)
throws GeneralException {
super(aif);
@@ -146,7 +146,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
// the forward reference
this.entitiesUsedByThisService.add(getAif().getEntityArtifactInfo(validEntityName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToEntityName(), validEntityName);
+ addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToEntityName(), validEntityName);
}
}
@@ -229,7 +229,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
// the forward reference
this.servicesCalledByThisService.add(getAif().getServiceArtifactInfo(serviceName));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToServiceName(), serviceName);
+ addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToServiceName(), serviceName);
}
}
@@ -247,7 +247,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
for (ServiceEcaRule ecaRule : ecaRuleList) {
this.serviceEcasTriggeredByThisService.add(getAif().getServiceEcaArtifactInfo(ecaRule));
// the reverse reference
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToServiceEcaRule(), ecaRule);
+ addToSortedSetInMap(this,
getAif().getAllServiceInfosReferringToServiceEcaRule(), ecaRule);
}
}
}
diff --git
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java
index 131180dc94..4711792800 100644
---
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java
+++
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java
@@ -26,11 +26,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.TreeSet;
+import java.util.concurrent.ConcurrentSkipListSet;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.service.eca.ServiceEcaAction;
import org.apache.ofbiz.service.eca.ServiceEcaCondition;
import org.apache.ofbiz.service.eca.ServiceEcaRule;
@@ -43,7 +42,7 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase {
private String displayPrefix = null;
private int displaySuffixNum = 0;
- private Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = new
TreeSet<>();
+ private Set<ServiceArtifactInfo> servicesCalledByThisServiceEca = new
ConcurrentSkipListSet<>();
/**
* Instantiates a new Service eca artifact info.
@@ -65,7 +64,7 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase {
// populate the services called Set
for (ServiceEcaAction ecaAction: serviceEcaRule.getEcaActionList()) {
servicesCalledByThisServiceEca.add(getAif().getServiceArtifactInfo(ecaAction.getServiceName()));
- UtilMisc.addToSortedSetInMap(this,
getAif().getAllServiceEcaInfosReferringToServiceName(),
ecaAction.getServiceName());
+ addToSortedSetInMap(this,
getAif().getAllServiceEcaInfosReferringToServiceName(),
ecaAction.getServiceName());
}
}