diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-05-21 17:34:15 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-05-21 17:34:15 +0200 |
commit | bf7882c3b26f25d947150b3d3deaa33671ea27ff (patch) | |
tree | 5dac7bb1ce31d4cb8d184c73ab36bdda062263d8 /same-android/src | |
parent | 775546f63d04778ab26b401fc179746fa3fb71a7 (diff) |
Use a CopyOnWrite list for listeners.
Diffstat (limited to 'same-android/src')
-rw-r--r-- | same-android/src/main/java/com/orbekk/same/android/ClientInterfaceBridge.java | 6 |
1 files changed, 4 insertions, 2 deletions
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<StateChangedListener> listeners = - new ArrayList<StateChangedListener>(); + private final List<StateChangedListener> listeners = + new CopyOnWriteArrayList<StateChangedListener>(); private final Map<Integer, DelayedOperation> ongoingOperations = new HashMap<Integer, DelayedOperation>(); /** This is used to queue operations until connected to the service. */ |