RSS feed [root] /weblog /java



title search:


Wed Jun 23 23:53:07 AEST 2021


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

Tue Jun 09 02:02:20 AEST 2020 From /weblog/java/discussion


(google search) (amazon search)

Wed Jun 03 17:55:56 AEST 2020 From /weblog/java/discussion


How to write a (toy) JVM -

(google search) (amazon search)

Tue Jun 02 12:14:05 AEST 2020 From /weblog/java/libraries


Efficient Java Matrix Library (EJML) is a linear algebra library for manipulating real/complex/dense/sparse matrices. Its design goals are; 1) to be as computationally and memory efficient as possible for both small and large matrices, and 2) to be accessible to both novices and experts. These goals are accomplished by dynamically selecting the best algorithms to use at runtime, clean API, and multiple interfaces. EJML is free, written in 100% Java and has been released under an Apache v2.0 license. -

(google search) (amazon search)

Tue Jun 02 10:32:20 AEST 2020 From /weblog/java/features


JDK 14 Foreign-Memory Access API Overview -[..]-memory-access-api-overview-70951fe221c9

Pattern Matching for instanceof in Java 14 -[..]ttern-matching-for-instanceof-in-java-14

(google search) (amazon search)

Tue Jun 02 10:30:26 AEST 2020 From /weblog/java/features


The infamous sun.misc.Unsafe explained: object creation, native memory allocation, native concurrency -

Features that help for writing low latency application -[..]1/sunmiscunsafe-and-off-heap-memory.html

Tips of using unsafe -[..]

An overview of it -[..]A-Post-Apocalyptic-sun.misc.Unsafe-World[..]ine/the-unsafe-class-unsafe-at-any-speed

(google search) (amazon search)

Mon Apr 06 23:51:19 AEST 2020 From /weblog/java/network


(google search) (amazon search)

Sun Mar 29 21:15:44 AEDT 2020 From /weblog/java/concurrency


Even though

private List synchList = Collections.synchronizedList(new LinkedList());

is thread safe, serialize sync List is NOT thread safe for sure. The story is, if you only synchronized the collection, and if we try to get the iterator in concurrent access environment, it will throws currencymodificationexception .

For collection is small, may be making defensive copy is good. Otherwise, in java5, there is concurrency collection.


Map operation, include use of FutureTask and putIfAbsent() method from ConcurrentMap. -

Other then lterate through the elements, adding and removing elements can also be problem, this article document a few good cases about that -[..]en-a-synchronized-class-isnt-threadsafe/

Samples of using Queue.drainTo() -[..]rforming-fixed-amounts-of-work-with.html

Overview of blockingqueue -[..]/java-util-concurrent/blockingqueue.html

Simple benchmark -[..]jvm-performance-part-iii-concurrent.html

Multi-thread behaviour -[..]hread-safety-issues-with-vector-and.html

java.util.concurrent.ConcurrentHashMap VS openhft.collections.SharedHashMap -[..]autilconcurrentconcurrenthashmap-vs.html

Why are there so many concurrent queues implementations in Java? -

Why hashmap is not thread safe -[..]a-HashMap-is-considered-as-thread-unsafe

(google search) (amazon search)

Tue Feb 11 10:05:49 AEDT 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)

Tue Jan 28 21:48:00 AEDT 2020 From /weblog/java/concurrency


Another nice tutorial set of concurrency framework -

Java concurrency, Building and testing concurrent applications for the Java platform -[..]/training/kp/j-kp-concurrency/index.html

JVM concurrency: Java and Scala concurrency basics -[..]/java/library/j-jvmc1/index.html?ca=drs-[..]reading-interview-questions-answers.html

5 things you didn't know about ... Multithreaded Java programming -

266Threading Questions in Job Interviews (2/2) -

Parallel Collection Processing: Without Parallel Streams -

(google search) (amazon search)

Mon Jun 10 22:13:52 AEST 2019 From /weblog/java/string


Substring no longer just change offset -[..]hanges-to-stringsubstring-in-java-7.html

(google search) (amazon search)

Wed Apr 10 19:06:39 AEST 2019 From /weblog/java/performance


Improvement from io -> nio, then -> MappedByteBuffer -[..]blog&show=File-IO-in-Java.html&Itemid=29

How to improve performance by tuning the IO -[..]enefits-of-stream-buffering-in-Java.html

(google search) (amazon search)

Sun Mar 10 02:33:41 AEDT 2019 From /weblog/java/concurrency


(google search) (amazon search)

Sun Mar 10 02:32:04 AEDT 2019 From /weblog/java/performance


(google search) (amazon search)

Sat Jul 14 01:54:42 AEST 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)

Tue Feb 27 02:45:40 AEDT 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)

Fri Dec 29 20:51:28 AEDT 2017 From /weblog/java/tools


Compare between pulsar and Kafka -[..]ar-distributed-pub-sub-messaging-system/

(google search) (amazon search)

Tue Oct 31 13:18:25 AEDT 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)

Thu Sep 28 18:21:47 AEST 2017 From /weblog/java/concurrency


preventing false sharing with the @Contended annotation -[..]false-sharing-is-and-how-jvm-prevents-it

(google search) (amazon search)

Thu Aug 31 12:38:43 AEST 2017 From /weblog/java/tools


The jhsdb tool is described on its Oracle JDK 9 Documentation Early Access page, "You use the jhsdb tool to attach to a Java process or to launch a postmortem debugger to analyze the content of a core-dump from a crashed Java Virtual Machine (JVM)." The tool comes with several "modes" and several of these modes correspond in name and function with individual command-line tools available in previous JDK distributions. The jhsdb tool not only provides a single tool that encompasses functionality of multiple other tools, but it also provides a single, consistent approach to applying these different functions. For example, the jhsdb command-line syntax for getting help for each of the "modes" is identical.[..]UID-0345CAEB-71CE-4D71-97FE-AA53A4AB028E

(google search) (amazon search)

Fri Jun 02 19:55:34 AEST 2017 From /weblog/java/libraries


Introducing LALR parser in java -

(google search) (amazon search)

Thu May 18 12:28:15 AEST 2017 From /weblog/java/features


5 things you didn't know about ... Java Database Connectivity -

(google search) (amazon search)

Sun Mar 26 03:09:52 AEDT 2017 From /weblog/java/string


Introduction to a library which support faster regular expression processing:[..]ite/archive/2006/03/a_faster_java_r.html[..]-expression-library-benchmarks-2015.html

Regex helper -

java-regular-expressions-cheat-sheet -[..]abs/java-regular-expressions-cheat-sheet

(google search) (amazon search)