Josh was giving examples from his 2nd edition of his book about Generics ("Remember your ECS"), Enums (passing data in the constructor, usage of Enums instead of C-style bitfields, use the ordinal method if you really need it and know what you are doing, all Enums are serializable by default - can be used for Serialization-save singletons) and Lazy Initialization (do it only when you need it (fix circularity issue, solve a performance issues), Double check locking works since JVM 5 -- if done right "copy and paste this from the book web site").
Next Mark was talking about SE7 and especially also about project Jigsaw under the new title "The modular java platform". He was talking about Java and the JDK are big and amorphous. Running a simple hello world uses 332 classes and takes around 10 times the execution time than the same on Python. So the idea is to introduce profiles to JavaSE as they have been successful in ME already.
This can also extend into the applications by defining what we have today as a classpath as modules with version information and explicit dependencies (the next image shows a possible module and dependency tree).
Modularization is coming in the form of JSR 294 in JDK 7 (and not as JSR 277, which is not dead, but 'on hold'); OSGi is out of the game because the platform requirements for modularization are to integrate deeply in the VM and the language, but Sun is talking to the OSGi guys to make sure that the modularity work interoperates with OSGi.
In the last part of his talk, Mark was showing a list of potential features for Java 7. Among those are:
- Modularization - see above
- JSR 292, VM support for dynamic languages
- JSR 203, more NIO Apis (e.g. real filesystem api)
- Small language changes (Sage re-throw, Better type inference, Multi-catch (YAY!!) TBD) -- See blog of Joe Darcy
- JSR 296 Swing Application Framework
- Unicode 5 support
- Upgrade class-loader architecture (-> deadlock prevention)
- Swing updates
- G1 garbage collector, HotSpot improvement
- Thinking about a MVM-lite
- JSR 308 Annotations on types (e.g. annotate method parameters with @NonNull and have static checkers running on this stuff, much like ItelliJ and Findbugs are doing it with their proprietary annotations).
- Concurrency and collections updates (see. e.g. yesterday talk by Brian Goetz)
Some features that won't make it into 7:
- Closures
- Operator overloading
JSR 295, Beans Binding
The next talk I went to was titled "Towards a universal VM" with a subtitle of "The JVM is not just for java anymore" and was given by Brian Goetz and Alex Buckley. Brian was first defining VMs and what they provide and how they help you writing new languages, as you don't have to re-invent stuff like garbage collection etc. A big advantage is here, that Objects of different languages running on the same VM can reflectively call each other. Another big advantage is hat the HotSpot compiler has information about the hardware and can profile class usage etc. to optimize the behavior, which is not possible with static compilers. It also just allows for an easy implementation of a new language, as its compiler just needs to create dumb code and the VM will speed it up nevertheless.
As an example of this Brian showed results of the great ruby shootout dec 2008 where JRuby is the fastest Ruby 1.8 implementation.
The VM only has a basic set of features; other stuff (also in Java) needs to be implemented by the compiler ("language fictions"). Some of those fictions are difficult to implement efficiently (like e.g. Open classes in Ruby).
Brian when signing his book yesterday
Handing over to Alex: This is why JSR 292 is working on a
invokedynamic
bytecode. In addition there will be a MethodHandle that can point to a block of code. But first before getting to this, Alex was explaining why the current version with invokevirtual is slow and not well suited for other more dynamic languages. The idea behind invokedynamic is to have the VM call in the user language to consult the dispatching for calls and to trust its result to dispatch then. The good part is that this 'boostrap' code only needs to be called once at the start and after this the direct jump can be inlined and optimized. For all the details you really should go to JSR 292 and / or also watch the recording of this session.
Next to this, Brian was back to talk about the other part of JSR 292, Interface injection. This allows you to modify existing classes to have them implement new interfaces. As an example, this would allow to have java.lang.String also implementing GroovyString. This is also implemented through some bootstrap upcall as just seen before.
There are a few other features in JSR 292, that may or may not make it in Java 7.
John Roses blog (JSR 292 spec lead) talks about all this too.
Next for me was the "JBoss SOA platform overview" by my colleague Mark Little. Mark was having some issues with his presentation template; Did I already mention that white text on light blue background is unreadable? :)
Mark was showing an overview slide of all the possible modules and then listed the features of ESB and the SOA-P(latform) product.
Roberto Chinnici was then giving an "Overview over JEE 6". As I wrote a book on EJB-3 in the past and am a user of JEE 5, this was quite interesting for me. Most of the spec parts are now in public review in the JCP. Goals for EE6 are Easier to use, profiles (full EE, web profile), pruning and extensibility. First profile will be the Web profile. In the future profiles will be defined in the JCP. The current spec just defines the rule on how those profile rules need to work.
A good thing is that the spec is now pruning deprecated stuff. Current candidates are JAX-RPC, EJB 2 Entitiy Beans, JAXR, JSR-88. In consequence this means that they (if confirmed) will be optional in EE 7.
Extensibility means that frameworks (e.g. in the Web tier) can come with a built-in description which is read by the container and which will allow those frameworks to be registered in a zero-conf way in the container (-> web fragments, located in META-INF/web-fragment.xml within the framework).
Another change (especially) in the web tier is to move more to the annotation based configuration by exception development mode.
Proposed components for EE 6 are along with minor updates of others:
- EJB 3.1 - JSR 318
- JPA 2.0 - JSR 317
- Servlet 3.0 - JSR 315
- JSF 2.0 - JSR 314
- JAX-RS 1.0 - JSR 311
- Connectors 1.6 - JSR 322
- Web Beans 1.0 - JSR-299
- Bean Validation 1.0 - JSR 303
Also new in Servlet 3.0 (next to the fragments) are annotations for servlets and filters (@WebServlet, @ServletFilter). New is also an async API e.g. for Chat room applications. You need to annotate the Servlet with @WebServlet(asyncSupported=true) and can get a AsyncContext from the ServletRequest on which you can operate. It sounds relatively easy, but can have strange effects on servlet filters, so all filters and servlets need to explicitly enable asynchronous behavior by correctly (re)codig them to support it.
Next were the highlights for EJB 3.1 - I will skip those, as I've written an entry about those in the past already. The only new one are global JNDI names for beans in the form of java:global/(app)/(module)/(bean)#(interface)
EJB components can now also be put directly into Web applications (in the war file).
Within EJB there will also be EJB 3.1 lite, which contains: Session Beans, Tx, Security, Interceptors, ejb-jar.xml. This EJB 3.1 lite can be used in JavaSE and there is a bootstrapping API for this and to embed it e.g. in a Servlet container or in unit tests. EJB 3.1 lite will be in the Web profile.
Current proposed contents of a Web Profile would be
- Servlet 3.0
- JSP 2.1
- JSR-45
- EL 1.2
- JSTL 1.2
- JSF 2.0
- EJB Lite 3.1
- JTA 1.1
- JPA 2.0
- JSR 250
Still controversial are JAX-RS 1.1, Web Beans 1.0 and JSR 303
Estimated release date for EE6 will be around JavaOne 2009
For the last session of the day I peeked at the Hibernate performance tuning session by Volker Bergmann. Volker points out that there is no silver bullet, but some steps that you can follow to diagnose the issues.
Volker was describing those steps starting from the 10000 feet perspective and drilling down into the details.
One of the nice things of being at such a conference is that one meets people. So for me it is/was great to meet my colleagues. But not only this. I was able to speak with the Jetbrains people about some issues I was having with IntelliJ (I am mostly used to Eclipse an IJ does some things just differently) and they helped me solving those. This is just cool - and I start liking IJ just more and more.
With all the Macs, iPhones and iPods used by Java people, this conference looks a lot like an Apple users conference :)
Btw.: There is a nice photo of mine.
Here you have another picture, it's not as nice as yours, but it's ok.
ReplyDeletehttp://www.facebook.com/photo.php?pid=246206&l=6671a&id=1029917671
Pilar
The Devoxx Modularity keynote from Mark Reinhold is now available on Parleys.com, Enjoy!
ReplyDelete