download zip of files only
Wed May 04 00:08:30 AEST 2022
From /weblog/java/hacks
Hint to prevent blocking of loadClass by using Thread.getContextClassLoader() - https://blog.fastthread.io[..]3/java-class-loading-performance-impact/
(google search)
(amazon search)
Sat Mar 19 23:00:19 AEDT 2022
From /weblog/java/concurrency
Just know that interrupt() call is just setting a flag, it have to be doing IO work (like database call), or in wait() status, before the thread can really be interrupted. http://blogs.sun.com[..]winger?entry=swingworker_stop_that_train Another nice explanation about interrupt, in summary: What should we do when we call code that may cause an InterruptedException? Don't immediately yank out the batteries! Typically there are two answers to that question: 1) Rethrow the InterruptedException from your method. This is usually the easiest and best approach. It is used by the new java.util.concurrent.* package [ http://java.sun.com[..]util/concurrent/Semaphore.html#acquire() ], which explains why we are now constantly coming into contact with this exception. 2) Catch it, set interrupted status, return. If you are running in a loop that calls code which may cause the exception, you should set the status back to being interrupted. For example: while (!Thread.currentThread().isInterrupted()) { // do something try { TimeUnit.SECONDS.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } } Remember the Law of the Sabotaged Doorbell - don't just ignore interruptions, manage them properly! - http://www.javaspecialists.eu/archive/Issue146.html Another blog explain about InterruptedException - http://www.nurkiewicz.com[..]terruptedexception-and-interrupting.html http://ocpsoft.org[..]running-infinite-java-regular-expression http://praveer09.github.io[..]derstanding-thread-interruption-in-java/ How to Stop a Java Thread Without Using Thread.stop()? - https://4comprehension.com[..]a-java-thread-without-using-thread-stop/
(google search)
(amazon search)
Mon Jan 10 00:41:28 AEDT 2022
From /weblog/java/features
Watch service, watch if directory changed - http://www.javacodegeeks.com/2012/02/java-7-watchservice.html Tips of using bytebuffer - http://worldmodscode.wordpress.com[..]2/14/the-java-bytebuffer-a-crash-course/ path : ..\.\Java.txt absolute path : C:\Users\WINDOWS 8\workspace\Demo\..\.\Java.txt canonical path : C:\Users\WINDOWS 8\workspace\Java.txt Read more: http://javarevisited.blogspot.com[..]getcanonicalpath-java.html#ixzz3A8Zya6YG Jump to a position of a file, inputstream.skip() is faster than reader.skip(), and reader.skip() is faster than randomAccessFile. Java & Files: An Introduction - https://www.marcobehler.com/guides/java-files Modern file input/output with Java: Going fast with NIO and NIO.2 - https://blogs.oracle.com[..]2-buffers-channels-async-future-callback
(google search)
(amazon search)
Thu Jan 06 00:07:30 AEDT 2022
From /weblog/java/tools
Generate a diff page forother toreview in HG - https://blogs.oracle.com/bondolo/entry/how_i_generate_a_webrev Introduce a tool to keep IDE code and webcontainer code in sync - http://techblog.bozho.net/?p=1246 Auto complete of IDEA is pretty cool - http://maciejwalkowiak.pl[..]aster-with-intellij-idea-live-templates/ use ctrl-w to select text - http://paulhammant.com[..]ins-ides-their-best-feature-is-control-w 7-new-tools-java-developers-should-know - http://blog.takipi.com/7-new-tools-java-developers-should-know/ Buggy App is a simple java application that simulates different performance problems like Memory Leak, OutOfMemoryError, CPU spike, thread leak, StackOverflowError, deadlock, unresponsiveness, … - https://blog.fastthread.io[..]buggy-app-simulate-performance-problems/ 13 Best Java Decompilers for Download and Online Use for Java Developers - https://www.javaprogramto.com/2021/11/java-decompiler.html Generate fake data - http://www.datafaker.net/
(google search)
(amazon search)
Thu Dec 02 12:03:52 AEDT 2021
From /weblog/java/performance
java -XX:+PrintFlagsFinal -version | findstr HeapSize , find out actual Xmx default in bytes - https://www.edureka.co[..]default-parameters-of-xms-and-xmx-in-jvm -XX:+PerfDisableSharedMem , prevent locking by sharedmem in linux - http://www.evanjones.ca/jvm-mmap-pause.html How linkedin turn the GC - http://engineering.linkedin.com[..]ughput-and-low-latency-java-applications Using generational & concurrent GC collector - http://www.javacodegeeks.com[..]/04/ibm-jvm-tuning-gencon-gc-policy.html Full VM option list : http://blogs.sun.com/roller/resources/watt/jvm-options-list.html, update for Java7 - http://nerds-central.blogspot.com[..]ot.com/2011/07/all-jvm-7-xx-options.html http://stas-blogspot.blogspot.com[..]ost-complete-list-of-xx-options-for.html A simplified list for some frequency use options - http://rdafbn.blogspot.com.au[..]rbage-collector-guidelines-and-tips.html HotSpot JVM garbage collection options cheat sheet - http://aragozin.blogspot.com[..]spot-jvm-garbage-collection-options.html http://www.oracle.com[..]va/javase/tech/vmoptions-jsp-140102.html An example and story about effect of difference VM parameter affecting the performance - http://www.javaspecialists.eu/archive/Issue191.html Clear the code cache automatically with -XX:+UseCodeCacheFlushing - http://blogs.amd.com[..]time-for-long-running-java-applications/ Discussion about -XX:MinHeapFreeRatio parameter - http://www.gossamer-threads.com[..]s.com/lists/lucene/java-user/44286#44286 The other detailed guide for VM parameters tuning - http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf Here is a more simple cookbook - http://java.sun.com/performance/reference/whitepapers/tuning.html A outdated (1.4) , compehensive but still not really too detailed, overview of various GC tuning - http://www.petefreitag.com/articles/gctuning/ Some say following VM parameter is good enough -server -Xmx -XX:+UseParallelGC http://blogs.sun.com[..]/page/binublog?entry=java_tuning_for_xml Some say is useful if you have huge memory -XX:+UseLargePages http://blogs.sun.com[..]dagastine?entry=java_se_tuning_tip_large Some say below parameter keep GC in low pause -XX:MaxGCPauseMillis=5000 Some say below parameter are very optimal -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:NewSize=1200m -XX:SurvivorRatio=16 http://www.theserverside.com[..]d.tss?thread_id=41258&ASRC=EM_NNL_347804 Some say those parameter is good -XX:+UseConcMarkSweepGC -XX:ParallelCMSThreads=1 -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing -XX:CMSIncrementalDutyCycleMin=0 -XX:CMSIncrementalDutyCycle=10 http://blog.mikiobraun.de/2010/08/cassandra-gc-tuning.html Just in case anyone is curious, the flags enabled by -XX:+AggressiveOpts in JDK 1.6.0_25 are: -XX:+EliminateAutoBox -XX:AutoBoxCacheMax=20000 -XX:BiasedLockingStartupDelay=500 -XX:+DoEscapeAnalysis -XX:+OptimizeStringConcat -XX:+OptimizeFill Generate dump with OOME - -XX:+HeapDumpOnOutOfMemoryError GC log sample of -XX:+UseConcMarkSweepGC -XX:PrintFLSStatistics=1 -XX:+PrintGCDetails - https://gist.github.com/1329783 A case study of tuning VM GC parameters - http://plumbr.eu[..]ld-you-trust-the-default-settings-in-jvm Explanation for few performance related VM parameters - http://www.techpaste.com[..]ine-options-jvm-performance-improvement/ Show the exact vm flag that java using - http://matthewkwilliams.com[..]/looking-inside-a-jvm-xxprintflagsfinal/ For G1GC - https://dzone.com[..]e-first-garbage-collector-tuning-flags-1 https://ionutbalosin.com[..]otspot-jvm-performance-tuning-guidelines
(google search)
(amazon search)
|