在jdk7下慎用String.intern()作为synchronized的对象锁
摘要:
有一段这样的代码:for (int i = 0; i pool = Interners.newWeakInterner();synchronized ( pool.intern("BizCode"+userId)){//TODO:something}API文档:http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Interners.html代码参考TEST类:https://chromium.googlesource.com/external/guava-libra 阅读全文
posted @ 2013-12-30 20:09 绝望生鱼片 阅读(10989) 评论(1) 推荐(1) 编辑