RSS feed [root] /weblog /java /fundamental



title search:


Thu Apr 06 06:33:18 GMT 2023


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

Tue Aug 02 12:39:29 GMT 2022 From /weblog/java/fundamental


Things I didn't know about Java: Generic Constructors -

(google search) (amazon search)

Sun May 22 12:36:05 GMT 2022 From /weblog/java/fundamental


Data in Java programs - a basic conceptual model -[..]TscD4uW2Qsbt5BlBR_7uX_BekwJ5BLSE/preview

(google search) (amazon search)

Tue Mar 29 05:28:14 GMT 2022 From /weblog/java/fundamental


JVM Anatomy Quark #26: Identity Hash Code -

Hash, displace, and compress: Perfect hashing with Java -

(google search) (amazon search)

Tue Feb 01 13:48:54 GMT 2022 From /weblog/java/fundamental


Mirandas, bridges, overpasses -[..]mirandas-bridges-overpasses-50b25655bb4c

Understanding Java Compilation: From Bytecodes to Machine Code in the JVM -[..]mpilation-from-bytecodes-to-machine-code

(google search) (amazon search)

Mon Dec 27 14:55:27 GMT 2021 From /weblog/java/fundamental


Pitfall and solution of implementing finalize(), if you really need it[..]ns_Boehm/misc_slides/java_finalizers.pdf

Optimization-robust finalization -[..]C1/SC22/WG21/docs/papers/2007/n2261.html

An example showing that memory leak caused by finalize() -[..]

Beware the Finalizer queue, and java.lang.ref.Finalizer object -

try { return } finally {} -[..]892842-try-%7B-return-%7D-finally-%7B%7D

(google search) (amazon search)

Sun Sep 12 13:26:48 GMT 2021 From /weblog/java/fundamental


Some overview articles -[..]/2011/04/garbage-collection-in-java.html[..]10/01/garbage-collection-references.html[..]work/java/javase/gc-tuning-6-140523.html[..]derstand-classic-java-garbage-collection

Interview with Azul, about the pauseless GC -

A story of how to tune GC -

NewRatio ( XX:MaxNewSize ) is important, but usually ignored -[..]ector/entry/the_second_most_important_gc

Java memory configuration and monitoring -[..]ry-configuration-and-monitoring-3rd-act/

How Garbage Collection differs in the three big JVMs -[..]ollection-differs-in-the-three-big-jvms/

Garbage Collection Bootcamp 1.0 -[..]1/03/27/garbage-collection-bootcamp-1-0/[..]ollection-interview-question-answer.html

How CMS work -[..]thecollector/entry/hey_joe_phases_of_cms

Compare between difference VM -[..]IsTheFastestGarbageCollectorInJava8.html

GC handbook -

Check what GC you are using -[..]16/04/determining-garbage-collector.html

About G1 Java Garbage Collector -[..]G1-Java-Garbage-Collector.html&Itemid=29

Tools to visualize GC -

Visualizing difference algorithm -[..]sualizing-garbage-collection-algorithms/

safepoints -

Few new GCs for huge heap -

Objects are allocated with extra space for an indirection pointer. When the Java threads access the object, they first read the indirection pointer to see whether the object has moved. When the garbage collector moves an object, it updates the indirection pointer to point to the new location. New objects are allocated with an indirection pointer that points to themselves. Only when an object is copied during GC will the indirection pointer point to somewhere else. -[..]agazine/understanding-garbage-collectors

JVM Pauses - It's more than GC -

Digging into Java Garbage Collection -[..]5e/digging_into_java_garbage_collection/

(google search) (amazon search)

Mon Jul 12 14:21:23 GMT 2021 From /weblog/java/fundamental


Detailed decision of arraylist and linkedlist, consist of a lot benchmark results, take a look if interested:

One bug from java HashMap explaining it can be difficult to achieve fail-fast -

Performance difference of difference collection -[..]0/12/what-is-faster-jvm-performance.html[..]/2011/07/14/java-collection-performance/

A treelist implementation -

Implement LRU cache using LinkedHashMap -[..]11/06/java-secret-lru-cache-in-java.html

Problem of using soft-reference for automate cache clean up -[..]

if it claims that an element is contained in it, this might be in error, but if it claims that an element is not contained in it, then this is definitely true. -

