RSS feed [root] /weblog /java /fundamental




login:

password:

title search:




 


Thu Apr 06 06:33:18 GMT 2023

fundamental



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

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

constructor


Things I didn't know about Java: Generic Constructors - https://www.objectos.com.br/blog/java-generic-constructors.html

(google search) (amazon search)


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

data


Data in Java programs - a basic conceptual model - https://docs.google.com[..]TscD4uW2Qsbt5BlBR_7uX_BekwJ5BLSE/preview

(google search) (amazon search)


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

hash


JVM Anatomy Quark #26: Identity Hash Code - https://shipilev.net/jvm/anatomy-quarks/26-identity-hash-code

Hash, displace, and compress: Perfect hashing with Java - https://www.andreinc.net/2022/03/15/perfect-hashing-with-java

(google search) (amazon search)


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

language


Mirandas, bridges, overpasses - https://medium.com[..]mirandas-bridges-overpasses-50b25655bb4c

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

(google search) (amazon search)


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

finalization


http://java.sun.com[..]r/technicalArticles/javase/finalization/

Pitfall and solution of implementing finalize(), if you really need it http://www.hpl.hp.com[..]ns_Boehm/misc_slides/java_finalizers.pdf

Optimization-robust finalization - http://www.open-std.org[..]C1/SC22/WG21/docs/papers/2007/n2261.html

An example showing that memory leak caused by finalize() - http://vanillajava.blogspot.com.au[..].com.au/2012/12/object-resurrection.html

Beware the Finalizer queue, and java.lang.ref.Finalizer object - https://plumbr.eu/blog/debugging-to-understand-finalizer

try { return } finally {} - https://www.pixelstech.net[..]892842-try-%7B-return-%7D-finally-%7B%7D

(google search) (amazon search)


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

garbage


Some overview articles - http://javarevisited.blogspot.com[..]/2011/04/garbage-collection-in-java.html http://jeremymanson.blogspot.com[..]10/01/garbage-collection-references.html http://www.oracle.com[..]work/java/javase/gc-tuning-6-140523.html https://www.infoq.com[..]derstand-classic-java-garbage-collection

Interview with Azul, about the pauseless GC - http://www.infoq.com/interviews/gil-tene-azul-zing

A story of how to tune GC - http://kirk.blog-city.com/why_do_i_have_this_long_gc_pause.htm

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

Java memory configuration and monitoring - http://blog.codecentric.de[..]ry-configuration-and-monitoring-3rd-act/

How Garbage Collection differs in the three big JVMs - http://blog.dynatrace.com[..]ollection-differs-in-the-three-big-jvms/

Garbage Collection Bootcamp 1.0 - http://www.lucidimagination.com[..]1/03/27/garbage-collection-bootcamp-1-0/

http://javarevisited.blogspot.sg[..]ollection-interview-question-answer.html

How CMS work - https://blogs.oracle.com[..]thecollector/entry/hey_joe_phases_of_cms

Compare between difference VM - http://www.optaplanner.org[..]IsTheFastestGarbageCollectorInJava8.html

GC handbook - https://plumbr.eu/java-garbage-collection-handbook

Check what GC you are using - http://marxsoftware.blogspot.hk[..]16/04/determining-garbage-collector.html

About G1 Java Garbage Collector - http://dobbscodetalk.com[..]G1-Java-Garbage-Collector.html&Itemid=29

Tools to visualize GC - http://gceasy.io/

Visualizing difference algorithm - https://spin.atomicobject.com[..]sualizing-garbage-collection-algorithms/

safepoints - http://performantcode.com/gc/safepoints/

Few new GCs for huge heap - https://dzone.com/articles/java-garbage-collection-3

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. - https://blogs.oracle.com[..]agazine/understanding-garbage-collectors

JVM Pauses - It's more than GC - https://blanco.io/blog/jvm-safepoint-pauses/

Digging into Java Garbage Collection - https://www.reddit.com[..]5e/digging_into_java_garbage_collection/

(google search) (amazon search)


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

collections


Detailed decision of arraylist and linkedlist, consist of a lot benchmark results, take a look if interested: http://javachaos.crazyredpanda.com/?p=99

