RSS feed [root] /weblog /java



title search:


Wed Jun 23 23:53:07 AEST 2021


(google search) (amazon search)
download zip of files only

Wed Aug 24 02:55:53 AEST 2011 From /weblog/java/libraries

Code Inspection

Comparison of difference static code analysis -[..]rar/archive/2006/11/talking_about_s.html


(google search) (amazon search)

Tue Aug 16 01:40:53 AEST 2011 From /weblog/java/performance


Offline parsing heap dump, good for analysis huge heap dump at server with GTK -[..]index.php?t=rview&goto=703990#msg_703990

Nice explanation of GC -[..]sualising-garbage-collection-in-the-jvm/

Get call back for memory allocation, should be very useful -[..]s/applying-kanban-to-it-processes-part-2

Detailed discussion of analysis memory consumption in Java -[..]mory-consumption-of-netbeans-versus.html

it probably one of the nicest feature of java 5 - dump VM for you to analyst[..]apdumponoutofmemoryerror_option_in_5_0u7

This article present a simple, and possible not accurate method to track object creation and finalization. May be not that useful in general but sometime is convenience -

checking memory consumption at object level -[..]im?entry=again_about_determining_size_of

Sun contain a nice library for we to investigate heap stat -[..]om/2005/01/java-equivalent-of-heap1.html

Use java.util.Observable to Monitor Object State changes -

(google search) (amazon search)

Mon Jun 27 02:27:08 AEST 2011 From /weblog/java/concurrency


A nice list of hints about concurrency in java -[..]c_burke_java_concurrency_by_example.html

Testing about java parallel processing -[..]ng-and-multi-core-utilization-with-java/

Some concurrency basic information -

Tutorial of concurrency package -

Using Latch with Executor -[..]06/new-shimmer-for-java-concurrency.html

(google search) (amazon search)

Sun May 15 04:01:11 AEST 2011 From /weblog/java/fundamental


Add custom classloaders to compilation classpath: "javac -J-Djava.system.class.loader=my.custom.ClassLoaderImpl"[..]read.jspa?messageID=87728&tstart=0#87728

Possible NULL from static fields... which is documented behaviours -[..]2-puzzling-class-field-hellip-read.shtml

Comparing Class.getResourceAsStream() and bundle.getEntry(), point out some issues of using Class.getResourceAsStream() -

Basic of classloader -[..]rstanding-and-extending-java-classloader[..]chnicalArticles/Networking/classloaders/

(google search) (amazon search)

Thu May 05 10:35:19 AEST 2011 From /weblog/java/features


A summary -[..]d-to-Make-Developers-More-Productive.htm

concurrency improvement -

Finally it is confirmed -

