Update of /cvsroot/fb-contrib/fb-contrib/samples
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30417/samples
Modified Files:
SCI_Sample.java
Log Message:
if a synchronized collection has a synchronized block around it's iterator don't report it. -- for now. Revisit this later especially if the synchronizing object is not the collection itself.
Index: SCI_Sample.java
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/samples/SCI_Sample.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- SCI_Sample.java 4 Sep 2005 02:20:34 -0000 1.1
+++ SCI_Sample.java 5 Nov 2005 02:23:26 -0000 1.2
@@ -80,4 +80,17 @@
System.out.println(entry.getKey() + "=" + entry.getValue());
}
}
+
+ public void testSyncCollectionInSync()
+ {
+ SortedMap<String, String> sm = Collections.synchronizedSortedMap(new TreeMap<String, String>());
+ synchronized(sm)
+ {
+ Iterator<Map.Entry<String, String>> it = sm.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry<String, String> entry = it.next();
+ System.out.println(entry.getKey() + "=" + entry.getValue());
+ }
+ }
+ }
}
\ No newline at end of file
|