One bug from java HashMap explaining it can be difficult to achieve fail-fast - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6625725 http://java.dzone.com/articles/do-your-iterators-always-fail

Performance difference of difference collection - http://java-persistence-performance.blogspot.com[..]0/12/what-is-faster-jvm-performance.html http://leolewis.website.org[..]/2011/07/14/java-collection-performance/

A treelist implementation - http://binkley.blogspot.com/2007_02_01_archive.html

Implement LRU cache using LinkedHashMap - http://vanillajava.blogspot.com[..]11/06/java-secret-lru-cache-in-java.html

Problem of using soft-reference for automate cache clean up - http://comments.gmane.org[..]gmane.comp.java.jsr.166-concurrency/7982

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. - http://codingjunkie.net/guava-bloomfilter/

Comment of various collections library - http://plumbr.eu/blog/selecting-your-collections-library

List of FAQ of Java collections - http://www.journaldev.com[..]lections-interview-questions-and-answers

Java Collections – Performance (Time Complexity) - http://infotechgems.blogspot.com.br[..]1/java-collections-performance-time.html

Performance improvement for HashMap for Java8 - http://www.nurkiewicz.com[..]hashmap-performance-improvements-in.html

Introduction to GS collection - http://www.infoq.com[..]s/gs-collections-examples-tutorial-part1 http://www.infoq.com[..]s/gs-collections-examples-tutorial-part2

removeEldestEntry, interesting function of linkedhashmap - http://www.ageofjava.com[..]/prevent-your-caches-from-exploding.html

How new version of java help immutable style - https://dzone.com/articles/java-collections-are-evolving

https://blog.frankel.ch/map-merge-compute

Hash puzzle with stringbuilder - https://threadreaderapp.com/thread/1402520496143540228.html

(google search) (amazon search)


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

memory


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

Algorithm of determine suitable thread pool size - http://www.javacodegeeks.com[..]reading-stories-about-robust-thread.html

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

Chinese introduction of memory model - http://www.infoq.com/cn/articles/java-memory-model-1

Difference between PermGem and MetaSpace - http://javaeesupportpatterns.blogspot.com.au[..]02/java-8-from-permgen-to-metaspace.html

How many bytes a boolean value takes in Java? - https://www.pixelstech.net[..]many-bytes-a-boolean-value-takes-in-Java

🚀 Demystifying JVM Memory Management - https://foojay.io/today/demystifying-jvm-memory-management/

Quest to the OS: Java Native Memory - https://blog.picnic.nl[..]o-the-os-java-native-memory-5d3ef68ffc0a

(google search) (amazon search)


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

fields


http://mindprod.com/jgloss/transient.html

http://mindprod.com/jgloss/volatile.html

https://www.claudiodesio.com/posts/constants.html

(google search) (amazon search)


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

i18n


A very good tutorial of how to config and develop i18n web application
http://www.javaworld.com/javaworld/jw-05-2004/jw-0524-i18n_p.html

and a shorter one
http://www.arachna.com[..]/spidaman/20050215#a_java_i18n_checklist

and a tip
http://java.oreilly.com/lpt/a/1847

An introduction of a useful API for localized currency handling DecimalFormatSymbols
http://blog.marcnuri.com[..]mbols-DecimalFormat-DecimalFormatSymbols

Benchmark of various charset detector - http://fredeaker.blogspot.com[..]007/01/character-encoding-detection.html

Work with filename with non-ASCII char - https://webtide.com[..]-internationalization-and-normalization/

(google search) (amazon search)


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

crash


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. - https://inside.java/2021/02/12/deciphering-the-stacktrace/

(google search) (amazon search)


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

assemble


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

http://jasclipse.sourceforge.net/

An article about assemble Java - http://www.theserverside.com[..]s/content/GuideJavaBytecode/article.html

Overview of bytecode - http://arhipov.blogspot.com[..]/2011/01/java-bytecode-fundamentals.html http://www.javaadvent.com/2013/12/mastering-java-bytecode.html https://blog.jamesdbloom.com/JavaCodeToByteCode_PartOne.html

(google search) (amazon search)


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

