之前面试有被问到过,面试官很调皮,我擅长的点没有问,然后抽了一个点让我回答,这个点考察了源码的理解,当时只是大概记得是提前暴露,但是细节答得有些粗糙,特补充一下,,, 解决循环依赖的核心代码如上,首先会从singletonObjects缓存中取对象,如果对象不存在,但处于创建中,则加锁缓存,然后从提 Read More
项目中需要根据不同业务进行分库,首先是将业务不同业务映射到不同过的数据库( biz --> db,可能存在多对一情况), 查看springjdbc源码发现AbstractRoutingDataSource类作为一个数据源路由抽象类,可以担当这个事情,其设计思想也比较简单, 首先将多个数据源的映射关系 Read More
首先是tomcat容器启动,然后在容器初始化servlet时,会对DispatcherServlet类进行实例化,进行代码分析,查看DispatchcherServlet的类图如下: 可以看到,DispatcherServlet是符合servlet规范的,可以被tomcat容器作为servlet管理 Read More
We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (global) inversions is the number of i < j with 0 <= i < j Read More
Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 代码如下: Read More
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S = "ADOBECOD Read More