[Fb-contrib-commit] fb-contrib/samples SCI_Sample.java,1.2,1.3
Brought to you by:
dbrosius
|
From: Dave B. <dbr...@us...> - 2005-11-11 03:05:55
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5813/samples Modified Files: SCI_Sample.java Log Message: add test to differentiate sync on the collection, vs. some other object Index: SCI_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/SCI_Sample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SCI_Sample.java 5 Nov 2005 02:23:26 -0000 1.2 +++ SCI_Sample.java 11 Nov 2005 03:05:40 -0000 1.3 @@ -93,4 +93,17 @@ } } } + + public void testSyncCollectionInOtherSync() + { + SortedMap<String, String> sm = Collections.synchronizedSortedMap(new TreeMap<String, String>()); + synchronized(this) + { + 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 |