Use thread safe set for RemoteConnection.mListeners
Switch from HashSet to set backed by a ConcurrentHashMap to prevent ConcurrentModificationExceptions. (Relanding ag/521178. This got reveretd in ag/520450). Bug: 16901565 Change-Id: I997898ed94f305d9b8c57eead04e0dfe6c04a884
This commit is contained in:
@@ -24,9 +24,11 @@ import android.os.RemoteException;
|
||||
import android.telephony.DisconnectCause;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* A connection provided to a {@link ConnectionService} by another {@code ConnectionService}
|
||||
@@ -182,7 +184,8 @@ public final class RemoteConnection {
|
||||
|
||||
private IConnectionService mConnectionService;
|
||||
private final String mConnectionId;
|
||||
private final Set<Listener> mListeners = new HashSet<>();
|
||||
private final Set<Listener> mListeners = Collections.newSetFromMap(
|
||||
new ConcurrentHashMap<Listener, Boolean>(2));
|
||||
private final Set<RemoteConnection> mConferenceableConnections = new HashSet<>();
|
||||
|
||||
private int mState = Connection.STATE_NEW;
|
||||
|
||||
Reference in New Issue
Block a user