You can do this in Java7, look pretty nice
catch (SQLException | IOException) {

(google search) (amazon search)

Sun Apr 24 03:44:47 AEST 2011 From /weblog/java/fundamental


Here is a mailing list message that tell why we need to serialize logger, sometime there are more need to have for sometime, but we need to do it very careful:[..]

A link that discuss various aspect of binary or xml (i.e. plain text) serialization, worth to keep as reference[..]f?entry=java_serialization_binary_or_xml

Basic question about serialization -[..] , a long article explaining that

Why we have to put serialziation id in serializable class... -

Show cast of test if all object in session can be serialized -

Interview questions -[..]top-10-java-serialization-interview.html

(google search) (amazon search)

Sun Apr 10 11:54:33 AEST 2011 From /weblog/java/performance

dynamic compilation

Introduce the idea of using dynamic compilation to replace reflection using Janino - , but actually reflection isn't that slow -[..]1/01/is-java-reflection-really-slow.html

How to use eclipse compiler as API -[..]atch%20compile/batchCompile.html?rev=1.2

Support of annotation -

Some cases that block method inlining -[..]f/2011-04-04-fixing-the-inlining-problem

(google search) (amazon search)

Sat Mar 26 04:44:46 AEDT 2011 From /weblog/java/eclipse


(google search) (amazon search)

Wed Feb 16 04:16:05 AEDT 2011 From /weblog/java/concurrency


Here is an tricky concurrency concern in Java when using Anonymous Inner Class with ExecutorService, if you use collection from outside class, that collection actually a global variable in the Inner Class, and need to take care the issues happened in concurrency access.

For this class:

public static void main(String[] args) throws InterruptedException {
ExecutorService es = Executors.newFixedThreadPool(80);
final List list = new ArrayList();
for (int i = 0; i < 100000; i++)
es.execute(new Runnable() {
public void run() {
list.add(new String());
while (true) {
boolean terminated = es.awaitTermination(5, TimeUnit.SECONDS);
if (terminated) {
for (String string : list) {
if (string == null)
System.out.println("Have null");

actually same as

private static final class RunnableImpl implements Runnable {
private final List mList;
private RunnableImpl(List list) {
mList = list;

public void run() {
mList.add(new String());
public static void main(String[] args) throws InterruptedException {
ExecutorService es = Executors.newFixedThreadPool(80);
final List list = new ArrayList();
for (int i = 0; i < 100000; i++)
es.execute(new RunnableImpl(list));
/** @formatter:on */
while (true) {
boolean terminated = es.awaitTermination(5, TimeUnit.SECONDS);
if (terminated) {
for (String string : list) {
if (string == null)
System.out.println("Have null");

(google search) (amazon search)

Tue Feb 08 04:38:39 AEDT 2011 From /weblog/java


Sample to write custom indexer for lucent:

Overview of Antlr, Martin Fowler think it is better than SableCC -

JMS performance test -[..]t/ipoint?SelectedPage=69&110ArticleID=17

Six JDK Classes You Think You Know

1) java.lang.Double.MIN_VALUE, it is not negative number
2) java.lang.Thread.setDefaultUncaughtExceptionHandler and java.lang.Runtime.addShutdownHook can have racing
3) java.util.Properties.load
4) java.lang.String.getBytes
5) Use update row, java.sql.ResultSet.updateRow

(google search) (amazon search)

Fri Jan 28 01:41:09 AEDT 2011 From /weblog/java/discussion


A lot of difference implementation of factorial -

(google search) (amazon search)

Wed Dec 15 03:30:18 AEDT 2010 From /weblog/java/concurrency


Why we need volatile in MT access -[..]age/sundararajan?entry=is_this_mt_safe_i

Sync. and set array -[..]attern%2C-way-to-common-td16061045.html: No such file or directory

Java Concurrency Gotchas - ttp://[..]xmiller/java-concurrency-gotchas-3666977

(google search) (amazon search)

Fri Jun 04 04:21:24 AEST 2010 From /weblog/java/concurrency


But look like very useful:

Profile the contention of lock -

(google search) (amazon search)

Thu Dec 31 20:29:28 AEDT 2009 From /weblog/java/eclipse


Ctrl + Shift + O : Organize imports

Ctrl + Shift + T : Open Type

Ctrl + Shift + F4 : Close all Opened Editors

Ctrl + O : Open declarations

Ctrl + E : Open Editor

Ctrl + / : Line Comment

Alt + Shift + R : Rename

Alt + Shift + L : extract to Local Variable

Alt + Shift + M : extract to Method

F3 : Open Declaration

CTRL-3: Quick Access

CHTL-H: Search & Replace

ALT-SHIFT-X: Run As ......

ALT-SHIFT-D: Debug As ......

ALT-SHIFT-Q: Open View ......

CTRL-TAB / SHIFT-CTRL-TAB: cycle open editors

Alt+Shift+Up - select whole string , if press multiple time, can select whole method. If select more than want, Alt+Shift+Down to reverse -[..]hods-in-eclipse-with-a-single-keystroke/[..].com/2007/09/15/top-10-eclipse-shotcuts/

HoverToViewSource , but not working for me... -

(google search) (amazon search)

Thu Dec 03 18:41:18 AEDT 2009 From /weblog/java/features


Use java.lang.instrument.Instrumentation; for profiling -

(google search) (amazon search)

Thu Dec 03 18:23:22 AEDT 2009 From /weblog/java/fundamental


An article show how java treat enum internally -

Look like it is "replace switch with polymorphism -[..]working-with-java-enumerated-types-enums

(google search) (amazon search)

Mon Jul 27 03:08:14 AEST 2009 From /weblog/java/hacks


How to get line number of specific stacktrace
private static void log(String prefix,
String message) {

StackTraceElement ste =
new Exception().getStackTrace()[2];

System.out.println("[" + prefix + "] " +
ste.getClassName() + "." +
ste.getMethodName() + "(" +
ste.getLineNumber() + "): " +

Annotation of using stacktrace -[..]m/news/thread.tss?thread_id=55238#312195

(google search) (amazon search)

Fri Dec 26 04:15:04 AEDT 2008 From /weblog/java/servlet


A collections of tools -[..]onsSecure&asrc=EM_NLN_5417965&uid=703565

(google search) (amazon search)

Tue Sep 09 02:42:44 AEST 2008 From /weblog/java/concurrency


Series about using functional library to ease the development of concurrency application[..]allel-strategies-and-the-callable-monad/[..]008/06/30/parallel-list-transformations/[..]7/28/threadless-concurrency-with-actors/

(google search) (amazon search)

Tue Mar 18 04:25:28 AEDT 2008 From /weblog/java/hacks


if you do a “kill -3? of the java process id, it dumps a stack trace of every thread, including what locks it’s holding, to stdout. -[..]ie-says-kill-3-pid-is-my-new-best-friend

At windows, it is ctrl-break

(google search) (amazon search)

Tue Mar 18 04:25:28 AEDT 2008 From /weblog/java/features


Using JCE with OpenSSL -[..]ive/src/java/jce-openssl-redux.writeback

---------- Forwarded message ----------
From: "cab"
Date: 10 Mar 2005 23:33:16 +0800
Subject: Re: CRC-32 crc32 = new;
long crcValue = crc32.getValue();

"Day Chan" 撰寫於郵件新聞:4230a15b$
> Does anyone know how to calculate CRC-32 in Java?
> Thanks~

(google search) (amazon search)

Mon Jan 07 18:05:06 AEDT 2008 From /weblog/java/swing


Comparing SWT tableviewer and Swing jtable -[..]1/jface-tableviewer-vs-swing-jtable.html

(google search) (amazon search)

Mon Jan 07 18:03:59 AEDT 2008 From /weblog/java/fundamental


Some problems of cloning, include using copy constructor / clone() method -

(google search) (amazon search)

Thu Dec 20 14:34:00 AEDT 2007 From /weblog/java/eclipse


Tutorial -[..]ce/library/os-eclipse-snippet/index.html , shorter one -

Lotus higher level framework base on RCP -

Using M$ Office via OLE -[..]EclipseMicrosoftIntegration/article.html

Default open views dialogs - _showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(window);

Glimmer, DSL for building SWT interface for jruby -

(google search) (amazon search)