Comment of various collections library -

List of FAQ of Java collections -[..]lections-interview-questions-and-answers

Java Collections – Performance (Time Complexity) -[..]1/java-collections-performance-time.html

Performance improvement for HashMap for Java8 -[..]hashmap-performance-improvements-in.html

Introduction to GS collection -[..]s/gs-collections-examples-tutorial-part1[..]s/gs-collections-examples-tutorial-part2

removeEldestEntry, interesting function of linkedhashmap -[..]/prevent-your-caches-from-exploding.html

How new version of java help immutable style -

Hash puzzle with stringbuilder -

(google search) (amazon search)

Thu Jun 24 13:58:59 GMT 2021 From /weblog/java/fundamental


From java code to java heap, detail of how java use memory -[..]rks/java/library/j-codetoheap/index.html

Algorithm of determine suitable thread pool size -[..]reading-stories-about-robust-thread.html

Detail of how to analysis how much memory you need -[..]m/2012/12/how-much-memory-do-i-need.html

Chinese introduction of memory model -

Difference between PermGem and MetaSpace -[..]02/java-8-from-permgen-to-metaspace.html

How many bytes a boolean value takes in Java? -[..]many-bytes-a-boolean-value-takes-in-Java

🚀 Demystifying JVM Memory Management -

Quest to the OS: Java Native Memory -[..]o-the-os-java-native-memory-5d3ef68ffc0a

(google search) (amazon search)

Sun Jun 20 12:54:51 GMT 2021 From /weblog/java/fundamental


(google search) (amazon search)

Mon Mar 08 05:05:16 GMT 2021 From /weblog/java/fundamental


A very good tutorial of how to config and develop i18n web application

and a shorter one[..]/spidaman/20050215#a_java_i18n_checklist

and a tip

An introduction of a useful API for localized currency handling DecimalFormatSymbols[..]mbols-DecimalFormat-DecimalFormatSymbols

Benchmark of various charset detector -[..]007/01/character-encoding-detection.html

Work with filename with non-ASCII char -[..]-internationalization-and-normalization/

(google search) (amazon search)

Sat Feb 13 14:24:00 GMT 2021 From /weblog/java/fundamental


In this post we will be looking at crash logs, the hs_err file, that is generated when the Java Virtual Machine crashes. Trying to find what is going wrong, and which component to blame, is important to understand how to interpret the crash log file. The focus will be on understanding the frames that make up the stack trace. -

(google search) (amazon search)

Fri Feb 12 00:37:17 GMT 2021 From /weblog/java/fundamental


The tool that allow you write JVM instruction using assemble like command

An article about assemble Java -[..]s/content/GuideJavaBytecode/article.html

Overview of bytecode -[..]/2011/01/java-bytecode-fundamentals.html

(google search) (amazon search)

Tue Jul 14 06:44:05 GMT 2020 From /weblog/java/fundamental


We can control how the default hashcode return, and and what the difference of default hashcode between java7 and 8 -

(google search) (amazon search)

Mon Feb 10 23:05:49 GMT 2020 From /weblog/java/fundamental


How difference platform implement nanoTime() -[..]12/02/what-is-behind-systemnanotime.html[..]62/is-system-nanotime-completely-useless

Java timezone ID reference -[..]etrive-locale-and-timezone-from-request/[..]m/java-date-time/java-util-timezone.html

setTimeZone affects calls to set(), but doesn’t change the existing Calendar time? So if we wanted to change the time zone we are working with, we have to adjust all the time fields too…but a SimpleDateFormatter still would show it as the current time zone. -[..]1/joda-time-the-future-of-java-datetime/[..]va-time-jsr-310-enhancements-java-9.html

deep dive into measuring time in Java - dihttps:[..]g-time-from-java-to-kernel-and-back.html

CronScheduler -[..]r-for-external-interactions-cb7ce4a4f2cd

(google search) (amazon search)

Fri Jul 13 15:54:42 GMT 2018 From /weblog/java/fundamental


double aDouble = 12345678912345678912345.0;
BigDecimal dd = new BigDecimal(aDouble);
System.out.println(dd); // print: 12345678912345679593472

String aString = "12345678912345678912345.0";
BigDecimal bd = new BigDecimal(aString);
System.out.println(bd); // print: 12345678912345678912345.0

