You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/10/26 18:34:49 UTC

isis git commit: ISIS-1525: takes a copy of all services prior to iterating over them during startup, to avoid an occasional concurrent modification exception.

Repository: isis
Updated Branches:
  refs/heads/maint-1.13.1 551661cd1 -> 28b9a255a


ISIS-1525: takes a copy of all services prior to iterating over them during startup, to avoid an occasional concurrent modification exception.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/28b9a255
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/28b9a255
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/28b9a255

Branch: refs/heads/maint-1.13.1
Commit: 28b9a255adf6784b2b1123c31ddd1bd07f640c31
Parents: 551661c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Oct 26 19:33:34 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Oct 26 19:33:34 2016 +0100

----------------------------------------------------------------------
 .../isis/core/runtime/system/session/IsisSessionFactory.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/28b9a255/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
index 80bc088..2ab4b46 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
@@ -22,6 +22,8 @@ package org.apache.isis.core.runtime.system.session;
 import java.util.List;
 import java.util.concurrent.Callable;
 
+import com.google.common.collect.Lists;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -143,9 +145,13 @@ public class IsisSessionFactory implements ApplicationScopedComponent {
             //
             // translateServicesAndEnumConstants
             //
+
             final List<Object> services = servicesInjector.getRegisteredServices();
+            // take a copy of all services to avoid occasionall concurrent modification exceptions
+            // that can sometimes occur in the loop
+            final List<Object> copyOfServices = Lists.newArrayList(services);
             final TitleService titleService = servicesInjector.lookupServiceElseFail(TitleService.class);
-            for (Object service : services) {
+            for (Object service : copyOfServices) {
                 final String unused = titleService.titleOf(service);
             }
             for (final ObjectSpecification objSpec : servicesInjector.getSpecificationLoader().allSpecifications()) {