On 12th March David Blevins (Tomitribe) has visited the Java User Group Darmstadt and gave a talk about Java EE (Extensibility CDI Scopes & EJB, Functions New API Opportunities with Java 8).
But he was not alone. Stephen Chin (Lead Java Community Manager at Oracle) was on his Nighthacking tour through Germany together with Sebastian Daschner and made a video recording of the talk.
David started the talk with a comparison of CDI and EJB. He also explained the connection between EJBs and the CDI and its differences. For example, EJBs are using a Pool and the CDI uses a scope/context. Later he mentioned the evolution of the CDI (Transactions were added in Version 1.1)
And gave a lineup of the lifecycles of CDI and EJBs (@Singleton, @Stateful, @Stateless)
After finishing the introduction, he explained scopes very detailedness in the IDE with a lot of source code. For example how to extend a scope with a simple implementation of the interface Extension and how to create a new annotation for this scope.
He showed this possiblity of Java EE extension for the following custom scopes:
Furthermore he explained the purpose of every single scope. He showed that you can implement such scopes by using HashMaps. But this would involve the creation of a lot glue code. David’s solution is much easier and shorter.
Part I of the talk finished with an overview of common mistakes, which you should avoid to save time.
Part II started with „This will let your brain bleed out of your ears. “ 🙂
He started with an explanation of the evolution of Schedulers and Timers. First with annotations, then a programmatically created timer with one timeout (@timeout). Afterwards, he showed us a solution for the problem that you can only use one timeout annotation. First with a TimerConfig and Strings. But this is relatively error-prone because of the many if-Statements. One solution to this imperfection could be the usage of Java 8 where you can pass method references and multicast is possible.
The described solution is working, but is longer than the annotated version . Therefore, he showed us a clever and shorter solution for JEE8.
Next topic was the persistence and security with Roles and how to test such code. For this purpose he explained explicit solutions with method references and compares them.
The next topic was BeanValidation. He described the current usage and what will be possible in the future with EE8.
The talk finished with an overview of the eras of Java EE and a story about how the Annotation came into Java (Learn from mistakes with EJB 2.1 where you needed xDoclet to prevent the xml-hell.)
At the end he emphasized that Java 8 will bring a lot of new opportunities for the future of Java EE and we should participate if we have ideas.
I really enjoyed the talk and it was nice to see the possiblities of the CDI and the potential to extend it. However, it was really a lot of information which I didn’t fully understood in the first go. Luckily, Stephen recorded the whole talk and after watching the talk once again it it became clear.
Thanks a lot David for the interesting talk!
The source-code of the talk can be found here: https://www.tomitribe.io/projects/microscoped
Or on GitHub: https://github.com/tomitribe
Other resources (Videos and Slides) are here: Further Resources
And the T-Shirts from Tomitribe are cool.
Unfortunately at the end there was only few time for Stephen to present his Retro-Console.
But there are two videos where Stephen explained the RetroPi in more detail.
Or you buy his book with a lot of other IoT-Projects for the RaspberryPi.