RSS feed [root] /weblog /java




login:

password:

title search:




 


Wed Jun 23 23:53:07 AEST 2021

java



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

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

Map


putall can cause ConcurrentModifcationException - http://cr.openjdk.java.net[..]ses/sun/management/Agent.java.sdiff.html

Note on writing CopyOnWrite wrapper - http://flyingspaniel.blogspot.com[..]ot.com/2010/12/copyonwrite-wrappers.html

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 - http://www.google.com[..]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 - http://java.sun.com[..]rrentHashMap.html#ConcurrentHashMap(int, float, int)

Lazy initialization of map values - http://artisans-serverintellect-com.si-eioswww6.com[..]ect-com.si-eioswww6.com/default.asp?W122

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

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

OpenJDK and HashMap …. Safely Teaching an Old Dog New (Off-Heap!) Tricks - http://www.infoq.com/articles/Open-JDK-and-HashMap-Off-Heap

We can run search in ConcurrenctHashMap - https://dzone.com/articles/concurrenthashmap-in-java8

(google search) (amazon search)


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

mapper


Discussion of difference Java base object to object mapper - http://halyph.blogspot.com.au[..]013/10/java-object-to-object-mapper.html

Some information about JOOQ - https://www.infoq.com/news/2017/02/data-geekery-releases-jooq-3-9

(google search) (amazon search)


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

synchronisers


Similar to Barrier - http://tech.puredanger.com/2008/07/08/java7-phasers/

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

When to use CountDownLatch, Semaphore, CyclicBarrier, Exchanger and Phaser - https://codurance.com/2016/08/24/the-java-synchronisers/

(google search) (amazon search)


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

code generation


DSL of code generation - http://namanmehta.blogspot.com.au[..]e-codemodel-to-generate-java-source.html

jannocessor/ - http://maciejwalkowiak.pl[..]8/java-code-generation-with-jannocessor/

Living in the Matrix with Bytecode Manipulation - https://www.infoq.com[..]cles/Living-Matrix-Bytecode-Manipulation http://www.infoq.com[..]cles/Living-Matrix-Bytecode-Manipulation

(google search) (amazon search)


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

javadoc


We can link java source in javadoc page: http://blogs.sun.com[..]amere/Weblog/cool_javadoc_trick#comments

http://marxsoftware.blogspot.hk[..]/inheriting-javadoc-method-comments.html

(google search) (amazon search)


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

log


Good thing about LogBack - http://www.infoq.com/news/2007/08/logback

http://blog.takipi.com[..]your-java-logging-with-7-logback-tweaks/

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

(google search) (amazon search)


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

Lock


ReentrantReadWriteLock - http://www-128.ibm.com[..]loperworks/library/j-jtp10264/index.html

why it suppose to be faster than VM level lock - http://osdir.com[..]sr.166-concurrency/2005-02/msg00031.html and a test about it - http://mechanical-sympathy.blogspot.gr[..]r/2011/11/java-lock-implementations.html

Samples of how to use it, and how to write test cases about it - http://www.javaspecialists.eu/archive/Issue152.html

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

Discuss about 3 difference lock for Java, bias, thin and fat - http://www.javacodegeeks.com/2011/05/how-jvm-handle-locks.html

Why using the read lock will make lock detector fail - http://javaeesupportpatterns.blogspot.com.au[..]concurrency-hidden-thread-deadlocks.html

Basic of synchronization and locking - http://www.takipiblog.com[..]about-synchronization-in-java-and-scala/

Better semaphore with striped api - http://codingjunkie.net/striped-concurrency/

Comparing and discuss difference locking approach - http://www.javaspecialists.eu/archive/Issue215.html

Compare performance behavior of RWLock, StampedLock and Optimistic lock - http://www.takipiblog.com[..]ocks-vs-readwritelocks-and-synchronized/

Comparing sync and lock - http://www.rationaljava.com[..]ase-study-in-analysing-latency-lock.html

http://vmlens.com/articles/reentrant-lock-cheat-sheet/

(google search) (amazon search)


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

race


http://vmlens.com[..]-or-how-to-find-an-irreproducable-bug-2/
http://vmlens.com[..]-java-race-conditions-with-tests-part-2/

(google search) (amazon search)


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

performance


https://pavelfatin.com/low-latency-painting-in-awt-and-swing/

(google search) (amazon search)


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

office


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

http://technology.amis.nl/blog/?p=1243
http://technology.amis.nl/blog/?p=1244

Other than that, Lotus release an eclipse base Office suit recently, we suppose able to program using this, if there is no obfuscation - http://symphony.lotus.com/software/lotus/symphony/home.jspa

Generate Graph directly - http://www.programming-free.com[..]2/create-charts-in-excel-using-java.html

Alternative to POI, jXLS - http://fahdshariff.blogspot.com.au[..]ing-excel-file-into-javabeans-using.html

Using POI to update MS Word document - http://www.infoq.com/articles/convert-microsoft-word-to-html

(google search) (amazon search)


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

media


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

Music - https://www.reddit.com[..]/3wjuuc/java_music_software_development/

(google search) (amazon search)


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

pdf


Convert HTML to PDF -
Using Apache FOP: http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html_p.html
Or using native library: http://www.allcolor.org/YaHPConverter/

Generate barcode - http://examples.javacodegeeks.com/core-java/itext-barcode-example

(google search) (amazon search)


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

measurement


Use of LatencyUtil - https://jaxenter.com[..]ime-and-latency-measurements-119298.html

performance-problems-pre-production-tests - https://jaxenter.com[..]roblems-pre-production-tests-114128.html

(google search) (amazon search)


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

profiler


http://java-performance.info/introduction-jmh-profilers/

