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 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.

Thursday Jan 09, 2014

Some Tyrus updates

Project Tyrus is the JSR 356 (Java API for WebSocket) Reference Implementation. As JSR 356 is part of Java EE 7 (Web Profile and the Full Java EE Platform), Tyrus is embedded in GlassFish 4. In addition, Tyrus *should* also run on any Servlet 3.1 compatible container.

Tyrus 1.0 was released mid 2013 when the JSR 356 specification went final. Since then, the work on Tyrus hasn't stopped and this is also true for other implementations such as Jersey for JAX-RS, Mojarra for JavaServer Faces, etc. For example, no less than 2 updates of Mojarra were released this week (2.2.5 & 2.1.27) but more on JSF later and back to Tyrus...

Here are some of features and improvments that were recently added to Tyrus :

Wednesday Jun 12, 2013

Fifteen JavaEE 7 APIs Featured in the Java Spotlight Podcast

JavaEE 7 has been officially released and the Java Spotlight Podcast has been supporting this major release by featuring almost every API change, both major and minor, for the last 11 months. There are fifteen Java Spotlight Podcast feature interviews with the JCP specification leads from Oracle, Red Hat, and IBM in a relaxed question and answer format.

[Read More]

Tuesday Apr 17, 2012

WebSockets and Java EE 7: JSR 356 Starting Up

Java API for WebSocket (aka JSR 356) will define a standard API for creating WebSocket applications. The Expert Group consists of RedHat, Google, Caucho, VMWare and other individuals like JeanFrancois Arcand and Justin Lee.


GlassFish has support for WebSocket using Grizzly on server and client for some time. The JSR will provide standards-based code to write WebSocket applications.

Danny Coward has started websocket-spec and you can read the EG discussions at jsr356-experts. The users@websocket-spec allows you to participate in the discussion. Of course, all this will be delivered as part of Java EE 7 which is now scheduled for Q2 2013.

How are you using WebSocket ? Would you like to join the EG and contribute ?