Friday Feb 28, 2014

The Basics of Connection Pools in Glassfish

Connection and resource pooling (including thread and instance pooling) is a key value proposition of modern application servers like GlassFish and WebLogic to significantly boost scalability (in fact, WebLogic has long had significantly richer pooling features than GlassFish). While most in the Java EE community take this for granted, many other less mature and robust server-side platforms lack this feature. Indeed, many newcomers to Java EE do not seem to quite grasp connection pooling, even database connection pools. Andy Overton of C2B2 consulting comes to the rescue!

In a very written recent blog entry, Andy explains the basics of database connection pools, demonstrates step-by-step how to setup a connection pool in GlassFish a few different ways and discusses some key configuration options such as pool sizing along with outlining some best practices. It is well worth a read if you are a GlassFish or Java EE fan!

Wednesday Feb 26, 2014

Java EE 8 Community Survey - The Final Part!

"I do have to pick my priorities. Nobody can do everything." (Ray Kurzweil

As we promised earlier, the final phase of this outreach is an opportunity for you to let us know your priorities among the most frequently requested of the features from the surveys.

But it's not just about what's important and what's not important, it's also about relative importance and resources! We can't do everything on this list in one release, and there will certainly be things not on this list that we will need to do. But we want your help telling us how you would spend limited resources on the items on this list.

So today, we are launching the final survey (intelligently named 'Part 3'). The idea is very simple, we are granting you a budget of 100 points to tell us which proposed improvement(s) (existing specification improvement, completely new feature or new technology) you think is (are) important. If you think there is one 'must-have' improvement, just give it a lot of points... up to 100 points if it's really that critical for you. The only rule is that you have to allocate all of your points, not 99, not 101, 100 points on one or more proposed improvement(s).

It should be mentioned that not all of these technological improvements are equivalent in terms of difficulty, some might be relatively 'simple' to implement while other will clearly require more thinking and work. Also, while input from our Java EE developer community is of enormous importance to us, these results are not binding. We have to balance all the feedback we received, that's your feedback but also the input of the various Java EE licensees, the members of our Expert Group, etc.

Finally, it is a good occasion to remind that there is another way to contribute and influence Java EE evolution, it is to join one of the existing Expert Group projects.

So please tell us what you think is important for Java EE 8!

In advance and on behalf of the Oracle Java EE Team, a big thanks!

Friday Feb 21, 2014

GlassFish Monitoring and Management Virtual Event with Adam Bien

Our friends at the London GlassFish User Group are at it again - organizing cool, must-see events for all GlassFish enthusiasts :-). This time, they are even going virtual so you can attend wherever you might be! The event is on the rich monitoring and management capabilities built into GlassFish and is being led by none other than Adam Bien - celebrated Java EE advocate, author, JCP expert and Java Champion.

The event will take place Thursday March 6th at 4:30 PM GMT. You can read more details and register here!

Thursday Feb 20, 2014

Java+EE Basic Training with Yakov Fain

Those of us that have been around Java/Java EE for a little while sometimes tend to forget that Java is still an ever expanding ecosystem with many newcomers. Fortunately, not everyone misses this perspective, including well-respected Java veteran Yakov Fain. Yakov recently started a brand new free online video tutorial series focused on Java and Java EE beginners. The very first of these excellent videos is posted below. The slides for the tutorial series are available here. Yakov is working to update the content to EE 7 and he uses GlassFish 4. If there are folks you know that would benefit from this content, please do pass on word. Even if you are an experienced developer, it sometimes helps to sit back and review the basics...

It's quite remarkable that someone of Yakov's stature took the time out to create content for absolute beginners. For those unaware, Yakov is one of the earliest Java champions and one would be very hard pressed to match his many contributions to the Java community. The tutorial demonstrates his continued passion, commitment and humility.

Sunday Feb 16, 2014

Inject Properties using CDI

One of the principal goals of CDI is to make the Java EE programming model far more extensible - from adding basic functionality to full-scale integration with third-party software. Piotr Nowicki demonstrates this well by doing something pretty simple but common and useful - injecting a value from a Java .properties file into any managed bean using CDI @Produces and InjectionPoint. Note that the Core module of the Apache DeltaSpike project also includes similar functionality. In case you are unaware of Apache DeltaSpike, it is the de-facto collection of CDI portable extensions (it is the successor to both Seam 3 and Apache CODI).

