RSS feed [root] /weblog /java



title search:


Wed Jun 23 23:53:07 AEST 2021


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

Fri Mar 10 20:49:16 AEDT 2017 From /weblog/java/concurrency


putall can cause ConcurrentModifcationException -[..]ses/sun/management/

Note on writing CopyOnWrite wrapper -[..]

Sometime this is a bit difficult for Chinese to be a good programmer, recently some colleague and me discuss about the behaviour of this class and look like we have difficult understanding

A: ConcurrentHashMap support for locking as this is thread-safe
B: ConcurrentHashMap is thread safe for read but not for write because there is no lock, we still need to have external lock to keep it thread safe. By the way, I get ConcurrentModificationException from this before.
C: ConcurrentHashMap don't support for locking but they still thread safe for all operations, which is how "This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details." mentioned.

Too good that we can actually take a look at the source code to see what going on nowadays rather than just guessing -[..]HashMap&sourceid=opera&ie=utf-8&oe=utf-8 By the way, this constructor is useful for a lot of concurrency access but actually not many developer notice about this -[..]rrentHashMap.html#ConcurrentHashMap(int, float, int)

Lazy initialization of map values -[..]

HashMap.get() can cause infinite loop -[..]5/07/hashmapget_can_cause_an_infini.html

Discussing the effect of initCapacity() of HashMap in Java -[..]ltimatebb.cgi?ubb=get_topic&f=1&t=021171

OpenJDK and HashMap …. Safely Teaching an Old Dog New (Off-Heap!) Tricks -

We can run search in ConcurrenctHashMap -

(google search) (amazon search)

Wed Feb 15 20:35:52 AEDT 2017 From /weblog/java/libraries


Discussion of difference Java base object to object mapper -[..]013/10/java-object-to-object-mapper.html

Some information about JOOQ -

(google search) (amazon search)

Tue Jan 03 12:45:40 AEDT 2017 From /weblog/java/concurrency


Similar to Barrier -

An example, show how to coordinate producer and consumer with Phaser -[..]08/java-7s-jucphaser-short-tutorial.html

When to use CountDownLatch, Semaphore, CyclicBarrier, Exchanger and Phaser -

(google search) (amazon search)

Sat Dec 03 12:41:11 AEDT 2016 From /weblog/java/libraries

code generation

DSL of code generation -[..]e-codemodel-to-generate-java-source.html

jannocessor/ -[..]8/java-code-generation-with-jannocessor/

Living in the Matrix with Bytecode Manipulation -[..]cles/Living-Matrix-Bytecode-Manipulation[..]cles/Living-Matrix-Bytecode-Manipulation

(google search) (amazon search)

Tue Nov 29 14:43:01 AEDT 2016 From /weblog/java/features


We can link java source in javadoc page:[..]amere/Weblog/cool_javadoc_trick#comments[..]/inheriting-javadoc-method-comments.html

(google search) (amazon search)

Tue Oct 11 03:24:40 AEDT 2016 From /weblog/java/libraries


Good thing about LogBack -[..]your-java-logging-with-7-logback-tweaks/

Configuring how exception stack traces appear in log entries using Log4J2 -[..]ies-using-log4j2-e3a3dc5e48bc#.vfx1l1jlr

(google search) (amazon search)

Fri Oct 07 02:58:24 AEDT 2016 From /weblog/java/concurrency


ReentrantReadWriteLock -[..]loperworks/library/j-jtp10264/index.html

why it suppose to be faster than VM level lock -[..]sr.166-concurrency/2005-02/msg00031.html and a test about it -[..]r/2011/11/java-lock-implementations.html

Samples of how to use it, and how to write test cases about it -

Some useful VM parameter to tune the locks: -XX:+EliminateLocks , -XX:+DoEscapeAnalysis , -XX:+UseBiasedLocking -[..]locking-escape-analysis-for-dummies.html

Discuss about 3 difference lock for Java, bias, thin and fat -

Why using the read lock will make lock detector fail -[..]concurrency-hidden-thread-deadlocks.html

Basic of synchronization and locking -[..]about-synchronization-in-java-and-scala/

Better semaphore with striped api -

Comparing and discuss difference locking approach -

Compare performance behavior of RWLock, StampedLock and Optimistic lock -[..]ocks-vs-readwritelocks-and-synchronized/

Comparing sync and lock -[..]ase-study-in-analysing-latency-lock.html

(google search) (amazon search)

Tue Jul 05 18:29:21 AEST 2016 From /weblog/java/concurrency


(google search) (amazon search)

Thu Dec 24 14:18:13 AEDT 2015 From /weblog/java/swing


(google search) (amazon search)

Fri Dec 18 19:06:33 AEDT 2015 From /weblog/java/libraries


I think this will be a cool API that enable developer to use openoffice at their code. However there is not much tutorial / guide. Here are 2 I known

Other than that, Lotus release an eclipse base Office suit recently, we suppose able to program using this, if there is no obfuscation -

Generate Graph directly -[..]2/create-charts-in-excel-using-java.html

Alternative to POI, jXLS -[..]ing-excel-file-into-javabeans-using.html

Using POI to update MS Word document -

(google search) (amazon search)

Mon Dec 14 17:18:15 AEDT 2015 From /weblog/java/libraries


A complaint about media support, turn out attract a lot of library pointers:[..]/29/video-support-on-java-found-lacking/

Music -[..]/3wjuuc/java_music_software_development/

(google search) (amazon search)

Mon Dec 07 14:34:53 AEDT 2015 From /weblog/java/libraries


Convert HTML to PDF -
Using Apache FOP:
Or using native library:

Generate barcode -

(google search) (amazon search)

Tue Dec 01 13:06:11 AEDT 2015 From /weblog/java/performance


Use of LatencyUtil -[..]ime-and-latency-measurements-119298.html

performance-problems-pre-production-tests -[..]roblems-pre-production-tests-114128.html

(google search) (amazon search)

Mon Nov 09 18:46:49 AEDT 2015 From /weblog/java/performance


Another blog of discussion of difference profiler -

Introduction to jmap, visualvm and btrace -

JMP is an easy to setup and provide real time data choice. However it will crash JVM occasionally. So may be the one using web interface is better for us:

Articles -
Onjava -
Eclipsecolorer profiler, however that plugin require you install binary yourself, somehow tedious if you move from one machine to another machine -[..]tss?l=EclipseProfiler&asrc=EM_NLN_476666

A total java version of profiler!!:

Few other profiler haven't get time to try:

Eclipse plugin:

Need $$:

See if the information useful.

How to measure with less than milli second -[..]15/10/measuring-microsecond-in-java.html

(google search) (amazon search)

Mon Sep 21 13:47:50 AEST 2015 From /weblog/java/discussion


(google search) (amazon search)

Wed Sep 16 17:47:28 AEST 2015 From /weblog/java/libraries


Tutorial of an object query language -

(google search) (amazon search)

Fri Aug 07 18:51:03 AEST 2015 From /weblog/java/discussion


java-server-application-troubleshooting-using-jdk-tools -[..]ication-troubleshooting-using-jdk-tools/

(google search) (amazon search)

Mon Jul 06 11:26:54 AEST 2015 From /weblog/java/libraries



Some say this is the fastest -

(google search) (amazon search)

Fri Mar 27 20:19:52 AEDT 2015 From /weblog/java/performance

java performance summary

A short summary of various aspect about performance -[..]07/07/javaone-talk-on-performance-myths/

Any other discussion -[..]eloperworks/java/library/j-jtp09275.html

Paper to show some prevalent methodologies can be misleading, and can even lead to incorrect conclusions. -[..]lly-rigorous-java-performance-evaluation

Discussion about various issue on microbenchmark, try to do premature optimzation -[..]/performance-anxiety-on-performance.html

Java vs C performance... again...[..]2009/09/java-vs-c-performance-again.html[..]-easy-performance-optimisations-in-java/

(google search) (amazon search)

Tue Feb 10 20:33:40 AEDT 2015 From /weblog/java/performance

various tips

-XX:+TieredCompilation, -XX:+UseCompressedOops, Escape Analysis and -XX:+UseNUMA -[..]uides/vm/performance-enhancements-7.html

Interestingly, PrintWriter, if pooled, shows considerable performance improvement. The creation of the object is expensive because of a call to get the line separator in its constructor.[..]/08/experiences-in-java-performance.html

Experience in twitter -

Cases study on how to test performance from using difference GC algo -

A lot of information -[..]-1-of-3-synopsis-of-articles-videos.html

Basically use lower level construct -[..]-easy-performance-optimisations-in-java/

(google search) (amazon search)

Tue Dec 23 19:38:16 AEDT 2014 From /weblog/java/performance


Comparing the Java Serialization Options -[..]_id=57871&asrc=EM_NLN_9286283&uid=703565

Use Unsafe for best performance Serialization -[..]native-cc-like-performance-for-java.html

off heap serialization -[..]/a-persistent-keyvalue-server-in-40.html

(google search) (amazon search)

Sun Dec 14 12:38:06 AEDT 2014 From /weblog/java/fundamental

createTempFile() will not delete after JDK quit... which I also suppose it will

List of issue about File api, which I totally agree.

delete() will delete the file immediately even using some 3rd undelete utility cannot recover , I think the implementation should allow recovery chance -[..]es/000574_java_delete_to_recycle_bin.php

(google search) (amazon search)

Sun Dec 14 12:37:13 AEDT 2014 From /weblog/java/fundamental


One fact of System.nanoTime() ,
I think System.nanoTime()'s contract right now is that it *always*
increases by a fixed amount. In other words, it's monotonic. So NTP
updates, or user's changing system time can never cause any change to

A more detailed explanation of nanoTime() and currentMilliSecond() -[..]nverting-from-joda-time-to-javatime.html

(google search) (amazon search)

Wed Nov 05 01:55:09 AEDT 2014 From /weblog/java/eclipse


A tip of how to debuy any application remotely in eclipse[..]y=debugging_any_application_with_eclipse

List of eclipse plugins with code checking[..]ava/library/j-ap01117/index.html?ca=drs-

A list of good eclipse tutorial[..]tes/440/Best-27-Eclipse-Tutorials-by-IBM

A list of useful plugins for netbeans[..]/abien?entry=over_eclipsed_10_reasons_to

A list of useful tools which can use with or without IDE, like ant, p6spy[..]ge/abien?entry=some_useful_tools_for_the

A very good way to editing source code at remote unix machine, integrate eclipse and vim -

GUI test -[..]documents/userguides/Intro-Auto-GUI.html

How to get old eclipse version -[..]w-to-find-other-versions-of-eclipse.html

Nice example of customizing code template -

How to make swt test work for all platform -[..]clipse-swt-linux-library-td19103219.html

Fix copy and paste in Java -

Fix the autocomplete of eclipse! -[..]how-to-make-eclipse-autocomplete-to.html[..]27/top-5-useful-hidden-eclipse-features/

Using favourite -[..]27/top-5-useful-hidden-eclipse-features/

(google search) (amazon search)