Another blog of discussion of difference profiler - http://blog.orange11.nl/2012/03/13/java-profiler-comparison/

Introduction to jmap, visualvm and btrace - http://www.infoq.com/articles/java-profiling-with-open-source

JMP http://www.khelekore.org/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: http://oss.metaparadigm.com/jmemprof/

Articles -
Onjava - http://www.onjava.com/lpt/a/6689
Eclipsecolorer profiler, however that plugin require you install binary yourself, somehow tedious if you move from one machine to another machine - http://www.theserverside.com[..]tss?l=EclipseProfiler&asrc=EM_NLN_476666

A total java version of profiler!!: http://jiprof.sourceforge.net

Few other profiler haven't get time to try:
Free:
http://jcoverage.sourceforge.net/
http://www.tagtraum.com/gcviewer.html
http://profiler4j.sourceforge.net/
http://www.jamonapi.com

Eclipse plugin:
http://jmechanic.sourceforge.net/
http://eclipsecolorer.sourceforge.net/index_profiler.html
http://www.eclipse.org/mat/

Need $$:
http://www.ej-technologies.com/products/jprofiler/overview.html

See if the information useful.

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

(google search) (amazon search)


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

good


http://blog.jooq.org/2014/04/09/java-rocks-more-than-ever/

http://www.javacodegeeks.com/2015/09/advanced-java.html

(google search) (amazon search)


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

query


Tutorial of an object query language - http://www.javacodegeeks.com/2015/09/work-with-the-jooq-dsl.html

(google search) (amazon search)


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

support


java-server-application-troubleshooting-using-jdk-tools - http://java-performance.info[..]ication-troubleshooting-using-jdk-tools/

(google search) (amazon search)


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

httpclient


howto-create-https-connections-to-servers-with-self-signed-certificates-using-apache-jakarta-commons-httpclient-package

http://orangevolt.com[..]ache-jakarta-commons-httpclient-package/

Some say this is the fastest - http://ruedigermoeller.github.io/kontraktor/

(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 - http://codeperformance.com[..]07/07/javaone-talk-on-performance-myths/

Any other discussion - http://www-128.ibm.com[..]eloperworks/java/library/j-jtp09275.html

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

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

Java vs C performance... again... http://blogs.azulsystems.com[..]2009/09/java-vs-c-performance-again.html

http://blog.jooq.org[..]-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 - http://docs.oracle.com[..]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.

http://sachinhejip.blogspot.com[..]/08/experiences-in-java-performance.html

Experience in twitter - http://www.umbrant.com/blog/2012/twitter_jvm_tuning.html

Cases study on how to test performance from using difference GC algo - http://plumbr.eu/blog/g1-vs-cms-vs-parallel-gc

A lot of information - http://www.javaadvent.com[..]-1-of-3-synopsis-of-articles-videos.html

Basically use lower level construct - http://blog.jooq.org[..]-easy-performance-optimisations-in-java/

(google search) (amazon search)


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

serialization


Comparing the Java Serialization Options - http://www.theserverside.com[..]_id=57871&asrc=EM_NLN_9286283&uid=703565

Use Unsafe for best performance Serialization - http://mechanical-sympathy.blogspot.com.au[..]native-cc-like-performance-for-java.html

off heap serialization - http://java-is-the-new-c.blogspot.com.au[..]/a-persistent-keyvalue-server-in-40.html

(google search) (amazon search)


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

java.io.File


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

List of issue about File api, which I totally agree. http://hoskinator.blogspot.com/2006/06/using-file-class.html

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

http://blog.pengyifan.com/java-io-in-nutshell-22-case-studies/

(google search) (amazon search)


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

date


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
System.nanoTime().

https://jsr-310.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1282

A more detailed explanation of nanoTime() and currentMilliSecond() - http://blogs.sun.com/dholmes/entry/inside_the_hotspot_vm_clocks

http://blog.joda.org[..]nverting-from-joda-time-to-javatime.html

(google search) (amazon search)


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

tips


A tip of how to debuy any application remotely in eclipse
http://jroller.com[..]y=debugging_any_application_with_eclipse

List of eclipse plugins with code checking
http://www-128.ibm.com[..]ava/library/j-ap01117/index.html?ca=drs-

A list of good eclipse tutorial
http://www.intelligentedu.com[..]tes/440/Best-27-Eclipse-Tutorials-by-IBM

A list of useful plugins for netbeans
http://www.adam-bien.com[..]/abien?entry=over_eclipsed_10_reasons_to

A list of useful tools which can use with or without IDE, like ant, p6spy
http://www.adam-bien.com[..]ge/abien?entry=some_useful_tools_for_the

A very good way to editing source code at remote unix machine, integrate eclipse and vim - http://eclim.sourceforge.net/

GUI test - http://www.eclipse.org[..]documents/userguides/Intro-Auto-GUI.html http://jemmy.netbeans.org/

How to get old eclipse version - http://eclipser-blog.blogspot.com[..]w-to-find-other-versions-of-eclipse.html

Nice example of customizing code template - http://dev.eclipse.org/blogs/jdtui/2007/11/20/text-templates-1/

How to make swt test work for all platform - http://www.nabble.com[..]clipse-swt-linux-library-td19103219.html

Fix copy and paste in Java - http://www.luisdelarosa.com/2012/11/21/fixing-copy-in-eclipse/

Fix the autocomplete of eclipse! - http://ananthchellathurai.blogspot.com.au[..]how-to-make-eclipse-autocomplete-to.html

http://blog.jooq.org[..]27/top-5-useful-hidden-eclipse-features/

http://keyholesoftware.com/2014/02/25/developers-are-lazy/

Using favourite - http://blog.jooq.org[..]27/top-5-useful-hidden-eclipse-features/

(google search) (amazon search)