- 博客(263)
- 资源 (1)
- 收藏
- 关注
原创 JDK的动态代理
动态代理是Spring AOP的核心原理。以前一直停留在使用的表层认识上,这一阵子抽空研究了下。 先说下静态代理,静态代理每次只为一个类服务。而且需要为每个类编写代理类代码。动态代理的优势则在于,不用为每个代理类编写代码,而是自动根据Class的文件格式去拼装代理类的字节码。 DEMO 接口package reflect;/** * Created by cdlvsheng
2016-04-22 21:46:43 1980
原创 《Java并发编程的艺术》读书笔记:等待/通知机制
看这本书之前,对wait和notify认识大概就是,调用wait的线程A阻塞之后,一旦另外有线程调用notify方法,线程A会立刻从wait方法处返回。看完这本书后,发现自己的认识真实太肤浅了。。。。。。 线程调用wait()后,会释放已经获得的锁。同时进入Waiting状态,而非Blocked状态。只有等待其他的线程调用notify()方法且释放锁之后,当前线程才会从wait()方法处
2016-04-08 21:11:28 2889
原创 《Java并发编程的艺术》读书笔记:Fork/Join框架
JDK1.7提供的Fork/Join框架,用于把大任务拆解成小任务,多线程运行这些小任务,最后把小任务的结果求和。看到这个思想,是否觉得很熟悉?这个和算法里的分治算法如出一辙,Divide and Conquer,分而治之,各个击破。可以看做是分治算法的并行框架。从字面上理解,Fork,复制,把一个大任务切割并拷贝成多份小任务;Join,合并,把所有小任务的结果合并成大任务的结果。 这本
2016-04-04 16:18:21 3250
原创 《深入理解java虚拟机》读书笔记:Java对象的内存布局
一个int类型4占4个字节的内存,一个byte一个字节。但是他们的封装类型Integer,Byte对象内存损耗还是一样的吗?并不是,而且差距十分大。 HotSpot虚拟机中,一个普通的Java对象由3部分构成对象头类内定义的实例数据内存对齐 2不必多说,Java对象不存定义好的实例字段存啥。 对象头又分两部分,Mark Word和类型指针。Mark W
2016-03-30 21:46:50 2819 3
原创 mysql error code '1064' 排查过程
下午自测代码,在这个update上卡了一个半小时,大大的降低了开发的生产力,把排查过程发出来,好的士兵不会掉进同一个陷阱。先把异常堆栈打出来。2016-03-28 17:23:38.420 main DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory:463] - Finished creati
2016-03-28 18:02:59 33067 3
原创 LeetCode OJ 322. Coin Change DP求解
题目链接:https://leetcode.com/problems/coin-change/322. Coin ChangeMy SubmissionsQuestionTotal Accepted: 15289 Total Submissions: 62250 Difficulty: MediumYou are given
2016-03-17 01:11:11 2259
原创 solr单机多实例部署文件锁冲突解决办法
给出一个有问题的单机多tomcat实例引用同一个solr实例部署图。这种部署必然造成一个问题,启动第二个tomcat实例时,一定会报索引文件夹文件锁已经被占用。 最初的解决办法是,有多少个tomcat实例,就部署多少个solr的war包。然后依次修改每个solr的core的data路径。如此完成线上部署,实在麻烦,而且容易出错! 今天请教了位有多年solr经验的同事,终
2016-03-14 19:47:31 1998 5
原创 LeetCode OJ 238. Product of Array Except Self 解题报告
题目链接:https://leetcode.com/problems/product-of-array-except-self/238. Product of Array Except SelfMy SubmissionsQuestionTotal Accepted: 36393 Total Submissions: 87262 Difficul
2016-03-03 10:13:10 2017
原创 LeetCode OJ 56. Merge Intervals 贪心法求解
题目链接:https://leetcode.com/problems/merge-intervals/56. Merge IntervalsMy SubmissionsQuestionTotal Accepted: 60386 Total Submissions: 244495 Difficulty: HardGiven a
2016-03-01 20:05:54 1487
原创 LeetCode OJ 108. Convert Sorted Array to Binary Search Tree DFS求解
很有意思的一道题目。要求根据一个有序数组,构造出一棵高度平衡的BST。每次找到数组的中间位置,这个便是BST的 根节点。左右孩子也很好找,根节点左边区域的中间节点便是左孩子,根节点的右边区域的中间节点便是右孩子。如此递归求解108. Convert Sorted Array to Binary Search TreeMy SubmissionsQuestionTotal Accepted: 68378 Total
2016-02-25 19:35:34 2876
原创 LeetCode 113. Path Sum II DFS求解
题目链接:https://leetcode.com/problems/path-sum-ii/113. Path Sum IIMy SubmissionsQuestionTotal Accepted: 72944 Total Submissions: 262389 Difficulty: MediumGiven a binar
2016-02-25 14:53:45 1949
原创 LeetCode OJ Minimum Depth of Binary Tree 递归求解
题目URL:https://leetcode.com/problems/minimum-depth-of-binary-tree/111. Minimum Depth of Binary TreeMy SubmissionsQuestionTotal Accepted: 94580 Total Submissions: 312802 Diffic
2016-02-24 16:34:36 1188 2
原创 LeetCode 110. Balanced Binary Tree 递归求解
题目链接:https://leetcode.com/problems/balanced-binary-tree/ 110. Balanced Binary TreeMy SubmissionsQuestionTotal Accepted: 97926 Total Submissions: 292400 Difficulty: Easy
2016-02-23 16:28:36 1727 1
原创 LeetCode OJ 215. Kth Largest Element in an Array 堆排序求解
题目链接:https://leetcode.com/problems/kth-largest-element-in-an-array/215. Kth Largest Element in an ArrayMy SubmissionsQuestionTotal Accepted: 43442 Total Submissions: 136063 D
2016-02-23 14:00:40 3272 1
原创 LeetCode 144. Binary Tree Preorder Traversal 解题报告
144. Binary Tree Preorder TraversalMy SubmissionsQuestionTotal Accepted: 108336 Total Submissions: 278322 Difficulty: MediumGiven a binary tree, return the preorder traversal o
2016-02-22 14:45:10 1566 1
原创 LeetCode Oj 112. Path Sum 解题报告
112. Path SumMy SubmissionsQuestionTotal Accepted: 91133 Total Submissions: 295432 Difficulty: EasyGiven a binary tree and a sum, determine if the tree has a root-to-leaf path
2016-02-22 13:58:45 1639 1
原创 LeetCode 64. Minimum Path Sum 解题报告
64. Minimum Path SumMy SubmissionsQuestionTotal Accepted: 63385 Total Submissions: 185663 Difficulty: MediumGiven a m x n grid filled with non-negative numbers, find a path fro
2016-02-20 18:23:43 2517
原创 LeetCode 24. Swap Nodes in Pairs 解题报告
24. Swap Nodes in PairsMy SubmissionsQuestionTotal Accepted: 82451 Total Submissions: 239340 Difficulty: MediumGiven a linked list, swap every two adjacent nodes and return its
2016-02-20 17:31:56 1512
原创 LeetCode 257. Binary Tree Paths 解题报告
257. Binary Tree PathsMy SubmissionsQuestionTotal Accepted: 35264 Total Submissions: 130427 Difficulty: EasyGiven a binary tree, return all root-to-leaf paths.For example, gi
2016-02-20 16:41:00 844
原创 LeetCode 203. Remove Linked List Elements 解题报告
203. Remove Linked List ElementsMy SubmissionsQuestionTotal Accepted: 52116 Total Submissions: 187218 Difficulty: EasyRemove all elements from a linked list of integers that ha
2016-02-20 15:31:06 1736
原创 LeetCode 19. Remove Nth Node From End of List 解题报告
19. Remove Nth Node From End of ListMy SubmissionsQuestionTotal Accepted: 94847 Total Submissions: 330667 Difficulty: EasyGiven a linked list, remove the nth node from the end
2016-02-20 14:58:48 1060
原创 LeetCode 120. Triangle 解题报告
120. TriangleMy SubmissionsQuestionTotal Accepted: 62827 Total Submissions: 213725 Difficulty: MediumGiven a triangle, find the minimum path sum from top to bottom. Each step y
2016-02-19 18:24:22 1251
原创 LeetCode 129. Sum Root to Leaf Numbers 解题报告
129. Sum Root to Leaf NumbersMy SubmissionsQuestionTotal Accepted: 69249 Total Submissions: 216443 Difficulty: MediumGiven a binary tree containing digits from 0-9 only, each
2016-02-19 16:37:20 1267
原创 LeetCode 199. Binary Tree Right Side View 解题报告
199. Binary Tree Right Side ViewMy SubmissionsQuestionTotal Accepted: 34521 Total Submissions: 104860 Difficulty: MediumGiven a binary tree, imagine yourself standing on the ri
2016-02-19 15:25:49 1432
原创 LeetCode 80. Remove Duplicates from Sorted Array II 解题报告
80. Remove Duplicates from Sorted Array IIMy SubmissionsQuestionTotal Accepted: 66554 Total Submissions: 207698 Difficulty: MediumFollow up for "Remove Duplicates":What if du
2016-02-19 13:42:36 1530
原创 LeetCode 2. Add Two Numbers 解题报告
2. Add Two NumbersMy SubmissionsQuestionTotal Accepted: 120829 Total Submissions: 544194 Difficulty: MediumYou are given two linked lists representing two non-negative numbers.
2016-02-18 19:51:19 1423 1
原创 LeetCode 1.Two Sum 解题报告
1. Two SumMy SubmissionsQuestionTotal Accepted: 188053 Total Submissions: 888224 Difficulty: MediumGiven an array of integers, return indices of the two numbers such that they
2016-02-18 17:23:07 2539 1
原创 LeetCode 77. Combinations 解题报告
77. CombinationsMy SubmissionsQuestionTotal Accepted: 67261 Total Submissions: 201946 Difficulty: MediumGiven two integers n and k, return all possible combinations of k number
2016-02-18 14:03:18 2806
原创 LeetCode 94. Binary Tree Inorder Traversal 解题报告
94. Binary Tree Inorder TraversalMy SubmissionsQuestionTotal Accepted: 109988 Total Submissions: 284121 Difficulty: MediumGiven a binary tree, return the inorder traversal of i
2016-02-18 10:59:21 883
原创 LeetCode 268. Missing Number 解题报告
268. Missing NumberMy SubmissionsQuestionTotal Accepted: 38439 Total Submissions: 98366 Difficulty: MediumGiven an array containing n distinct numbers taken from 0, 1, 2, ...
2016-02-17 19:11:25 1184
原创 LeetCode 165. Compare Version Numbers 解题报告
165. Compare Version NumbersMy SubmissionsQuestionTotal Accepted: 45262 Total Submissions: 268639 Difficulty: EasyCompare two version numbers version1 and version2.If version
2016-02-17 17:16:02 865
原创 LeetCode 78. Subsets 解题报告
78. SubsetsMy SubmissionsQuestionTotal Accepted: 84229 Total Submissions: 276420 Difficulty: MediumGiven a set of distinct integers, nums, return all possible subsets.Note:
2016-02-17 09:09:55 2333
原创 LeetCode 300. Longest Increasing Subsequence 解题报告
300. Longest Increasing SubsequenceMy SubmissionsQuestionTotal Accepted: 17302 Total Submissions: 51952 Difficulty: MediumGiven an unsorted array of integers, find the length o
2016-02-16 19:35:07 4391
原创 LeetCode 230. Kth Smallest Element in a BST 解题报告
230. Kth Smallest Element in a BSTMy SubmissionsQuestionTotal Accepted: 35869 Total Submissions: 100057 Difficulty: MediumGiven a binary search tree, write a function kthSmalle
2016-02-16 15:27:50 2233
原创 LeetCode 136. Single Number 解题报告
136. Single NumberMy SubmissionsQuestionTotal Accepted: 113794 Total Submissions: 234460 Difficulty: MediumGiven an array of integers, every element appears twice except for on
2016-02-16 14:01:30 1921
原创 LeetCode 7 Reverse Integer 解题报告
7. Reverse IntegerMy SubmissionsQuestionTotal Accepted: 122383 Total Submissions: 519690 Difficulty: EasyReverse digits of an integer.Example1: x = 123, return 321Example2:
2016-02-16 11:24:36 996
原创 服务器磁盘爆满引发的dubbo请求超时问题
今天遇到了运用dubbo开发过程中经常遇到的问题,请求超时Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService. Tried 3 times of the prov
2016-02-15 16:35:35 15032 2
原创 The request sent by the client was syntactically incorrect ().问题排查
HTTP Status 400 -type Status reportmessagedescription The request sent by the client was syntactically incorrect ().Apache Tomcat/7.0.27 自从使用spring mvc框架后,就频繁遭遇这个问题。刚开始一般都是表单的n
2016-01-28 10:57:09 4488 2
原创 编码规范经验谈
接手3.0的项目接近两个Q,在阅读了这些代码的基础上开了一些新功能。对我们项目组的核心工程的代码有些批判的想法,现在拿来跟大家分享一下。计算机巨匠 Donald Kunth(《计算机程序设计的艺术》系列作者)有一句名言:程序是写给人看的,只是偶尔让机器执行一下。言辞颇为偏激,但是至少强调了一点,代码的可读性是十分重要的。一个大型的项目,一般会有10-20次的产品迭代,就我们IM这个可以做到
2016-01-25 10:53:19 1649
原创 Unable to locate Spring NamespaceHandler for XML schema namespace问题排查
今天接公司其他项目组的JSF外部服务接口,写单元测试的时候,报如下错误。Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative locati
2015-12-03 10:47:57 12618 3
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人