object


We can control how the default hashcode return, and and what the difference of default hashcode between java7 and 8 - https://blog.codinghorror.com/complaint-driven-development/

http://sigpwned.com/2018/08/10/string-hashcode-is-plenty-unique/

https://shipilev.net/jvm/objects-inside-out

https://www.baeldung.com/jvm-measuring-object-sizes

(google search) (amazon search)


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

time


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

Java timezone ID reference - http://david.uebelacker.ch[..]etrive-locale-and-timezone-from-request/ http://tutorials.jenkov.com[..]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. - http://keyholesoftware.wordpress.com[..]1/joda-time-the-future-of-java-datetime/

http://blog.joda.org[..]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 - https://medium.com[..]r-for-external-interactions-cb7ce4a4f2cd

(google search) (amazon search)


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

number


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 - http://www.exploringbinary.com[..]when-converting-2-2250738585072012e-308/ http://bugs.openjdk.java.net/show_bug.cgi?id=100119

Compare performance between double and float - http://www.heatonresearch.com[..]-between-java%E2%80%99s-float-and-double

How to work correctly with double - http://vanillajava.blogspot.com.au[..]au/2014/07/compounding-double-error.html

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

(google search) (amazon search)


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

process


Execute and manage an external process from within Java - http://developer4life.blogspot.com.au[..]cuting-command-line-executable-from.html

http://fahdshariff.blogspot.hk[..]/java-9-enhancements-to-process-api.html

(google search) (amazon search)


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

java.lang.ref


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.

http://weblogs.java.net[..]las/archive/2006/05/understanding_w.html

The other valuable reference about object life cycle - http://java.sun.com[..]ormance/1st_edition/html/JPAppGC.fm.html

Incorrect use of reference can cause GC issue - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4405807

fews more related blog - http://www.egimaben.com[..]garbage-collector-and-reference-objects/ https://medium.com[..]in-java-and-why-they-matter-c04bfc9dc792

(google search) (amazon search)


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


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

type


Nice instanceof replacement - http://nurkiewicz.blogspot.com.au[..]anceof-operator-and-visitor-pattern.html https://github.com/nurkiewicz/typeof

http://interviewquestionjava.blogspot.hk[..]01/java-data-types-conversion-chart.html

How to use reflection to get the size of Primitive - http://marxsoftware.blogspot.com.au[..]rogrammatic-access-java-types-sizes.html

(google search) (amazon search)


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

instanceof


Nice instanceof replacement - http://nurkiewicz.blogspot.com.au[..]anceof-operator-and-visitor-pattern.html https://github.com/nurkiewicz/typeof

(google search) (amazon search)


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

equals


Mutable cause issue - http://www.artima.com/lejava/articles/equality.html

Very detail discussion about implementing equals - http://www.angelikalanger.com[..]avaSolutions/SecretsOfEquals/Equals.html http://www.angelikalanger.com[..]aSolutions/SecretsOfEquals/Equals-2.html

Example of implement and TEST equals - http://blog.springfuse.com[..]ng-various-equals-and-hashcode_3597.html

Consistent of equals and compareTo - http://blog.joda.org[..]/pitfalls-of-consistent-with-equals.html

(google search) (amazon search)


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

threaddump


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

(google search) (amazon search)


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

static


Loading and unloading static fields, unlocd the class - http://www.javacodegeeks.com[..]0/java-secret-loading-and-unloading.html

(google search) (amazon search)


Sat May 14 18:01:11 GMT 2011 From /weblog/java/fundamental

classloader


Add custom classloaders to compilation classpath: "javac -J-Djava.system.class.loader=my.custom.ClassLoaderImpl theSource.java"

http://forums.java.net[..]read.jspa?messageID=87728&tstart=0#87728

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

Comparing Class.getResourceAsStream() and bundle.getEntry(), point out some issues of using Class.getResourceAsStream() - http://www.eclipsezone.com/eclipse/forums/t101557.rhtml

Basic of classloader - http://www.journaldev.com[..]rstanding-and-extending-java-classloader http://java.sun.com[..]chnicalArticles/Networking/classloaders/

(google search) (amazon search)