[Fb-contrib-commit] fb-contrib/samples BSB_Sample.java,1.2,1.3
Brought to you by:
dbrosius
|
From: Dave B. <dbr...@us...> - 2006-01-02 14:57:19
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13635/samples Modified Files: BSB_Sample.java Log Message: any load on the object that is the synchronizing object, is unsafe Index: BSB_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/BSB_Sample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- BSB_Sample.java 2 Jan 2006 03:41:07 -0000 1.2 +++ BSB_Sample.java 2 Jan 2006 14:57:11 -0000 1.3 @@ -6,7 +6,7 @@ private Object lock = new Object(); private Set<String> info = new HashSet<String>(); - public void testBeginBloated(int i, int j) + public void testFieldBeginBloated(int i, int j) { synchronized(lock) { @@ -16,4 +16,21 @@ info.add(sb.toString()); } } + + public void testLocalBeginBloated(int j) + { + Set<String> i = getInfo(); + synchronized(i) + { + StringBuffer sb = new StringBuffer(); + sb.append("Test"); + sb.append(j); + i.add(sb.toString()); + } + } + + public Set<String> getInfo() + { + return info; + } } |