Reality check: Java 8 finally catches a multi-core break
Making a 'feature' of security
Two years later than planned, Oracle has made Java ready for a multi-core processor world.
The database giant has announced general availability of Java 8, calling it a “major new release”.
Java 8 is important because it’s the base spec for Java Enterprise Edition, as well as feeding the free and open-source implementation of OpenJDK loved by open-sourcers like Red Hat.
Oracle was crowing about a list of changes in Java 8 that, bizarrely and somewhat irrelevantly, includes updates to JavaFX.
For everybody not flogging a doomed alternative to HTML5, the main interest was in two areas that see Java gain rather than break new ground. The first is lambda expressions. Developed from Alonzo Church's work in 1936, they were first discussed for Java in 2010: lambda expressions take the headache out of making Java software run on multi-core.
Lambda expressions have been implemented through a re-write of several core JDK libraries, which will do the low-level work of dividing up the an application’s tasks to run on different cores.
This makes it easier to write multi-threaded code, as code jockeys no longer need to program their apps manually to utilize different processors and cores. And the app itself is lighter, as you’re packing in fewer instructions that’s serving simply as plumbing.
As you’ve come to expect from the Java language and framework, it’s the plumbing of the language and framework that do the heavy lifting.
In the last few years there’s been some guff floating around about a Java “renaissance” and a second coming. This stemmed from the fact LinkedIn and Twitter abandoned hipster-choice Ruby for less fashionable Java. As ever, when it comes to Java, the reasons were performance and scale.
Twitter’s vice president of infrastructure operations engineering Mazen Rawashdeh reckoned in November 2012 that the only way Twitter was able to cope with the micro blogging storm of the US elections was because it rewritten in Java.
A renaissance is defined as a revival; but the Java renaissance has been more a falling out of love with the fashionable Ruby.
Java, though, has never gone away – it’s consistently rated as one of the most used languages, at number-two behind C. People have just had to program around the unpleasant bits, like coping with multi-core.
Multi-core is a tick in the box in today’s world. You’ll find processors with multiple cores on servers and smart phones – relevant in the case of Java thanks to the success of Google’s Android operating system that uses the Dalvik JVM.
It’s something all devs must confront. C++ aficionado Herb Sutter has been saying since 2005 that devs need to write apps that are multi-threaded to take advantage of the speed and performance of multiple cores rather than relying on chip makers to boost the a single processor’s clock speed or its cache.
In some respects, Java 8 is late to this multi-core world. As evidenced by the conversions of LinkedIn and Twitter, on-going popularity of Java and the rise of Android, Java devs have been coping with building multi-core without waiting for the official spec to catch up to the real world.
Now it's here, will Java 8 take the language and platform to new places? Unlikely. It’ll just makes things easier and the apps better.
Even Oracle has admitted Lambda is the only reason for adopting Java 8 and almost everything else being touted by Oracle today is window dressing.
When the Java 8 roadmap hit its second crisis last Spring, Oracle chief architect for the Java platform group Mark Reinhold was frank in his assessment on the importance of Lambda to the success of Java 8. "If we drop Lambda then the remaining features are interesting but not, taken as a whole, very compelling," Reinhold wrote on his blog here. "A Lambda-less release this year would hence be unlikely to gain wide adoption, so why bother?"
The first crisis had seen Java 8 stripped of its other great, flagship feature Jigsaw, designed to provide modularity. Jigsaw had been pulled in 2012 because of “significant technical challenges” that would mean Java 8 would not be able to hit the planned delivery date of “late” 2012, which had been the original goal in 2010.
All of that brings us on to the second big development in Java 8 and a big, new "feature" being touted by Oracle: security.
Java last year was stung by 42 security flaws, 19 severe. Closing these holes proved a proved a bridge too far for completion by the re-worked date of September 2013 and so the finished Java 8 was pushed to now.
Last year, Reinhold had warned it was either Lambda Expressions or security or pushing back the deadline on completion. The result? A Java spec and platform that's not breaking ground but that is at least in better alignment with the real world. ®
Sponsored: Becoming a Pragmatic Security Leader