Both Piotr's code and Apache DeltaSpike inject values from property files only. One useful addition could be to also support Java environment variables. Perhaps this inspires you enough to create your own CDI portable extension for injecting properties or contribute to DeltaSpike :-)? Interestingly, there is a similar discussion on JAVAEE_SPEC-19. Perhaps this is an area for the emergent Java EE Configuration JSR to look into?

Friday Feb 14, 2014

An update on the Java EE 8 Community Survey

"I love deadlines. I like the whooshing sound they make as they fly by."
(Douglas Adams)

There is a common pattern between a survey and a call for papers, i.e. you always get (a lot) more submissions towards the deadline! 

chartPart 2 of the Java EE 8 Community Survey will be closed this Monday 17th (midnight Pacific Time). Once Part 2 is closed, we will need at least a week to digest, consolidate and summarize all the results. So around the end of the month, we should be able to share those results, i.e. the emerging most-wanted features for Java EE 8, with community. At the same time, we plan to open the final part of this community feedback effort, the prioritization survey.

So if you haven't yet filled Part2 of the Survey, you only have a few hours left!

Thursday Feb 13, 2014

CodeMash 2014 Trip Report

CodeMash 2014 took place 7-10 January in Sandusky, Ohio. With another sold-out year, CodeMash is quickly becoming one of the largest developer conferences state-side. This year it attracted a decent section of the Java crowd including me (Java EE) and my fellow Oracle colleagues Jim Weaver (JavaFX) and Scott Seighman (Java SE 8). I also stopped by at the nascent Penn State University/Happy Valley JUG in State College, PA - kicking off a highly successful and well-attended very first meetup consisting of a whole day Java EE 7 hand-on workshop!

At CodeMash I delivered talks on Java EE 7 and using NoSQL with Java EE, both of which went well. More details, including the slide deck and code, posted on my personal blog.

Tuesday Feb 11, 2014

JTA 1.2 - It's not your Grandfather's Transactions anymore!

Java Transaction API 1.2 aka JSR 907 (*), which is part of Java EE 7, adds 2 important new features : @Transactional and @TransactionScoped

Prior to JTA 1.2, transactions were delegated to EJBs. By doing that, the developer was shielded from doing low-level JTA/JTS transaction handling as all of this was transparently handeld by the EJB container. With CMT (Container-managed transaction), the default behaviour, the EJB container intercept calls so that it can interpose the required transaction plumbings. So this was, on one hand, handy because transactions were basically managed transparently but it also required, on the other hand, to use EJBs.

The new @Transactional annotation solve this by basically bringing the semantics of those EJB transaction attributes in managed beans without any dependencies on the EJB container. So the @Transactional annotation provides the ability to declaratively control transaction boundaries on managed beans. Under the hood, this capability is provided by a CDI interceptor that handle the necessary transaction plumbings (suspend, resume, commit, ...). In a nutshell, @Transactional bring the ease of CMT transactions to various Java EE Components (Servlet, JAX-RS, etc.) without requiring to use EJBs. 

The new @TransactionScoped annotation provides the ability to specify a standard CDI scope to define bean instances whose lifecycle is scoped to the currently active JTA transaction. This simple code driven post explain and demonstrate such a behaviour in action.

(*) For the curious who might wonder why some JSRs start in the 9xx range, there's a simple explanation for that. Those specifications are referred, in JCP parlance, as "Grandfathered JSRs" because those specifications have originally been developed outside of the JCP.

Monday Feb 10, 2014

Java EE@JUDCon India

JUDCon India 2014 was held in Bangalore on the 30th and 31st of January. Returning to Banglalore for the 3rd consecutive year, JUDCon is the most significant conference focusing on enterprise development in the JBoss community. Sessions covered the latest happenings in the JBoss ecosystem including OpenShift, Arquillian, Wildfly, Aerogear, Drools, jBPM, Vert.x, JBoss Forge, JBoss Tools and Java EE 7.

