aboutsummaryrefslogtreecommitdiffstats
path: root/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java
diff options
context:
space:
mode:
authorJoey Sullivan <joey.sullivan@amdocs.com>2017-10-05 19:48:12 +0000
committerSkip Wonnell <skip@att.com>2017-10-06 20:26:04 +0000
commita132582db7f3718d51959cd093bea5198bf94530 (patch)
tree4f39a81adf04aeb85cb20cb91f85af7289d9cd1c /appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java
parentb9ab501e8f5fd4750dd3dc07d054821a186a35b2 (diff)
APPC - OAM ConcurrentModificationException
Fixes: - In the AsyncTaskHelper, the cancel future augmentation in the scheduleBaseRunnable(...) removed itself from the myFutureSet while it was iterating over the entries. This caused the ConcurrentModificationException - The Timeout operation in the ConfigurationHelper was not converting the units to millisecond. - The Timeout in the BaseProcessor. preProcess(...) was NOT using the request-timeout value supplied in the request. - When a timeout occurred in the BaseProcessor. preProcess(...) method, the OAM state was not being switched to ERROR state Issue-Id: APPC-263 Change-Id: I02c5e3adaca9a595d2c3541d8a997f3254bf097a Signed-off-by: Joey Sullivan <joey.sullivan@amdocs.com>
Diffstat (limited to 'appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java')
-rw-r--r--appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java b/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java
index 0a4b868a8..9c344c14e 100644
--- a/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java
+++ b/appc-oam/appc-oam-bundle/src/main/java/org/openecomp/appc/oam/util/AsyncTaskHelper.java
@@ -201,7 +201,11 @@ public class AsyncTaskHelper {
boolean cancel;
synchronized (AsyncTaskHelper.this) {
cancel = super.cancel(mayInterruptIfRunning);
- myFutureSet.stream().filter(f->!this.equals(f)).forEach(f->f.cancel(mayInterruptIfRunning));
+ //clone the set to prevent java.util.ConcurrentModificationException. The synchronized prevents
+ //other threads from modifying this set, but not itself. The f->f.cancel may modify myFutureSet by
+ //removing an entry which breaks the iteration in the forEach.
+ (new HashSet<MyFuture>(myFutureSet))
+ .stream().filter(f->!this.equals(f)).forEach(f->f.cancel(mayInterruptIfRunning));
}
return cancel;
}