You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/04/28 15:54:15 UTC
[unomi] branch UNOMI-331-listeners-concurrency-errors created (now
629a61c)
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a change to branch UNOMI-331-listeners-concurrency-errors
in repository https://gitbox.apache.org/repos/asf/unomi.git.
at 629a61c UNOMI-331 Concurrency issues in rules and event listeners Fixed by replacing ArrayList with CopyOnWriteList
This branch includes the following new commits:
new 629a61c UNOMI-331 Concurrency issues in rules and event listeners Fixed by replacing ArrayList with CopyOnWriteList
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[unomi] 01/01: UNOMI-331 Concurrency issues in rules and event
listeners Fixed by replacing ArrayList with CopyOnWriteList
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch UNOMI-331-listeners-concurrency-errors
in repository https://gitbox.apache.org/repos/asf/unomi.git
commit 629a61c75e28bc6ce18859fddba149a38d528517
Author: Serge Huber <sh...@apache.org>
AuthorDate: Tue Apr 28 17:54:09 2020 +0200
UNOMI-331 Concurrency issues in rules and event listeners
Fixed by replacing ArrayList with CopyOnWriteList
---
.../java/org/apache/unomi/services/impl/events/EventServiceImpl.java | 3 ++-
.../java/org/apache/unomi/services/impl/rules/RulesServiceImpl.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java b/services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java
index 85e4aef..b1846dc 100644
--- a/services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java
@@ -39,12 +39,13 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
public class EventServiceImpl implements EventService {
private static final Logger logger = LoggerFactory.getLogger(EventServiceImpl.class.getName());
private static final int MAX_RECURSION_DEPTH = 10;
- private List<EventListenerService> eventListeners = new ArrayList<EventListenerService>();
+ private List<EventListenerService> eventListeners = new CopyOnWriteArrayList<EventListenerService>();
private PersistenceService persistenceService;
diff --git a/services/src/main/java/org/apache/unomi/services/impl/rules/RulesServiceImpl.java b/services/src/main/java/org/apache/unomi/services/impl/rules/RulesServiceImpl.java
index 6aeeae9..d77173c 100644
--- a/services/src/main/java/org/apache/unomi/services/impl/rules/RulesServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/impl/rules/RulesServiceImpl.java
@@ -39,6 +39,7 @@ import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
public class RulesServiceImpl implements RulesService, EventListenerService, SynchronousBundleListener {
@@ -61,7 +62,7 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
private Integer rulesRefreshInterval = 1000;
private Integer rulesStatisticsRefreshInterval = 10000;
- private List<RuleListenerService> ruleListeners = new ArrayList<RuleListenerService>();
+ private List<RuleListenerService> ruleListeners = new CopyOnWriteArrayList<RuleListenerService>();
public void setBundleContext(BundleContext bundleContext) {
this.bundleContext = bundleContext;