You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/01/22 11:22:24 UTC
[isis] branch master updated: ISIS-2158: supposed thread-safety fix
for EntityPage serialization
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new f05bb7c ISIS-2158: supposed thread-safety fix for EntityPage serialization
f05bb7c is described below
commit f05bb7cd57d8acbdb78fc98b62e1f19144384a27
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 22 12:22:16 2020 +0100
ISIS-2158: supposed thread-safety fix for EntityPage serialization
---
.../applib/layout/component/CollectionLayoutData.java | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java b/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
index 46d4bb2..90a4e34 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/layout/component/CollectionLayoutData.java
@@ -19,7 +19,6 @@
package org.apache.isis.applib.layout.component;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
@@ -30,6 +29,7 @@ import javax.xml.bind.annotation.XmlType;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.layout.links.Link;
+import org.apache.isis.core.commons.collections.Can;
/**
* Describes the layout of a single collection, broadly corresponds to the {@link org.apache.isis.applib.annotation.CollectionLayout} annotation.
@@ -196,24 +196,25 @@ HasCssClass, HasDescribedAs, HasHidden, HasNamed {
this.sortedBy = sortedBy;
}
-
-
- private List<ActionLayoutData> actions = new ArrayList<>();
+ private final Object $actionsLock = new Object[0]; // serializable
+ private Can<ActionLayoutData> actions = Can.empty(); // serializable
// no wrapper
@Override
@XmlElement(name = "action", required = false)
public List<ActionLayoutData> getActions() {
- return actions;
+ synchronized ($actionsLock) {
+ return actions.toList();
+ }
}
@Override
public void setActions(List<ActionLayoutData> actionLayoutDatas) {
- this.actions = actionLayoutDatas;
+ synchronized ($actionsLock) {
+ this.actions = Can.ofCollection(actionLayoutDatas);
+ }
}
-
-
private CollectionLayoutDataOwner owner;
/**
* Owner.