摘要:
引用 http://www.avricot.com/blog/?post/2010/05/03/Get-started-with-java-JVM-memory-(heap%2C-stack%2C-xss-xms-xmx-xmn...) -Xmx : max heap size (ex: -Xmx4g) -Xms : min heap size. (ex: -Xms2g) -Xmn : the size of the heap for the young generation Young generation represents all the objects which ... 阅读全文
摘要:
class MyResource implements Closeable{ @Override public void close() throw IOException{ }}try( myResource = newMyResource() ){ // no need to write finally block to release resource, java will automatially close this resource.}catch(Exception e){} 阅读全文
摘要:
问题 Dead lock in our App under some condition. Both database and application lock contributes to issue. The issue could be simplified to following model. Thread 1: Acquired DB Lock------------------||---------Try to get Application lockThread 2: Acquire Application lock------------||-----------Try .. 阅读全文
摘要:
引用文章Please refer to: http://coolshell.cn/articles/9606.html问题的症状从前我们的Java代码因为一些原因使用了HashMap这个东西,但是当时的程序是单线程的,一切都没有问题。后来,我们的程序性能有问题,所以需要变成多线程的,于是,变成多线程后到了线上,发现程序经常占了100%的CPU,查看堆栈,你会发现程序都Hang在了HashMap.get()这个方法上了,重启程序后问题消失。但是过段时间又会来。而且,这个问题在测试环境里可能很难重现。我们简单的看一下我们自己的代码,我们就知道HashMap被多个线程操作。而Java的文档说Hash 阅读全文