Questions tagged [synchronizedcollection]

11 questions
73
votes
2 answers

What is the difference between SynchronizedCollection and the other concurrent collections?

How does SynchronizedCollection and the concurrent collections in the System.Collections.Concurrent namespace differ from each other, apart from Concurrent Collections being a namespace and SynchronizedCollection being a…
3
votes
1 answer

Powershell synchronized hash table thread safety

I have a WPF script running into problems recently. The script does subnet scanning using PSParallel module. When the subnet CIDR is less than 21, it starts having the problem. The problem is: I have a concurrent queue as a member of a synchronized…
1
vote
0 answers

How to synchronize the Arraylist to the Retrofit result

This is one of the APIs that working with Retrofit library. @GET("users/self/media/recent/") Call> getRecentPostList(@Query("access_token") String access_token); I'm using GsonConverterFactory to output the result, and this…
1
vote
1 answer

Is it valid to add `null` to a SynchronizedCollection - documentation error and/or removed restriction?

Per SynchronizedCollection.Add, an ArgumentException is thrown when "The value set is null or is not of the correct generic type T for the collection". ReSharper 8 also considers this a [NotNull] parameter. However, there is no exception when…
user2864740
  • 60,010
  • 15
  • 145
  • 220
0
votes
1 answer

Failed for SynchronizedCollection while serializing an array list

Here is the error stack, java.util.ConcurrentModificationException at java.util.ArrayList.writeObject(ArrayList.java:766) at java.lang.reflect.Method.invoke(Native Method) at…
0
votes
1 answer

Obtaining a Synchronized List of BlockingQueues in Java

I'd like to work with the following data structure: List> listOfQueues = Collections.synchronizedList( new ArrayList>(15) ); So I'd like to construct a list of…
0
votes
2 answers

Why Java keeps List values for each request even using concurrent list?

In the following methods, I have a list to keep the data and I can populate all the data into this menuDTOList. However, when a send a new request after getting all the data from the first request, the menuDTOList still keeps the data of the first…
user17188729
0
votes
1 answer

Why do synchronized wrappers exist for List,Set,Map when there is Collections.synchronizedCollection()

Does anyone know why should I (for example) put my List inside Collections.syncrhonizedList() instead of Collections.synchronizedCollection()? Do they work the same? Same applies to Map,Set. Another thing. Why there isn't…
Ana Maria
  • 475
  • 2
  • 11
0
votes
1 answer

Does Collection.SynchronizedList iterator block entire iteration process or just .next() part?

Before I ask anything you might tell me to read docs. But I am still a beginner and I am not handling docs so easily. My question is does iterator in SynchronizedList block 'entire iteration process (loop)' or just its methods? Meaning: Can another…
Ana Maria
  • 475
  • 2
  • 11
0
votes
4 answers

Why do we use synchronized collection if it doesn't guarantee the synchronized access on iterators?

For example, in the code below, we have to wrap list in a synchronized block when doing the iteration. Does the Collections.synchronizedList make the list synchronized? Why do we do this if it doesn't provide any convenience? Thanks! List
0
votes
1 answer

How to properly have multiple threads access shared buffer

I have a Producer/Consumer situation where producer produces domains for the consumer to visit. The Consumer sends a https request and grabs the links from the page and submits them back to the producer. When the Producer finishes, the consumer does…
Kabone
  • 85
  • 5
  • 13