From bf7882c3b26f25d947150b3d3deaa33671ea27ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Mon, 21 May 2012 17:34:15 +0200 Subject: Use a CopyOnWrite list for listeners. --- .../main/java/com/orbekk/same/android/ClientInterfaceBridge.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'same-android/src/main/java/com/orbekk') diff --git a/same-android/src/main/java/com/orbekk/same/android/ClientInterfaceBridge.java b/same-android/src/main/java/com/orbekk/same/android/ClientInterfaceBridge.java index c2e6e52..7da6c94 100644 --- a/same-android/src/main/java/com/orbekk/same/android/ClientInterfaceBridge.java +++ b/same-android/src/main/java/com/orbekk/same/android/ClientInterfaceBridge.java @@ -17,7 +17,9 @@ package com.orbekk.same.android; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,8 +45,8 @@ import com.orbekk.util.DelayedOperation; public class ClientInterfaceBridge implements ClientInterface { private State state; - private final ArrayList listeners = - new ArrayList(); + private final List listeners = + new CopyOnWriteArrayList(); private final Map ongoingOperations = new HashMap(); /** This is used to queue operations until connected to the service. */ -- cgit v1.2.3