Go to file
Trustin Lee 0909878581 Read only when requested (read-on-demand)
This pull request introduces a new operation called read() that replaces the existing inbound traffic control method. EventLoop now performs socket reads only when the read() operation has been issued. Once the requested read() operation is actually performed, EventLoop triggers an inboundBufferSuspended event that tells the handlers that the requested read() operation has been performed and the inbound traffic has been suspended again. A handler can decide to continue reading or not.

Unlike other outbound operations, read() does not use ChannelFuture at all to avoid GC cost. If there's a good reason to create a new future per read at the GC cost, I'll change this.

This pull request consequently removes the readable property in ChannelHandlerContext, which means how the traffic control works changed significantly.

This pull request also adds a new configuration property ChannelOption.AUTO_READ whose default value is true. If true, Netty will call ctx.read() for you. If you need a close control over when read() is called, you can set it to false.

Another interesting fact is that non-terminal handlers do not really need to call read() at all. Only the last inbound handler will have to call it, and that's just enough. Actually, you don't even need to call it at the last handler in most cases because of the ChannelOption.AUTO_READ mentioned above.

There's no serious backward compatibility issue. If the compiler complains your handler does not implement the read() method, add the following:

public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}

Note that this pull request certainly makes bounded inbound buffer support very easy, but itself does not add the bounded inbound buffer support.
2012-12-31 23:26:00 +09:00
all Fix the incorrect snapshot version number 2012-12-13 22:49:31 +09:00
buffer Add a lot of javadocs to make usage more clear 2012-12-21 22:22:40 +01:00
codec Read only when requested (read-on-demand) 2012-12-31 23:26:00 +09:00
codec-http [#846] Tighten up visibility 2012-12-25 18:54:55 +01:00
codec-socks Added test cases for NetUtil methods, if we can`t convertAddress we return null 2012-12-29 18:31:53 +01:00
common Added test cases for NetUtil methods, if we can`t convertAddress we return null 2012-12-29 18:31:53 +01:00
example Read only when requested (read-on-demand) 2012-12-31 23:26:00 +09:00
handler Read only when requested (read-on-demand) 2012-12-31 23:26:00 +09:00
license Add Snappy compression codec 2012-12-18 21:09:31 +01:00
metrics-yammer Simpler and more comprehensive method naming in monitor 2012-12-26 13:48:29 +09:00
microbench Remove ChannelBuf/ByteBuf.Unsafe 2012-12-17 17:41:21 +09:00
tarball [#840] Generate the tarball with top level directory 2012-12-30 21:26:08 +01:00
testsuite Read only when requested (read-on-demand) 2012-12-31 23:26:00 +09:00
transport Read only when requested (read-on-demand) 2012-12-31 23:26:00 +09:00
.fbfilter.xml Update license headers 2012-06-04 13:31:44 -07:00
.fbprefs Updated Find Bugs configuration 2009-03-04 10:33:09 +00:00
.gitignore ignore .idea/ folder 2012-01-16 16:01:00 +08:00
LICENSE.txt Relicensed to Apache License v2 2009-08-28 07:15:49 +00:00
NOTICE.txt Add Snappy compression codec 2012-12-18 21:09:31 +01:00
pom.xml Replace sun.net.util.IPAddressUtil usage with own implementation 2012-12-29 18:13:44 +01:00
README.md Fix README 2012-09-08 20:20:45 +02:00

The Netty Project

Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

Getting Netty

    <dependencies>
      ...
      <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty</artifactId>
        <version>X.Y.Z.Q</version>
        <scope>compile</scope>
      </dependency>
      ...
    </dependencies>

Developer Information

  • Netty is setup to build using Maven

  • You need JDK 7 to build Netty. Netty will run with JDK 5 (3.x) and JDK 6 (4).

  • master branch contains code for Netty 4.x

  • 3 branch contains code for Netty 3.x