Commit Graph

4104 Commits

Author SHA1 Message Date
Trustin Lee
b6fcf3acc4 Simplify DefaultChannelPipeline 2013-01-09 19:13:43 +09:00
Norman Maurer
b742dcc209 [#902] Remove usage of generics for output of Encoder/Decoder to make them more flexible again 2013-01-09 07:13:31 +01:00
Trustin Lee
5d2e0688ab Fix checkstyle 2013-01-09 15:12:25 +09:00
Trustin Lee
5c2be33cae Delegate to the actual encoder/decoder if possible 2013-01-09 15:09:20 +09:00
Trustin Lee
102563ec8f No need to override ByteToMessageCodec.decoder.discardInboundReadBytes() 2013-01-09 15:05:03 +09:00
Trustin Lee
ef692b0c38 Add missing decodeLast() 2013-01-09 14:58:44 +09:00
Trustin Lee
b58a8f0106 Add missing codec operations in ByteToMessageCodec 2013-01-09 14:56:07 +09:00
Trustin Lee
4a3d73724f Make all encoder/decoder methods overridable in MessageToMessageCodec 2013-01-09 14:44:19 +09:00
Trustin Lee
8d0785da36 Rename MessageToMessageEncoder.freeInboundMessage() to freeOutboundMessage() 2013-01-09 14:35:50 +09:00
Trustin Lee
8d5fd0839f Make ByteToMessageCodec.isEncodable() public like other similar methods 2013-01-09 14:28:42 +09:00
Trustin Lee
aa69d628f1 Add ByteToMessageCodec.isEncodable() 2013-01-09 14:26:15 +09:00
Trustin Lee
dd6b7969b7 Give a handler more control over how its buffers' read bytes are discarded.
This pull request adds two new handler methods: discardInboundReadBytes(ctx) and discardOutboundReadBytes(ctx) to ChannelInboundByteHandler and ChannelOutboundByteHandler respectively. They are called between every inboundBufferUpdated() and flush() respectively. Their default implementation is to call discardSomeReadBytes() on their buffers and a user can override this behavior easily. For example, ReplayingDecoder.discardInboundReadBytes() looks like the following:

    @Override
    public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
        ByteBuf in = ctx.inboundByteBuffer();
        final int oldReaderIndex = in.readerIndex();
        super.discardInboundReadBytes(ctx);
        final int newReaderIndex = in.readerIndex();
        checkpoint -= oldReaderIndex - newReaderIndex;
    }

