Fix concurrent problem during observation 15/26615/1
authorOndrej Tomcik <ondrej.tomcik@kistler.com>
Wed, 10 Jan 2018 09:13:29 +0000 (10:13 +0100)
committerPeter Rafaj <peter.rafaj@kistler.com>
Fri, 27 Jul 2018 09:41:28 +0000 (11:41 +0200)
Change-Id: I4a26ba76d27ef8a0f6d4e9b23027acd670649b7e
Signed-off-by: Peter Rafaj <peter.rafaj@kistler.com>
cloud/stack/src/main/java/org/iotivity/cloud/base/device/CoapDevice.java

index 05535d5..a22b5ba 100644 (file)
@@ -23,8 +23,9 @@ package org.iotivity.cloud.base.device;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 import org.iotivity.cloud.base.connector.CoapClient;
 import org.iotivity.cloud.base.connector.ConnectorPool;
@@ -49,7 +50,7 @@ public class CoapDevice extends Device {
     private Date                       mIssuedTime         = null;
     private int                        mExpiredPolicy      = 0;
     private ArrayList<IRequestChannel> mObserveChannelList = new ArrayList<>();
-    private HashMap<Long, IRequest>    mObserveRequestList = new HashMap<>();
+    private ConcurrentMap<Long, IRequest>    mObserveRequestList = new ConcurrentHashMap<>();
 
     private static final int           INFINITE_TIME       = -1;