差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
java:basic:string_intern [2015/04/27 18:44]
tony [How to?]
java:basic:string_intern [2015/04/28 10:29]
tony
行 13: 行 13:
 } }
 </​code>​ </​code>​
-最常見的法是在method上增加synchronized,+最常見的法是在method上增加synchronized,
 <code java> <code java>
 public synchronized ​ Object getCache(String key){ public synchronized ​ Object getCache(String key){
行 62: 行 62:
   * [[http://​www.cnblogs.com/​yhlx/​p/​3498387.html|在jdk7下慎用String.intern()作为synchronized的对象锁]]   * [[http://​www.cnblogs.com/​yhlx/​p/​3498387.html|在jdk7下慎用String.intern()作为synchronized的对象锁]]
   * [[http://​docs.guava-libraries.googlecode.com/​git/​javadoc/​com/​google/​common/​collect/​Interners.html|Guava - Interners]]   * [[http://​docs.guava-libraries.googlecode.com/​git/​javadoc/​com/​google/​common/​collect/​Interners.html|Guava - Interners]]
 +
 +=====    =====
 +----
 +\\
 +~~DISQUS~~