Our flagship talk for this past year, titled JavaEE.Next(): Java EE 7, 8, and Beyond was accepted to be presented at the conference by none other than Oracle India's own Vijay Nair. Vijay is a good friend and a lead developer with Oracle's FLEXCUBE development group in India. Among many other things like evangelizing Java EE at Java user groups and conferences across South Asia, Vijay contributes heavily to the Cargo Tracker Java EE Blue Prints project in his spare time. The talk was a full house and went quite well with a lot of positive feedback from the participants. There was also a brief conversation about Java EE 8 as well as Cargo Tracker (of course :-)). Slides for the session are posted below:

Continuing the focus of spreading the Java EE 7 message across South Asia, Vijay will be leading a half-day, four-session workshop on Java EE 7 at the Colombo (Sri Lanka!) JUG on the 13th of March as part of their second anniversary meet up. Colombo JUG is a very active JUG and has a vibrant ecosystem of developers. Details of the meetup are here with close to around 190 people already registered for this cool event. Expect to see more of Java EE 7 and Vijay in South Asia!

Friday Feb 07, 2014

Java EE 8 Community Survey Part 2 - Final call!

The second part of the Java EE 8 Community Survey has been running for more than 3 weeks now. This part is dealing with important topics such as Cloud and Java EE, Logging, Security, Management, Monitoring, Testability, Java EE "Right Sizing" (Pruning & Profile), etc.

If you have already filled that survey, a big thank you! But if you haven't yet, please do so as the survey will soon be closed! So if you want to express your views on the future of Java EE, it’s now or never.

Once all the results have been distilled and summarized, we will share all findings and will again request your support in order to set the priorities.

Wednesday Feb 05, 2014

InvokeDynamic and Java EE?

“Man cannot discover new oceans unless he has the courage to lose sight of the shore.”
(André Gide)

JSR 292 (Supporting Dynamically Typed Languages on the Java Platform), introduced in Java SE 7, is about simplifying and improving the support of dynamically typed languages on the Java Platform. JSR 292 defines a new bytecode, i.e. InvokeDynamic, that allows the execution of method invocations in the absence of static type information. So it is clearly the first bytecode that has been designed for dynamically typed language and not for the Java language.

Project Nashorn, Java 8's new JavaScript engine relies heavily on InvokeDynamic. In Fact, originally Nashorn 'was just' an InvokeDynamic Proof of Concept. The PoC was successful and Nashorn has, since then, evolved into a high-performance 100% ECMAScript compliant engine.

Despite the fact that InvokeDynamic was originally conceived for dynamically typed languages, it turns out that this bytecode could also be useful for the Java language itself. For example, Java SE 8's Lambdas are using, under the hood, InvokeDynamic.

Antoine Sabot-Durand, CDI co-spec lead, is currently conducting some experimentations around using InvokeDynamic to replace Weld's proxies. At this stage, it's just an initial Proof of Concept but it works! If his efforts goes to fruition and since Weld is the CDI Reference Implementation and is used by different Application Servers (JBoss AS, WildFly, GlassFish, WebLogic...), who knows, we might get, and not just for Lambdas support, InvokeDynamic under the hood of some Java EE Application Servers. Only the future will tell us!

Tuesday Feb 04, 2014

Java SE 8 and Java EE 7

"Revolutions just spread blood. Evolution - this is something that changes in the long term." (Marjane Satrapi

Java SE 8 is scheduled for release next month, i.e. March 2014. From a Java EE point of view, the Java EE 7 specification requires at least Java SE 7. So clearly, nothing prevents you from using Java SE 8 with Java EE 7. A lot of us are in fact using early builds of Java SE 8 with GlassFish on a daily basis without any problem!

Project Avatar, which currently runs on top of GlassFish 4 (and Java SE 8), leverages one of the new Java 8 feature : Project Nashorn, a new lightweight high-performance JavaScript engine. 

The introduction of Lambdas Expressions is another key feature of Java 8. Lambdas basically add Closures support to the Java language, they allows to pass functionality as an argument to another method. Lambdas are seen as one of the most fundamental evolution in the Java platform since Generics (if not more important than Generics!). Lambdas leads to a different way of thinking, a different (and cleaner) way of writing code.

Java EE developers shouldn't wait and need to learn how to use Lambdas Expressions today as they are not incompatible with Java EE 7. Here is, for example, a post from Gerard Davison of the JDeveloper Team that shows Lambdas used with the WebSocket API.

If you are using Lambdas or any other Java SE 8 feature(s) today in Java EE, please let us know!