|
44 | 44 | import java.util.SortedMap;
|
45 | 45 | import java.util.TreeMap;
|
46 | 46 | import java.util.concurrent.ConcurrentLinkedQueue;
|
| 47 | +import java.util.concurrent.CopyOnWriteArrayList; |
47 | 48 | import java.util.concurrent.TimeUnit;
|
48 | 49 | import java.util.concurrent.atomic.AtomicReference;
|
49 | 50 |
|
@@ -142,7 +143,7 @@ public MemcachedConnection(String name, ConnectionFactory f,
|
142 | 143 | timeoutRatioThreshold = f.getTimeoutRatioThreshold();
|
143 | 144 | timeoutDurationThreshold = f.getTimeoutDurationThreshold();
|
144 | 145 | selector = Selector.open();
|
145 |
| - List<MemcachedNode> connections = new ArrayList<MemcachedNode>(a.size()); |
| 146 | + List<MemcachedNode> connections = new CopyOnWriteArrayList<MemcachedNode>(); |
146 | 147 | for (SocketAddress sa : a) {
|
147 | 148 | connections.add(makeMemcachedNode(connName, sa));
|
148 | 149 | }
|
@@ -304,9 +305,6 @@ public void handleIO() throws IOException {
|
304 | 305 | }
|
305 | 306 | /* ENABLE_REPLICATION end */
|
306 | 307 |
|
307 |
| - // Deal with the memcached server group that's been added by CacheManager. |
308 |
| - handleCacheNodesChange(); |
309 |
| - |
310 | 308 | if (!reconnectQueue.isEmpty()) {
|
311 | 309 | attemptReconnects();
|
312 | 310 | }
|
@@ -735,7 +733,7 @@ public void setCacheNodesChange(String addrs) {
|
735 | 733 | alterNodesChange.set(old);
|
736 | 734 | }
|
737 | 735 | /* ENABLE_MIGRATION end */
|
738 |
| - selector.wakeup(); |
| 736 | + wakeUpSelector(); |
739 | 737 | }
|
740 | 738 |
|
741 | 739 | /* ENABLE_MIGRATION if */
|
|
0 commit comments