Tuesday Feb 17, 2015

Tyrus and Autobahn|Testsuite compliance

The Tyrus Team has just released Tyrus 1.10 (JSR 356 Reference Implementation). With only a few fixes (see Pavel's blog for details), this release could be seen as a minor one. It is however an important milestone as it is the first Tyrus release that passes the Autobahn|Testsuite, a test harness used to verify WebSocket client and server implementations for specification conformance and implementation robustness.

In this release, the Tyrus Team has also introduced 2 new samples that explore ways of sharing data between JavaScript and Java (see Pavel's blog for more details). 

Additional resources: 

Wednesday Feb 11, 2015

Java EE @ Java2Days 2014

Java2Days 2014 was held on November 17-19 in Sofia, Bulgaria. It is far and away the largest Java conference in the Balkans region and now perhaps one of the most important conferences in Europe as a whole. This was another great year for this rapidly growing, vibrant event. It attracted a host of international and local speakers including Arun Gupta, Geertjan Wielenga, Roberto Cortez, Ivan St. Ivanov, Andy Gumbrecht and Andrew Lombardi. Topics included Java SE, Java EE, HTML5/JavaScript, mobile, OSGi, IoT and the cloud. I am extremely grateful that the organizers invited me again this year and very glad that I was able to accept.

Java EE had a strong showing this year:

  • What's Coming in Java EE 8 - me
  • Nuts and Bolts of WebSocket - Arun
  • Java EE 7 Hands-on Lab - Arun, Ivan and me
  • Apache Tomcat to Apache TomEE in 1-n Steps - Andy Gumbrecht
  • Java EE 7 Batch Processing in the Real World - Roberto and Ivan
  • Coding for Desktop and Mobile with HTML5 and Java EE 7 - Geertjan
  • JavaScript/HTML5 Rich Clients Using Java EE 7 - me, Ivan
  • Forge and Arquillian Hands-on Lab - Ivan, me
  • Why Open Standards and Java/EE Matter (to You) - me

More details on the sessions and Java2Days, including the slide decks, video and code, posted on my personal blog.

Wednesday Oct 29, 2014

Java EE @ NFJS Greater Atlanta Software Symposium

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Greater Atlanta Software Symposium was held September 12 - 14.

I had four talks total over two days, more or less back-to-back. I did talks on Java EE 7/Java EE 8, WebSocket, the Cargo Tracker Java EE Blue Prints and JavaScript + Java EE. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Monday Sep 15, 2014

Spotlight on GlassFish 4.1: #10 WebSocket Client Redirect

Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the latest GF release, GlassFish 4.1. It could be a new feature, a fix, a behavior change, a tip, etc.

#10 WebSocket Client Redirect

A WebSocket connection is always initiated using HTTP (or HTTP/S). After a successful handshake, the HTTP connection is upgraded to a WebSocket connection using the HTTP 1.1 upgrade header.

Tyrus and GlassFish 4.1 now support HTTP 3xx Redirect handling during the WebSocket handhake phase. This feature allows a WebSocket server end-point to transparently redirect clients to another server end-point. Tyrus WebSocket client can be configured to accept to be redirected. The number of redirections allowed is also configurable (eg. to avoid infinite redirection loop).

For more details on this feature, please check this section of the Tyrus documentation.

Thursday Aug 28, 2014

Spotlight on GlassFish 4.1: #8 WebSocket Client Reconnect

Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the upcoming GlassFish 4.1 release. It could be a new feature, a fix, a behavior change, a tip, etc.

#8 WebSocket Client Reconnect 

There are various libraries to improve the WebSocket capabilities of a client in the JavaScript space. WebSockHop is one of them, one of its feature is a 'automatic reconnect' facility. That's useful for JavaScript WebSocket client endpoints.

A similar capability has been introduced in Tyrus and GlassFish 4.1. A Tyrus based WebSocket client can now register a ReconnectHandler. This handler provides 2 methods (onDisconnect() and onConnectFailure()) that will greatly simplify the handling of dropped connection. Check this Client reconnect example from the Tyrus User Guide.

Additional ressources:

Friday Aug 22, 2014

Java EE @ NFJS Central Iowa Software Symposium Des Moines

As some of you may be aware I recently joined the well-respected US based No Fluff Just Stuff (NFJS) Tour. The NFJS Central Iowa Software Symposium was held August 8 - 10 in Des Moines. The Des Moines show is one of the smaller ones but still was good overall. It is one of the few events of it's kind that take place this part the country so it is extremely important.

I had five talks total over two days, more or less back-to-back. I had decent attendance for all my sessions and had many of the same folks staying for multiple sessions which is always a very good sign. I did talks on Java EE 7/Java EE 8, WebSocket, the Cargo Tracker Java EE Blue Prints, JavaScript + Java EE and NoSQL + Java EE. More details, including slide decks and code as well as my NFJS tour schedule, posted on my personal blog.

Thursday Aug 21, 2014

Spotlight on GlassFish 4.1: #7 WebSocket Session Throttling and JMX Monitoring

'Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the upcoming GlassFish 4.1 release. It could be a new feature, a fix, a behavior change, a tip, etc.

#7 WebSocket Session Throttling and JMX Monitoring

GlassFish 4.1 embeds Tyrus 1.8.1 which is compliant with the Maintenance Release of JSR 356 ("WebSocket API 1.1"). This release also brings brings additional features to the WebSocket support in GlassFish.

JMX Monitoring:

Tyrus now exposes WebSocket metrics through JMX . In GF 4.1, the following message statistics are monitored for both sent and received messages:

  • messages count
  • messages count per second
  • average message size
  • smallest message size
  • largest message size

Those statistics are collected independently of the message type (global count) and per specific message type (text, binary and control message). In GF 4.1, Tyrus also monitors, and exposes through JMX, errors at the application and endpoint level.

For more information, please check Tyrus JMX Monitoring

Session Throttling

To preserve resources on the server hosting websocket endpoints, Tyrus now offers ways to limit the number of open sessions. Those limits can be configured at different level:

  • per whole application
  • per endpoint
  • per remote endpoint address (client IP address)

 

For more details, check Tyrus Session Throttling.

The next entry will focus on Tyrus new clients-side features.

Tuesday Aug 19, 2014

Spotlight on GlassFish 4.1: #6 Java API for WebSocket 1.1

'Spotlight on GlassFish 4.1' is a series of posts that highlights specific enhancements of the upcoming GlassFish 4.1 release. It could be a new feature, a fix, a behavior change, a tip, etc.

#6 Java API for WebSocket 1.1

JSR 356 (Java API for WebSocket) has recently passed the Maintenance Release ballot, this Maintenance Release fixes an important issue when Java SE 8 Lambdas are used (see here). GlassFish 4.1 will include an updated version of Tyrus (JSR 356 Reference Implementation) to bring the WebSocket API level to the latest version of the specification, i.e. WebSocket API for Java 1.1.

It should be mentioned that the Tyrus version included in GlassFish 4.1 also brings additional features. Some of those will be highlighted in upcoming entries.

Tuesday Jul 29, 2014

Java API for WebSocket 1.1

Java API for WebSocket (JSR 356) is going through the JCP maintenance release process as it enters today the Maintenance Review Ballot. This ballot will end in a week on August 4. 

The proposed changes are relatively limited but are nevertheless important. In the current specification (1.0), the issue is located in the Session.addMessageHandler(MessageHandler) method which is forcing implementations to get the generic type of the message handler instance. And in some cases, that approach can be problematic (e.g. with lambda based message handler).

To solve this, the 1.1 version of the JSR 356 specification introduces 2 new addMessageHandler() methods (and keep the existing method for backward compatibility). For the complete descriptions of the issue and the 2 new methods, check here.

If everything goes well (i.e. Maintenance Review Ballot passed in time), Tyrus (JSR 356 Reference Implementation) will be updated to reflect those changes and should be integrated in the upcoming GlassFish 4.1 release.

Tuesday Jul 01, 2014

Java EE @ Java Day Tokyo 2014

Java Day Tokyo 2014 was held on May 22nd. Organized by Oracle Japan, it is the largest Java developer event in the country. Indeed it is really a replacement to JavaOne Japan. This was another highly successful year for the event with a fully sold out venue packed with youthful, energetic developers. Speakers included Steve Chin, Stuart Marks, Simon Ritter, Nandini Ramani, Cameron Purdy and Yoshio Terada. Topics included Java SE, Java EE and JavaFX. Cameron Purdy, Vice President of Development at Oracle responsible for Java EE, shared the Java EE 8 road-map during the opening keynote.

I did talks on Java EE 7/Java EE 8 and aligning Java EE 7 with the HTML 5/JavaScript Rich Client landscape. There were many other very interesting Java EE related session in Japanese and English, including a Java EE adoption story from Rakuten. More details, including slide decks and code, posted on my personal blog.

Wednesday May 28, 2014

Adding SSE support in Java EE 8

SSE (Server-Sent Event) is a standard mechanism used to push, over HTTP, server notifications to clients.  SSE is often compared to WebSocket as they are both supported in HTML 5 and they both provide the server a way to push information to their clients but they are different too! See here for some of the pros and cons of using one or the other.

For REST application, SSE can be quite complementary as it offers an effective solution for a one-way publish-subscribe model, i.e. a REST client can 'subscribe' and get SSE based notifications from a REST endpoint. As a matter of fact, Jersey (JAX-RS Reference Implementation) already support SSE since quite some time (see the Jersey documentation for more details).

There might also be some cases where one might want to use SSE directly from the Servlet API. Sending SSE notifications using the Servlet API is relatively straight forward. To give you an idea, check here for 2 SSE examples based on the Servlet 3.1 API. 

We are thinking about adding SSE support in Java EE 8 but the question is where as there are several options, in the platform, where SSE could potentially be supported:
  • the Servlet API
  • the WebSocket API
  • JAX-RS
  • or even having a dedicated SSE API, and thus a dedicated JSR too!
Santiago Pericas-Geertsen (JAX-RS Co-Spec Lead) conducted an initial investigation around that question. You can find the arguments for the different options and Santiago's findings here.

So at this stage JAX-RS seems to be a good choice to support SSE in Java EE. This will obviously be discussed in the respective JCP Expert Groups but what is your opinion on this question?

Tuesday May 20, 2014

Another Tyrus release!

Tyrus is JSR 356 (Java API for WebSocket) Reference Implementation. The Team working on it doesn't stand still as they have just released another update, i.e. Tyrus 1.6!
As usual, each Tyrus release comes with a set of fixes but also with some new features, here are some them :
  • The ability to switch to JDK 1.7 based transport on the client side
  • JMX based Monitoring Server Side Resources Utilisation 
  • WebSocket Application Descriptor Language (WSADL) : an XML descriptor of deployed endpoints. WSADL is to WebSocket what WADL is to RESTful web services.
  • etc.

Also, there was a problem with JSR 356 that prevent to use, in a consistent way, Lambda expressions when registering a message handler. The good news is that this is now solved in Tyrus 1.6! We can also expect in the weeks to come a small update to the JSR 356 specification to clarify this point as well.

For additional details on Tyrus 1.6, make sure to check Pavel's blog post.

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!

Monday Jan 27, 2014

Tyrus/WebSocket Client on Android

At JavaOne San Francisco 2013 Ryan Cuprak, Bala Muthuvarathan and I presented a full-house session titled Android and iOS Development with Java EE 7. Ryan is the leader of the Connecticut JUG, a close friend and my co-author on the upcoming second edition of EJB 3 in Action. Bala is a friend and former colleague from CapTech Consulting. We picked the topic as we thought there was surprisingly little content on the topic despite the fact that many people use JAX-RS/Java EE as a mobile back-end platform today and Java EE 7 is an even stronger candidate for this development model. You can check out video for the event below. The demo code for the session is available on GitHub and the slide deck is available on SlideShare. One of the surprising things we came across is that Android still has very weak support for WebSocket development. As a result, I thought it would be great if the WebSocket client APIs standardized in Java EE 7 would work on Android, so I entered a JIRA issue against Tyrus asking for such support.

Some of you might be very pleasantly surprised that the Tyrus team actually addressed the issue! You can read the details of the initial work on Pavel Bucek's blog, including a sample application. If you find the feature useful, I would encourage you to explore the work further, share your thoughts on the Tyrus mailing list or via JIRA. You could even contribute to the sample code for the JavaOne talk :-) (currently the code uses the Autobahn Android library).

Wednesday Jan 08, 2014

Java EE@JogloCon

On December 27th, I did a virtual session via Google Hangout on the Java API for WebSocket (JSR 356) for JogloCon 2013. Organized by JUG Joglosemar, JogloCon is one of the largest Java conferences in the Yogyakarta area of Indonesia. This year, the conference focused on everything Java EE! Yosi Pramajaya and Deny Prasetyo of the JUG Joglosemar did an excellent job putting the conference together. This was JUG Joglosemar's first event after it's resurrection in 2013. The event was a full-house with over 200 registering. Enjoy the slideshow below of the conference:


Created with flickr slideshow.

The slide deck for my talk is available here. You can also take a look at the video of WebSocket specification lead Danny Coward's JavaOne 2013 talk on Parleys.com:

Let's hope to see great things from JUG Joglosemar, Yosi Pramajaya and Deny Prasetyo in the New Year!