12 2012 档案
摘要:ConcurrentHashMap是JDK 1.5推出的类,性能上比HashTable和Collections.synchronizedMap(new HashMap())快很多。看此类源码最好和HashTable对比理解,会发现它的优化,此类一出HashTable可废。优化的方向,降低读对锁的依赖,写都是加锁。一,主要是用了分离锁1.概括结构如下,可以简单理解成把一个大的HashTable分解成多个,形成了锁分离。ConcurrentHashMap默认是分离了16个模块,即理想状态下能有16个线程同时并发(指要修改的map处于不同的模块之中)。采用分离锁可以避免无意义的等待,相比。在Hash
阅读全文
摘要:起因:故尝试调试下HashMap实现原理,打印出transient Entry<K,V>[] table 变量的变化情况一,在hashmap中加入打印调试信息hashmap的实现就是用一个Entry的对象数组Entry中存next形成链,链用于储存key有相同hashcode但key的equas不同的entry,这个网上有很多相关分析;那么我现在尝试在hashmap这个类中加入监控信息用来展示它的实现原理打开JDK的源码(基于1.6),并在HashMap类中加入新的方法用于打印调试信息,即HashMap中table对象数组变量的变化 1 public String getTable
阅读全文
摘要:1. build a environment of the test first of all . create the branch like belowD:\gitTest\Download4Http>git branch Bensonhe-dev change-branch dev master merge-branch * rebase-branchthen change something on change-branch and commit it as node “changeA” .and change it again and...
阅读全文
摘要:step 1make sure you have install the JDK ,eclipse ,GITyou can find the new revision Spring project in https://github.com/SpringSource/spring-frameworkstep 2clone the project from the server by HTTP or SSH or any way that you like.examplestep 3build and import spring project to eclipse workstationbef
阅读全文