Posts

Showing posts from June, 2012

Odd practices in Java

Overview There are a number of practices in Java which oddly baffle me. Here are but a few. Using -Xmx and -Xms The option -Xmx is widely used to set the maximum memory size. As noted in the Java HotSpot VM Options  Options that begin with -X are non-standard (not guaranteed to be supported on all VM implementations), and are subject to change without notice in subsequent releases of the JDK.  So you would think that such a widely used option would not be non-standard any more.  In fact there is a standard option -mx and similarly -ms . I don't know why these standard options are not use more widely, or even documented. Using NIO for non-blocking IO only Non blocking IO was a new feature of NIO for sockets.  However, the default behaviour for NIO Socket is blocking. Files are only blocking in NIO. NIO2 provides an asynchronous interface, but does it by passing your request off to an ExecutorService (which is cheating ...