Hi,
I was reading "Java Concurrency in Practice" (again!) when I (again!) stumbled
upon the 6th footnote p. 38 (my edition is from 2011)
You can find a summary at
https://www.goodreads.com/work/quotes/123207-java-concurrency-in-practice :
“Debugging tip: For server applications, be sure to always specify the
-server JVM command line switch when invoking the JVM, even for
development and testing. The server JVM performs more optimization than
the client JVM, such as hoisting variables out of a loop that are not
modified in the loop; code that might appear to work in the development
environment (client JVM) can break in the deployment environment (server
JVM)...(more explanation and examples)”
Since this book was written in 2006 for Java 5, I checked what the situation is
with Java 8
http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#compiler_types
http://blog.sokolenko.me/2014/11/javavm-options-production.html#make-server-a-server
Oracle says
“Since Java SE 5.0, with the exception of 32-bit Windows, the server VM will automatically be selected on server-class machines. The definition of a
server-class machine may change from release to release, so please check the appropriate ergonomics document for the definition for your release. For
5.0, it'sErgonomics in the 5.0 Java[tm] Virtual Machine <http://www.oracle.com/technetwork/java/ergo5-140223.html>.”
Hence Sokolenko's comment:
“Though this option is implicitely enabled for x64 virtual machines, it
still makes sense to use it as according to documentation behaviour
maybe changed in the future.”
So this is still true and I wonder if we should not add this option (and some others, see
Sokolenko's link above) in some ant targets like "start"
Opinions?
Jacques