JAVA
共 167 篇文章
Shallow and retained sizes
1:Shallow and retained sizes http://www.yourkit.com/docs/11/help/sizes.jsp yourkit分析工具的文档,有图示说明。 2:Shallow and retained heap http://publib.boulder.ibm.com/infocenter/hctool/v1r0/index.jsp?topic=%2Fcom.ibm.java.diagnostics.memory.analyzer.doc%2Fshallowretainedheap.html IBM 文档中的解释,概念上多了个Retained set …
2012-10-01 16:50 · JAVA
期待JVM Diagnostics API
突然看到一个JSR JSR 326: Post mortem JVM Diagnostics API http://jcp.org/en/jsr/detail?id=326 描述如下: A standard Java API designed to support the generation and consumption of post mortem or snapshot Java diagnostic artefacts. 很期待这样的api出来,同时看目前已有的解决方案 1) HPROF: http://java.sun.com/developer/technicalArticle…
2012-09-28 00:15 · JAVA
收集一些java相关的文章
有些文章看了,以后想再看已经忘了在哪里了。故在此一一记录下那些值得看的文章。 1:如何确定Java对象的大小 中文版本 : http://article.yeeyan.org/view/104091/62930?from_com 原版: http://www.jroller.com/maxim/entry/again_about_determining_size_of 该文章中谈及了3种方法来确定java对象的大小,最后一种方法使用到了JDK提供的新的api。 该方法与visualVM以及btrace中的sizeOf方法得到的值都一样。 2:常用 Java Profiling 工具的分析与比…
2012-09-25 10:48 · JAVA
disruptor Concurrent Programming Framework
1: disruptor High Performance Inter-Thread Messaging Library http://code.google.com/p/disruptor/ 2:Dissecting the Disruptor: Why it's so fast (part one) - Locks Are Bad http://mechanitis.blogspot.com/2011/07/dissecting-disruptor-why-its-so-fast.html 3:Dissecting the Disruptor: Why it's so fast (par…
2012-08-19 17:26 · JAVA
GC 问题知识点收录
经常遇到各种GC造成的小问题干扰,不搞清楚细节就很烦,所以开始一点点收集信息便于以后排查问题。 1:gc log中显示 Full GC (System) 字样是什么意思。 具体可见下面这篇文章 http://stackoverflow.com/questions/6626680/does-java-garbage-collection-log-entry-full-gc-system-mean-some-class-called 总结下就是 调用了System.gc()后打印的FullGC log 2:如何查看谁调用了System.gc() 这个可以使用Btrace 中的jstack功能,代…
2012-04-28 16:23 · JAVA
异步方式调用同步方法
系统中同步方法很多,当串行时响应时间会比较长,有些调用可以异步来做,当需要结果时只要有就行。如果调用的方法本身就是异步的这个还好。但是因为很多方法都是同步实现的,所以急需要一种框架或者工具来实现同步方法的异步调用,我搜索了下没找到比较好的解决方案,不过也有一些可供参考的,这里总结下: 1:NET Framework提供的异步调用同步方法 使用异步方式调用同步方法 http://msdn.microsoft.com/zh-cn/library/2e08f6yc(v=vs.80).aspx 截取API使用方式如下: // Create the delegate. AsyncMethodCalle…
2012-03-16 21:11 · JAVA
java.lang.reflect.MalformedParameterizedTypeException
尝试spring3.0的新特性,在原本是spring207,spring256混杂的工程里引入了spring3.x然后很简单的一个bean初始化失败,报以下异常 Caused by: java.lang.reflect.MalformedParameterizedTypeException at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(Unknown Source) at sun.reflect.generics.reflectiveObjects.Pa…
2012-03-14 13:44 · JAVA
jdk debug
debug 到JDK的代码时,有时看不到一些调试信息,例如行号,局部变量的值等,为了排查问题,当然希望能知道这些调试信息了,故找了下带调试信息的jdk版本叫fastdebug。 首先给出下载链接,这里只找到JDK6的,没有JDK7的 http://download.java.net/jdk6/6u25/promoted/b03/index.html windows 版本 http://www.java.net/download/jdk6/6u25/promoted/b03/binaries/jdk-6u25-ea-bin-b03-windows-i586-debug-27_feb_2011.…
2012-03-13 20:03 · JAVA
Java thread priority
比较好的java书上都写着不要试图用java线程的优先级来确定线程的执行顺序,不过知道下java线程优先级与底层OS之间线程优先级的映射关系也是好的,找了篇文章总结的不错。 转载自: http://www.javamex.com/tutorials/threads/priority_what.shtml What is Java thread priority ? In our introduction to thread priority , we pointed out some problems with the system, notably differences between …
2012-03-13 09:38 · JAVA
Java thread model
这里记录些关于线程模型方面的资料。 1:thread wiki http://en.wikipedia.org/wiki/Thread_(computing) 可以看看线程模型以及对应的实现方式有哪些。 2:Solaris Threading Models http://java.sun.com/docs/hotspot/threads/threads.html 主要是讲述solaris上线程模型和java线程模型的对应 3:Threading models: So many different ways to get stuff done http://timetobleed.com/th…
2012-03-12 11:01 · JAVA
设置JDK内部log输出
有的时候需要调试到JDK内部的类。有时没有对应的源码(当然可以从openjdk下载了),但是有些JDK内部类有自己的trace log 用于跟踪调试使用,其中使用的logger是JDK自带的logger,与log4J设置配置不同,这里给出一般的简单设置。 Logger log =Logger.getLogger("javax.management.remote.rmi"); log.setLevel(Level.ALL); Handler handler = new java.util.logging.ConsoleHandler(); handler.setLevel(Level.ALL)…
2012-03-09 14:10 · JAVA
maven download source
经常会被人问,maven如何下载源码,好吧,有的时候真的记不住那些配置,参数,所以还是放blog里记录下 这里我自己使用的方式有2种; 1:项目配置级别的,这样配置以后每次打包编译都会去下载源码 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.4</version> <configuration> <downloadSources>false</downloadSources> </configuration> </plu…
2012-03-02 13:48 · JAVA
JMF Linux headless
需要在无GUI环境的linux上调试JMF程序,这个时候一般设置headless=true ,结果遇到一个异常 javax.media.NoPlayerException: Error instantiating class: com.sun.media.content.unknown.Handler : java.awt.HeadlessException at javax.media.Manager.createPlayerForSource(Manager.java:1502) at javax.media.Manager.createPlayer(Manager.java:500) …
2012-03-01 20:54 · JAVA
JMF Supported Formats
帮朋友调试一个JMF的程序,发现换个格式的文件就不行了,故想找下JMF支持哪些格式的文件。官网有详细的说明,故在此记录下。 不能播放的格式一般报如下的错误: Cannot find a Player for: com.sun.media.protocol.file.DataSource 1:官方比较详细的 JMF 2.1.1 - Supported Formats http://www.oracle.com/technetwork/java/javase/formats-138492.html 2:官方泛泛的说明 What media types does JMF 2.1.1 support…
2012-02-29 01:48 · JAVA
Eclipse classpath file format
经常遇到eclipse中jar依赖问题,每次都需要看eclipse生成的classpath文件,为了有个权威的说明,故找来了这个文件的格式说明(真不好找>_^),为了确保内容以后不丢失,我先放一份在blog里。 转载自: http://www.ibm.com/developerworks/opensource/tutorials/os-eclipse-classpath/section2.html Simplify Eclipse classpaths using classpath containers Introduction to classpath containers Classp…
2012-02-27 16:25 · JAVA
java.awt.headless=true相关资料
之前一篇文章讲述linux如何转发jconsole的图形结果,其中涉及到 java.awt.headless=true,这次有朋友遇到这个问题,问题也查了半天未帮助其解决,为了更加详细的了解这个参数,故找了一些资料。 1:官方JDK中对于headless的支持说明 http://docs.oracle.com/javase/1.4.2/docs/guide/awt/AWTChanges.html#headless 重点在于: Many of the methods in Toolkit and GraphicsEnvironment, with the exception of fonts,…
2012-02-22 16:14 · JAVA
jps java.io.tmpdir相关bug记录
再次遇到jps与java.io.tmpdir的坑,讨论了半天虽然有解决方法,但是都不理想,最后还是“撒迦”大神拨开云雾见青天的给我们讲诉了来龙去脉,真是幸福啊,哈哈。 好了,这总结下一些相关bug,便于以后查阅。 1:当指定了java.io.tmpdir后jps无效 jps not found the pid whit "-Djava.io.tmpdir" http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7021676 2:当指定了java.io.tempdir后visualvm 无效 (需要仔细多读) Fix for 6938627 b…
2012-02-21 11:03 · JAVA
eclipse插件 find java source
经常遇到一些第三方的jar包没有源代码 ,故会去下面这个网址搜索 http://www.javasourcecode.org/html/open-source 有时打开浏览器不方便,故希望能有个eclipse插件能做这件事,刚好对eclipse插件开发感兴趣,故花了一晚上开发出这个插件,方便在eclipse里直接访问网址查询源码。 该插件主要是用于查询开源的 java类文件的源代码,故如果是用户自己写的类是不能查询到的。至于能查的范围在javasourcecode上列出如下: Browse Open Source Java Code Online Ant Commons HttpClient…
2011-12-29 23:23 · JAVA
apache mod_jk timeout
有个页面渲染时间太长结果就被转到错误页面去了,故查了apache的timetou 以及mod_jk的timeout,收集了一些资料记录下: 1:apache httpd.conf Timeout http://httpd.apache.org/docs/2.0/mod/core.html TimeOut Directive Description: Amount of time the server will wait for certain events before failing a request Syntax: TimeOut seconds Default: TimeOut 30…
2011-12-29 15:21 · JAVA
groovy 动态执行script文档汇总
对于有些需求不用动态脚本来做就特别麻烦,故有了groovy之后,能在线写代码然后执行再修改这种感觉很好,之前有使用过groovy。这次再重新写个轮子来满足需求,特此将一些文档记录在此 Embedding Groovy (官方文档) http://groovy.codehaus.org/Embedding+Groovy Groovy Goodness: Add Imports Transparently to Scripts with ImportCustomizer (一系列的关于groovy的tips) http://mrhaki.blogspot.com/2011/06/groovy-g…
2011-12-23 16:46 · JAVA