Java Hangs When Converting 2.2250738585072012e-308 -[..]when-converting-2-2250738585072012e-308/

Compare performance between double and float -[..]-between-java%E2%80%99s-float-and-double

How to work correctly with double -[..]au/2014/07/compounding-double-error.html

Maybe handy api, Math.toIntExact(Long) -[..]t-conversion-of-long-to-int-in-java.html
Check the border cases -[..]consistent-operation-widen-rules-in.html[..]ava-conversion-puzzler-not-suitable.html

(google search) (amazon search)

Mon Feb 26 15:45:40 GMT 2018 From /weblog/java/fundamental


Execute and manage an external process from within Java -[..]cuting-command-line-executable-from.html[..]/java-9-enhancements-to-process-api.html

(google search) (amazon search)

Tue Oct 31 02:18:25 GMT 2017 From /weblog/java/fundamental


Overview of weak, soft and Phantom References
Second, PhantomReferences avoid a fundamental problem with finalization: finalize() methods can "resurrect" objects by creating new strong references to them. So what, you say? Well, the problem is that an object which overrides finalize() must now be determined to be garbage in at least two separate garbage collection cycles in order to be collected. When the first cycle determines that it is garbage, it becomes eligible for finalization. Because of the (slim, but unfortunately real) possibility that the object was "resurrected" during finalization, the garbage collector has to run again before the object can actually be removed. And because finalization might not have happened in a timely fashion, an arbitrary number of garbage collection cycles might have happened while the object was waiting for finalization. This can mean serious delays in actually cleaning up garbage objects, and is why you can get OutOfMemoryErrors even when most of the heap is garbage.

With PhantomReference, this situation is impossible -- when a PhantomReference is enqueued, there is absolutely no way to get a pointer to the now-dead object (which is good, because it isn't in memory any longer). Because PhantomReference cannot be used to resurrect an object, the object can be instantly cleaned up during the first garbage collection cycle in which it is found to be phantomly reachable. You can then dispose whatever resources you need to at your convenience.

Arguably, the finalize() method should never have been provided in the first place. PhantomReferences are definitely safer and more efficient to use, and eliminating finalize() would have made parts of the VM considerably simpler. But, they're also more work to implement, so I confess to still using finalize() most of the time. The good news is that at least you have a choice.[..]las/archive/2006/05/understanding_w.html

The other valuable reference about object life cycle -[..]ormance/1st_edition/html/

Incorrect use of reference can cause GC issue -

fews more related blog -[..]garbage-collector-and-reference-objects/[..]in-java-and-why-they-matter-c04bfc9dc792

(google search) (amazon search)

Sun Dec 14 01:38:06 GMT 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 01:37:13 GMT 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)

Tue Apr 22 05:08:26 GMT 2014 From /weblog/java/fundamental


Nice instanceof replacement -[..]anceof-operator-and-visitor-pattern.html[..]01/java-data-types-conversion-chart.html

How to use reflection to get the size of Primitive -[..]rogrammatic-access-java-types-sizes.html

(google search) (amazon search)

Tue Oct 22 16:11:36 GMT 2013 From /weblog/java/fundamental


Nice instanceof replacement -[..]anceof-operator-and-visitor-pattern.html

(google search) (amazon search)

Mon Nov 19 15:17:47 GMT 2012 From /weblog/java/fundamental


Mutable cause issue -

Very detail discussion about implementing equals -[..]avaSolutions/SecretsOfEquals/Equals.html[..]aSolutions/SecretsOfEquals/Equals-2.html

Example of implement and TEST equals -[..]ng-various-equals-and-hashcode_3597.html

Consistent of equals and compareTo -[..]/pitfalls-of-consistent-with-equals.html

(google search) (amazon search)

Thu Mar 01 14:38:45 GMT 2012 From /weblog/java/fundamental


The process of how to solve problem using thread dump is nice -[..]atform/how-to-analyze-java-thread-dumps/

(google search) (amazon search)

Sat Oct 29 18:36:23 GMT 2011 From /weblog/java/fundamental


Loading and unloading static fields, unlocd the class -[..]0/java-secret-loading-and-unloading.html

(google search) (amazon search)

Sat May 14 18:01:11 GMT 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)