Thursday, December 15, 2011

Maven2 → Maven3 migration - real life example

Couple of months after JDK 7 release I decided to update my projects to build on both new JDK and Maven3 (Maven2 previously). From JDK 7 I was expecting nothing new as the codebase of our projects should be migrated step by step as soon as the Ops start supporting new application servers that could run on Java 7. More important things were expected from Maven3, namely we wanted to shorten build time, that we already optimized by 20% using Maven2 by smart initialization of our unit tests (but that's another story). In this post I will explain what I had to change to make this happen.

Monday, December 05, 2011

FW: Garbage collection in HotSpot JVM

There is an excellent new post from Alexey Ragozin on JVM Garbage Collector:
http://www.dzone.com/links/r/garbage_collection_in_hotspot_jvm.html.
He posted almost all basics you should know about different types of GCs, how to enable them in HotSpot JVM and most importantly when to enable them.

Just go there and read it!

Friday, November 25, 2011

HotSpot (64bit server) hangs on socket read (JVM 1.7 bug?) - updated


Picture (c) Clker.com
Few days ago I started working on some maven-based project (Java 1.7.0) on my new laptop (with Windows 7 64bit installed) and I noticed that very often Maven 3 was stuck downloading JARs from the internet even though my internet connection was fine. I started investigating this issue and after checking thread dump and binary dump (DMP) I think I found a bug in HotSpot for 64bit Windows.

Wednesday, November 23, 2011

GC and preformance tuning for Tomcat (from VMware)

Coming back to my previous post "Beware of your GC": just yesterday Daniel Mikusa from VMware published his post "Performance Tuning the JVM for Running Apache Tomcat" which adds some more interesting information complementing my post. You could find "Selecting a Collector" section specifically interesting e.g.:

When you specify the option to run the concurrent collector, it is important to realize that garbage collection will happen concurrently with the application. This means that garbage collection will consume some of the processor resources that would have otherwise been available to the application. On systems with a large number of processors, this is typically not a problem. However, if your system has only one or two processors then you will likely want to enable the -XX:+CMSIncrementalMode option. This option enables incremental mode for the collector, which instructs the collector to periodically yield the processor back to the application and essentially prevents the collector from running for too long.

Enjoy!

Friday, November 18, 2011

Be aware of your GC

When you're learning Java and later developing your applications you usually tend to not to worry about the memory management - we have garbage collector after all, so what's to worry about. Surprisingly you should worry about memory in your Java applications as it's not that difficult to introduce memory leak after all.

Friday, July 29, 2011

Java 7 - it's here

Friday, July 22, 2011

JDK 7 is finally out...

...well, not yet but it will be in few days (Oracle Announces Release Date for Java 7). After Wikipedia "Java 7 (codename Dolphin) is an upcoming major update to Java, it has been launched on July 7 of 2011 and will be made available on July 28, 2011."

Here's the list of new features Java 7 will bring (consult JDK 7 project page for more details):

Features are listed in order, more or less, from lowest to highest in the overall JDK software stack.

vm JSR 292: Support for dynamically-typed languages (InvokeDynamic)
Strict class-file checking
lang JSR 334: Small language enhancements (Project Coin)
core Upgrade class-loader architecture
Method to close a URLClassLoader
Concurrency and collections updates
(jsr166y)
i18n Unicode 6.0
Locale enhancement
Separate user locale and user-interface
locale
ionet JSR 203: More new I/O APIs for the Java platform (NIO.2)
NIO.2 filesystem provider for zip/jar
archives
SCTP (Stream Control Transmission Protocol)
SDP (Sockets Direct Protocol)
Use the Windows Vista IPv6 stack
TLS 1.2
sec Elliptic-curve cryptography (ECC)
jdbc JDBC 4.1
client XRender pipeline for Java 2D
Create new platform APIs for 6u10 graphics features
Nimbus look-and-feel for Swing
Swing JLayer component
Gervill sound synthesizer [NEW]
web Update the XML stack
mgmt Enhanced MBeans

For me one of the most interesting changes are "Small language enhancements" that come from project Coin.
The goal of Project Coin is to determine what set of small
language changes should be added to JDK 7. That list is:
  • Strings in switch
  • Binary integral literals and underscores in numeric literals
  • Multi-catch and more precise rethrow
  • Improved type inference for generic instance creation
    (diamond)
  • try-with-resources statement
  • Simplified varargs method invocation

All Java developers have waited for this moment since December 2006 when JDK 6 was released. It was the longest and the most painful release in Java history. It took almost five years to do it while for previous versions the period between releases was more or less two years. Of course, five years waiting for new Java was the effect of many factors like problems of Sun (eventually bought by Oracle), making JDK an open source project and thus opening a pandora's box of non-open source licenses, etc.

But it's finally here.

Now we'll wait for JDK 8 with lambda expressions that were supposed to be delivered in version 7 but actually it's good that JDK guys decided to postpone some features to finally release it.

Enjoy and celebrate the new JDK 7.

Sunday, March 13, 2011

JBoss AS 5 Performance Tuning - book review


Picture (c) Packt Publishing
Some time ago I received a new book from Packt Publishing i.e. "JBoss AS 5 Performance Tuning". This book couldn't reach me at a better time - few weeks ago my team was also releasing a new software, web application deployed in JBoss 5.x. Let me just write that this books was very useful in this critical time.