If a handler, which has its own buffer index variable, extends ReplayingDecoder or ByteToMessageDecoder, the handler can also override discardInboundReadBytes() and adjust its index variable accordingly.
2013-01-09 13:34:09 +09:00
Trustin Lee
7277536ca6 Remove unnecessary finally block 2013-01-09 13:30:25 +09:00
Norman Maurer
0d76e329a0 Add example which start a server in a applet to show there is no issue anymore. Related to [#689] 2013-01-08 10:39:45 +01:00
Andrei.Pozolotin
20aa2e1968 [#844] [#867] Add UDT transport 2013-01-07 21:06:22 +01:00
Norman Maurer
26595471fb Call Freeable.free() if a Freeable message reaches the end of the ChannelPipeline to guard against resource leakage 2013-01-07 12:34:18 +01:00
kxbmap
cf2fbf7883 Fix a link in ZlibWrapper 2013-01-05 21:28:03 +01:00
Norman Maurer
5526153459 [#882] Add a PartialFlushException which will allow to notify the user that the flush/write was only partial succesful 2013-01-05 20:30:48 +01:00
Trustin Lee
8f7fba2d39 Optimize AbstractByteBuf.adjustMarkers() 2013-01-04 23:51:11 +09:00
Courtney Robinson
3a52cc410a Add some of the metrics mentioned in #718
use single static initialization of available metrics monitor registries

* This changes the original implementation to work in a similar way to
how slf4j selects and loads an implementation.
* Uses a single static instance so intialization is done only once.
* Doesn't throw IllegalStateException if multiple implementations are
found on the classpath. It instead selects and uses the first
implementation returned by iterator()
* Class left as an iterable to keep the API the same

add yammer metrics to examples to allow them to publish metrics

publish the number of threads used in an EventLoopGroup see issue #718

* seems like the better place to put this because it sets the default
thread count if the MultithreadEventLoopGroup uses super(0,...)
* It also happens to be the common parent class amongst all the
MultiThreadedEventLoopGroup implementations
* Count is reported for
io.netty.channel.{*,.local,.socket.aio,.socket.nio}

fix cosmetic issues pointed out in pull request and updated notice.txt

see https://github.com/netty/netty/pull/780

count # of channels registered in single threaded event loop

measure how many times Selector.select return before SELECT_TIME
2013-01-04 11:27:49 +01:00
Norman Maurer
bd093c4ab0 Don't spin the CPU so much in tests 2013-01-04 07:05:53 +01:00
Norman Maurer
712a6cfe8f Safe copy of buffer for test 2013-01-03 22:50:11 +01:00
Norman Maurer
2f6e17f681 Make sure we catch UnsupportedOperationException for derived buffers 2013-01-03 22:49:54 +01:00
Norman Maurer
364b7d1430 Make sure the Unpooled.EMTPY_BUFFER can not be freed and the capacity can not be changed 2013-01-03 22:49:25 +01:00
Norman Maurer
ccb5409f58 [#884] Split SCTP transport into extra module 2013-01-03 22:19:06 +01:00
Norman Maurer
37a3f2e3b8 [#887] [#866] [#883] Add unified interface for Message oriented protocols and also use direct buffers for them 2013-01-03 18:15:53 +01:00
Trustin Lee
4a1aa37773 Re-ignore ServerSocketSuspendTest (unignored by mistake) 2013-01-03 17:07:30 +09:00
Trustin Lee
0abfaf20e4 Revert 5161ca733c 2013-01-03 17:05:18 +09:00
Trustin Lee
923dde7a5f Do not auto-start read operation 2013-01-03 16:01:41 +09:00
Trustin Lee
103edc4467 Make ChannelConfig.setAutoRead() triggers Channel.read() if autoRead was previously false
- also rename JDK socket and channel variables so that they are less ambiguous
2013-01-01 16:49:21 +09:00
Trustin Lee
218afba1f2 Do not set 'Content-Encoding' if the target encoding is 'identity'
- Fixes #769
2013-01-01 15:13:35 +09:00
Trustin Lee
7d80182e51 Fix a bug where SslHandler does not respect the startTls flag
- Fixes #856
- Add a dedicated test case: SocketStartTlsTest
2013-01-01 15:03:37 +09:00
Trustin Lee
2960af851a Extract the utility classes related with SSL to the util package 2013-01-01 14:04:37 +09:00
Norman Maurer
5161ca733c Move utility method to abstract base class and correctly handle expand of buffer also for OIO 2012-12-31 22:09:27 +01:00
Trustin Lee
89a16fe01e Fix a bug in NIO transport where inboundBufferSuspended() is triggered even if the channel is closed.
- No non-static wildcard import
2013-01-01 00:35:44 +09:00
Trustin Lee
93fd73fbbf Fix a bug in AioSocketChannel where inboundBufferSuspended() is triggered even if the channel is closed. 2013-01-01 00:27:30 +09:00
Norman Maurer
8cf9f52919 Add new ChanelFuureListener impl that mimic the old behavior of Netty 3 and so allow to also call fireException for outbound operations 2012-12-31 16:17:08 +01:00
Trustin Lee
1e9652b47a Fix a bug in AioSocketChannel where recursive doBeginRead() is allowed unexpectedly 2013-01-01 00:08:58 +09:00
Norman Maurer
e0a6dc0ac3 Remove ChannelFutureProgressListener 2012-12-31 23:27:37 +09:00
Norman Maurer
4e77bacdf7 [#873] [#868] Split ChannelFuture into ChannelFuture and ChannelPromise 2012-12-31 23:27:16 +09:00
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
Norman Maurer
926a20f105 [#880] correctly use methods which take a ChannelFuture as parameter 2012-12-31 11:43:05 +01:00
Norman Maurer
b49b3d9c56 [#879] Notify correct ChannelFuture for queued FileRegions 2012-12-31 11:35:25 +01:00
Norman Maurer
5aa679fec7 [#840] Generate the tarball with top level directory 2012-12-30 21:26:08 +01:00
Norman Maurer
c80b1bb66e [#872] AbstractNioByteChannel and AbstractNioMessageChannel should be public 2012-12-30 12:48:32 +01:00
alexey
738d382fbc Added test cases for NetUtil methods, if we can`t convertAddress we return null 2012-12-29 18:31:53 +01:00
Norman Maurer
0fb0037eab Rename IpAddresses to NetUtil 2012-12-29 18:25:32 +01:00
Norman Maurer
5d13c7d27b Merge IPUtil and NetworkConstants into IpAddresses and also make naming of methods consistent 2012-12-29 18:17:33 +01:00
Norman Maurer
213c1e3d23 Replace sun.net.util.IPAddressUtil usage with own implementation 2012-12-29 18:13:44 +01:00
Norman Maurer
e2b240799c [#857] Check if the SelectionKey is valid before access readyOps() 2012-12-29 18:07:02 +01:00