1. Java Memory model
execution engineer: java stack/pc registers/native|direct memory area/java heap/method area
volatile: thread = its own stack + memory cache inside CPU, volatile can make sure read/write directly to main memory data, not local cpu cache
2. Java GC
serial gc collector/parallel Scavenge/ConcurrentMS/G1
java heap:
new generation/old generation
new: eden+from/to survivor
xmn=xmx, survivorratio, newratio
Copy/Mark-Sweep/Mark-Sweep-Compact
parallel new
throughput first:
prallel old
response time first:
CMS
3. Inner Class and Static Inner Class
inner class contains a reference to its outer class, so it can access its outers‘ class member
Static inner class can only access static filed in its outer class, not require for outer class‘s instance to access static inner class
4. Java constructor
1
2
3
4
5
6
|
父类静态初始化块 子类静态初始化块 父类初始化块 父类构造函数 子类初始化块 子类构造函数 |
5. Collection (Wha‘ts the difference between List and Set)
java的集合是一种特别有用的工具类,大体上分为:Set、List和Map三种体系。其中Set代表无序、不可重复的集合;List代表有序、重复的集合;而Map则代表具有映射关系的集合(键值对)。JDK 1.5以后,Java增加了Queue体系集合,代表一种队列集合实现。
6. JUnit (setup/teardown)如何写case,如何测试exception
@Test (expected = org.springframework.dao.InvalidDataAccessApiUsageException.class)
7. Mock
@Before public void setUp() { context = new Mockery(); /* need to consider security testing in service layer */ SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken("Admin", "password")); riskRankDAO = context.mock(IRiskRankDAO.class); context.checking(new Expectations() { { oneOf(riskRankDAO).findAll(); will(returnValue(list)); oneOf(riskRankDAO).save(riskRank); will(returnValue(riskRank)); } }); riskRankSaved = riskRankService.save(riskRank); context.assertIsSatisfied(); assertSame("riskRankSaved: " + riskRankSaved.toString() + " riskRank: " + riskRank.toString(), riskRank, riskRankSaved);
8. TDD/Scrum
9. java xml 读写
DOM, DOM4j, JDOM, SAX
10. Java HashMap implementation & Map interface
hashmap internal data storage: array + link (String/enum is also stored in array), key and its hashcode is used to get value‘s storage index
internal stroage data structure: entry: final key, value, Entry<key, value> next, final hashcode
method: put/get/contains/putall/delete etc
put: use hashcode to calculate hash value and index it to [0,array.length-1],if array[i] is empty, point array[i] to new added entry, increase map size; if array[i] is not empty, check whether key exists in link, if yes, modify entry with new value, if not, set array[i] to new added entry and set new added entry‘s next to previous entry, increase hashmap‘s size, if array‘s capacity exceeds its‘ capacity factor (initialized length * factor),resize length = 2 * length. resize在多线程没保护的时候,不止会导致put/get失败,还要小心死锁死循环
remove: need to modify pervious entry‘s next if elements is not the first one in the link
11. Java hashmap and treemap的区别
hashmap is faster than treemap(red-black tree), treemap contains order
12. linux 常用命令
file related: ls, du/df, cat, vi
user related: chown,chmod,useradd,groupadd
network related: tcpdump, ifcfg,route,netstat
others: top, find,rpm,tar,grep, etc
13. JMS实现,Queue, Topic的区别
producer: destination.send(Message) destination: queue
consumer MDB: onMessage queue
Queue: point to point (1对1)
Topic publish/subscribe (1对多)
http://baike.baidu.com/subview/157103/12665866.htm?fr=aladdin
http://blog.csdn.net/cloud_ll/article/details/18228049
14.Spring 好处
Inverse of control /dependency inject
15. Core Java有些什么库
network/io|nio|aio/concurrent/collection/security/jdbc etc
16. synchronized
java同步,在1.6之前比java concurrent lock慢很多,1.6之后慢20%,1.7还有优化
synchronized用来保证多线程的排他访问,结合wait/notify实现线程通信,synchronzied锁对象,lock是Cpu原子锁
17. SQL inner/outer join
交/并集
18. SQL 语句调优
分页,某些语句设计是否合理,join/like少用
http://www.cnblogs.com/wxj1020/archive/2008/04/27/1173638.html
19. how to debug java OOM
a. what kind of oom: stack? method area? direct memory area? heap area?
b. heap area: jmap or HeapDumpOnOutOfMemoryError | gui: visualvm + plugins
c. dump file analysis: eclipse memory analyzer, check which class consumes big memories, check which object contains the class
d. From code, check how the class objects are released, what‘s the problem
原文地址:http://blog.csdn.net/cloud_ll/article/details/39249321