本次利用rabbitmq作为中介,实现了简单的消息发送和消费,模式如下: 发送接收模式 官方的介绍文档可以转至链接:https://www.rabbitmq.com/tutorials/tutorial-one-java.html 常量定义: 发送端代码: 消费端代码: Read More
posted @ 2019-08-03 17:47 再见,少年 Views(262) Comments(0) Diggs(0) Edit
之前面试有被问到过,面试官很调皮,我擅长的点没有问,然后抽了一个点让我回答,这个点考察了源码的理解,当时只是大概记得是提前暴露,但是细节答得有些粗糙,特补充一下,,, 解决循环依赖的核心代码如上,首先会从singletonObjects缓存中取对象,如果对象不存在,但处于创建中,则加锁缓存,然后从提 Read More
posted @ 2019-07-20 23:01 再见,少年 Views(444) Comments(0) Diggs(0) Edit
项目中需要根据不同业务进行分库,首先是将业务不同业务映射到不同过的数据库( biz --> db,可能存在多对一情况), 查看springjdbc源码发现AbstractRoutingDataSource类作为一个数据源路由抽象类,可以担当这个事情,其设计思想也比较简单, 首先将多个数据源的映射关系 Read More
posted @ 2019-03-17 15:28 再见,少年 Views(703) Comments(0) Diggs(0) Edit
有道字典翻译接口: Read More
posted @ 2018-10-07 11:03 再见,少年 Views(508) Comments(0) Diggs(0) Edit
首先是tomcat容器启动,然后在容器初始化servlet时,会对DispatcherServlet类进行实例化,进行代码分析,查看DispatchcherServlet的类图如下: 可以看到,DispatcherServlet是符合servlet规范的,可以被tomcat容器作为servlet管理 Read More
posted @ 2018-07-14 21:45 再见,少年 Views(326) Comments(0) Diggs(0) Edit
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
posted @ 2018-02-05 21:15 再见,少年 Views(307) Comments(0) Diggs(0) Edit
,首先应该设置vm的网络,打开编辑-》虚拟网络编辑器,弹出框及具体设置如下图 2,选中相应的虚拟机,右键设置,并设置相应的选项,具体设置如下图 3.设置完成后,打开虚拟机,等待虚拟机启动后,输入命令ip addr,查看HWADDR的值,具体如下图所示: 还要查看vm所在宿主机的子网ip及掩码,这个在 Read More
posted @ 2018-01-01 17:34 再见,少年 Views(1547) Comments(0) Diggs(0) Edit
开发时从master分支切出一个新的开发分支,其主要操作流程如下: 1. 切换到被copy的分支(master),并且从远端拉取最新版本 $git checkout master $git pull 2. 从当前分支拉copy开发分支 $git checkout -b dev Switched to Read More
posted @ 2017-07-12 17:58 再见,少年 Views(290) Comments(0) Diggs(0) Edit
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
posted @ 2017-02-19 10:24 再见,少年 Views(148) Comments(0) Diggs(0) Edit
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
posted @ 2017-02-18 20:59 再见,少年 Views(126) Comments(0) Diggs(0) Edit