Skip to content

This is a collection of samples that illustrate the Non-blocking IO capabilities of Servlet 3.1 in Java EE7 that can be used to make your applications more responsive. #JavaEE7

License

Notifications You must be signed in to change notification settings

zhujinhua/sample.async.servletnio

 
 

Repository files navigation

Java EE7: Non-blocking Servlet IO Build Status

Java EE7 added support for Non-blocking Servlet IO (NIO) in Servlet 3.1, which enables reading and writing data without blocking a thread, which can be very useful when faced with slow clients. The new function builds upon support for asynchronous processing that was introduced in Servlet 3.0, and will only work with async-enabled apps.

This sample contains a few variations to illustrate how Non-blocking IO in Servlet 3.1 works:

  • Plain: PlainServlet is just a plain/synchronous servlet
  • Async: AsyncServlet defines an asynchronous servlet using attribuets defined in the Servlet 3.0 specification.
  • Async with Runnable: AsyncServletRunnable is an asynchronous servlet that uses a runnable to offload work to a different thread.
  • Async with NIO: AsyncServletNIO is a servlet that uses an AsyncReadListener for clients that are slow to write data, and an AsyncWriteListener for clients that are slow to read data.

Getting Started:

Browse the code to see what it does, or build and run it yourself:

Once the server has been started, go to http://localhost:9083/servlet-nio/ to interact with the sample.

More on Servlet NIO

Notice

© Copyright IBM Corporation 2015, 2017.

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

This is a collection of samples that illustrate the Non-blocking IO capabilities of Servlet 3.1 in Java EE7 that can be used to make your applications more responsive. #JavaEE7

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 96.1%
  • HTML 3.9%