Saturday, May 10, 2008

JavaOne 2008 Conference (1) - Core Java

Java has been there for more than a decade. The JavaOne 2008 conference shows that the technology is maturing, new ideas keep coming, and lots of future opportunities are still finding their ways. Here are some of my notes on JavaOne 2008 on Core Java track.

Concurrency and Garbage-Collection

The discussion about Concurrency and Garbage-Collection is even hotter. They are popular for different reasons. Concurrency becomes a focus because of the population of multi-core chips. Ideally a multi-core chip should be able to execute our threaded code nicely in each core. However, in reality it is usually not the case. Even worse, the locking mechanism in modern virtual machines (doesn’t matter Java or .net) might become a bottleneck in the multi-core era. New building blocks are proposed in the conference. One example is the new keyword “atomic” to create a code block that can be committed or rolled-back. Intel also presented a hardware solution to support this atomic construct. Other system vendor has different opinion about this new proposal. Lock is difficult, but atomic might be even more difficult when real problem occur and debugging is needed.

Garbage-Collection (GC) is always a hot topic in Java. Every version of JRE has major improvement on Garbage-Collection. The non-deterministic nature of the GC makes Java VM a dangerous machine. With the modern 64-bit addressable environments, the problem is even worse. When JVM went into stop-the-world GC-cycle while under load, denial-of-service occurs. Real-time Java solves this issue by sacrificing the throughput. However, for enterprise JVMs with huge heap size, the stop-the-world problem remains due to heap fragmentation. Oracle-BEA announced the enterprise VM that has deterministic GC. I am very curious how it will perform running for weeks.

Hardware vendor’s involvements
I would think Java VM is an abstraction of execution environment that does not rely on any lower platform. Seems Java is significant enough nowadays that the hardware vendors are considering providing special instruction sets for the VM to improve their performance. I think the major reason for this to happen is the introduction of hypervisor on server virtualization. Hypervisor allows JVM and hardware (virtually) communicate in a different way. AMD CPU will provide a way to communicate with the JIT compiler when the JIT compiled binary does not perform as expected. Intel is proposing a transactional memory that allows Java to have a new way for dealing with concurrency. These kind of collaboration was usually been seen in Operating System level, such as AMD-Solaris, Intel-Mac OS X, or Wintel. It is nice to know that hardware vendors (other than Sun and ARM) want to accelerate Java platform too.

Instrumentation enhancements – VisualVM, JMX
I always feel Sun’s JVM monitoring technology fell behind IBM’s JVMs for at least five years. IBM’s JVM 1.4 has the whole stack of monitoring tool (through the expensive Tivoli). Seems the open community catches up quickly. Java 6 comes with instrumentation without performance impact or extra configuration. New JMX enhancement is coming up to allow single entry point for clustered environments.

VisualVM is a very sweet addition to the instrumentation world. It allows you to monitor your JVM performance in almost every aspect. It is for all Java VMs (well, all versions of Sun’s SE JVMs, to be specific), not just for ‘Enterprise’ containers. This means, it doesn’t cost you any money to see how your Virtual Machine is doing. No more guess using Windows Task Manager. Seems VisualVM will solve all the headaches.

Annotation explosion
Java 5 introduced a lot of feature in the language. Lots of features create more trouble than they were originally designed (such as Generics, Enum, and auto-boxing). A book is revised because of these troubles (Effective Java 2nd Edition; which is sold in JavaOne 2008 and the great Josh Bloch is signing it in person). I guess the only feature that does not cause as much confusion is the annotation. This year I see annotation everywhere. Sometimes I wonder how much is too much. I see a bad trend to use annotation to replace interface. The common pitch is “You don’t have to declare interface anymore.” This happens in the new JMX, the new EJB and many other places. Interface is one of the good reasons why Java programmers have better design concept than the programmers of other similar languages. I wonder why people would think it is an accomplishment by getting rid of the design.

Fragmented visions – modules, and “language improvements”
In my previous blog (in Chinese), I worried that the Java community will destroy themselves due to fragmented visions. Seems this is still ongoing. Despite of the matured OSGi framework, Java module system is under heavy development. It is assumed to be part of the Java 7. The new Java module system will be able to run OSGi bundle as a second-class citizen in the Java module system. OSGi already have the solution of lifecycle, versioning, modularization, and services. Java module system focuses on the first three, but not the services. It seems that these two groups still work separately, each claim they are focusing on different aspect of the same things.

Ever since Java 5 introduced the Generic, the community was excited about new language ideas. It seems that lots of people want to transform Java into the ultimate language – a programming language that has the good stuff of every other language. If that becomes true, Josh Bloch needs to write the third edition of Effective Java, and I might need to stand in the line to get the third edition signed three years later. Wait. Maybe that will not happen. Maybe when people realize how polluted Java is after all the ‘new idea’ introduced, people will simply move away from Java and move on to other language that really does the job better. Not long ago, fragmented visions collapse the C++ community and the creator (the uppercase AT&T) has no control over it. Will this happen when Java 7 releases with all new language keywords? Maybe Java 6 u10 is the last Java that the community will use?

New players: Scala, JRuby
Java platform is not about Java language anymore. Groovy got some attention a few years ago, and this year definitely JRuby is the hot thing on dynamic language. Surprisingly NetBeans become the best IDE of Ruby language. (Yes, it works with the native Ruby too.). JRuby sessions are so popular, and more people start doing Rail on their J2EE containers.
Scala is another language that people talking on the hallway. This is the first functional language that is build on top of Java’s runtime in the beginning. I have no idea what this is yet, but it seems this will be another cool stuff next year.
I didn’t notice there is a company called Azul systems that is good in Java appliances until JavaOne 2008. It seems that they are working on a lot of hard platform stuff.

These are the things I saw on the Core Java side base on my limited knowledge.

No comments: