akshayyn / cloning

Automatically exported from code.google.com/p/cloning
Other
0 stars 0 forks source link

ConcurrentModificationException issue #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. when cloner copys a shared object
2. shared object's field is list, and list number changed
3. cloner will get ConcurrentModificationException in fastClone

What is the expected output? What do you see instead?
avoid ConcurrentModificationException

What version of the product are you using? On what operating system?
cloner 1.9.0

Please provide any additional information below.
I found can use CopyOnWriteArrayList to avoid this issue:

in FastClonerArrayList.java

List<Object> entrys = new CopyOnWriteArrayList<Object>();
        if (!al.isEmpty()) {
            entrys.addAll(al);
        }
for (final Object o : entrys) {
}

Original issue reported on code.google.com by caram...@gmail.com on 19 May 2014 at 1:01

GoogleCodeExporter commented 8 years ago
cloner doesn't manage sync. Think it as if you were cloning the object from 2 
threads, you would get ConcurrentModificationException, right?

Original comment by kostas.k...@googlemail.com on 19 May 2014 at 6:19

GoogleCodeExporter commented 8 years ago
yes, I clone a shared object, and if this object's field data changed, will get 
concurrent error, so maybe skip this issue, I already using shallow clone and 
deep clone partly to finish my work.

Original comment by caram...@gmail.com on 20 May 2014 at 11:31

GoogleCodeExporter commented 8 years ago
ok, cheers, yes cloner is not managing concurrency.

Closing the issue.

Original comment by kostas.k...@googlemail.com on 20 May 2014 at 2:37