Pathfinder Development

Agile Ajax

GWT and Comet - Using GWT with Jetty Continuations

Let's review: Comet basically means keeping an HTTP connection open between the server and the browser so the former can stream messages to the latter without polling (see the Ajax Patterns page on HTTP Streaming for info on how it's done). This poses a problem for commonly used web infrastructure, like app servers, which usually associate one thread per connection. If you have lots of open connections, let's say 10,000, then you will need that many threads that are doing very little but sitting around waiting for the next message to be sent. Regardless of OS, 10,000 threads puts a pretty heavy load on a system. As a solution, Greg Wilkins proposed an extension of the Servlet standard to allow "continuations." What are they?

A java Filter or Servlet that is handling an AJAX request, may now request a Continuation object that can be used to effectively suspend the request and free the current thread. The request is resumed after a timeout or immediately if the resume method is called on the Continuation object.

Continuations, while not a part of the Servlet standard, are available in Jetty 6.

GWT, or the Google Web Toolkit, is the client-side framework that let's you write and debug your application in Java, then deploy it as Javascript.

Whew! Now that the explanations are out of the way, I can tell you that Greg Wilkins (of Jetty Continuations fame) has been noodling about how to get GWT to do Comet, specifically using Jetty's continuations.

Unfortunately GWT has not made it easy to use continuations within their RPC mechanism. Firstly they catch Throwable, so he Jetty RetryException is caught. Secondly they have made most of the methods on the GWT servlet final, so you cannot fix this by extension.

Luckily GWT is open source under the apache 2.0 license, so it was possible to do a cut/paste/edit job to fix this. The OpenRemoteServiceServlet recently added to Jetty is [a] version of GWTs RemoteServiceServlet without the final methods and a protected method for extending exception handling.

Once the GWT remote service servlet has been opened up, it is trivial to extend it to support Continuations...

There's enough code and pointers in the article to make it an effective, if short, howto. Apparently http://www.gpokr.com/ uses these extensions to GWT in its app, so it's proven in production.

Update: I see that there is an entry entitled "RemoteServiceServlet refactoring to be pluggable" in the GWT 1.4 dev plan. Is this what I think it is?


Technorati : ajax, comet, continuations, gwt, jetty

Topics: COMET, GWT

Comments

None so far.

Leave a comment

Powered by WP Hashcash

About Pathfinder

We design and build extraordinary applications for companies looking to make the next great idea a reality. learn more

Topics

.NET 2d physics 3d 3D GPS 3D physics 37signals Accessibility actionscript activerecord Add new tag Adium ADO.NET Entity Framework Adobe Adobe AIR Advertising agile Agile Development AIR Ajax Ajax Applications Ajax Bookmarking Ajax Components Ajax Development Ajax Examples Ajax Experience Ajax Frameworks Ajax history management Ajax Intervention Ajax libraries AJAX Obfuscation Ajax Performance Ajax Products Ajax Tools Ajax Widgets Amazon amf Analysis Android Announcement Announcements antennae Apollo Application Architecture Application Development AS3 ASP.NET Asynchronous Processing awards Back Button Benchmarking Best Practices BitmapData.draw BJAX Blaze Advisor blog blogging Books Browsers Business Business Reasons for Ajax Business Rules C# Canvas Case Studies chess Chicago Cloud Computing CMS COBOL code art Code Generation Color COMET Conference Consistency Content Management CRM CruiseControl CSS Custom Flex Component data visualization Degrafa Design Design Patterns Desktop Desktop RIA Developer's Notebook Diagnose Dojo Domain Knowledge Drools EC2 Echo2 Echo3 Editorial ERP Ethnographic Research events externalinterface Ext JS Facebook ferret FileReference Firefox Firefox Extensions Flash flash awards flash player flash player 10 Flex flexunit Flock Flow Frameworks front end front end development Games Gauge Component getting things done Git Google Google calendar Google Gears Grails Graphics Greasemonkey Groovy GStreamer GTD Gwittir GWT Healthcare Hibernate Hudson IDE Ideation IE IE6 IE7 IE8 ILOG JRules Information Architecture Innovation Instructional Design Interaction Design Interview iPhone iTunes Java Javascript JavaScript frameworks Javascript Libraries JBoss Rules Jess Jetty JIT Jobs jQuery JSF JSON JSR-94 JsUnit Lazlo Legacy Systems lightweight LinkedIn LINQ logging Logical Model and Conceptual Model Low Pro Mac Mash Note Mashups Meebo MetaWidget Methodology Microformats Microsoft Mobile Mootools mouse scroll mouse wheel Mozilla Music MVC MySql NetNewsWire Object-Oriented Object Relation Mapping (ORM) Office OOP Open Screen Open Source Opera Oracle ORM osx pagination Pair Programming papervision3d Patterns Peer Creation Performance Personas PHP physics physics engines plugin preloader process Web/Tech Product Definition productivity Progressive Enhancement Project Website Prototype Prototyping PV3D QA qooxdoo Radiant CMS rails Really Simple History References Requirements Requirements Alice Toth Requirements Visualization Restlet RETE Review Rich Interactions ruby rubyamf Ruby on Rails SaaS Safari San Francisco Scalability Scenarios Scriptaculous SDLC Search Security Selenium Semantic web SEO Server Side Silverlight SOA Social Networking Software Processes Songbird SpiderMonkey Sprajax Spreadsheets Standards Startups STI Story Telling Struts Tamarin Task Flows Test Driven Development Testing The Ajax Experience Tilt Component Tools TraceMonkey Training Trends Tumblr Tutorial Tutorials Unit Tests Usability Usability Testing User Experience user experience design user interface User Interface Standards User Research UXD Venture Capital Video Vision Visualization VLC Volta Web/Tech Web 2.0 Web Design Web Development Webkit Weblogs Web Services Web Standards Widgets will_paginate Windows Wireframes WordPress workflow work life balance XML XML Metadata XUL Yahoo Map AS3 API YUI Zeigarnik Zeigarnik Effect ZK

WordPress

Comments about this site: info@pathf.com


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser