Commit Graph

684 Commits

Author SHA1 Message Date
Norman Maurer
a25f7fa2e5 Revert "[#972] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed"
This reverts commit 4ac3bace0f.
2013-01-23 06:45:44 +01:00
Norman Maurer
4ac3bace0f [#972] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed 2013-01-22 21:18:13 +01:00
Brian Roach
54af70f067 Bootstrap thread safety
Changed options and attrs from LinkedHashMap to ConcurrentHashMap to
avoid a possible ConcurrentModificationException if a thread was
adding/removing options/attrs while another was calling Bootstrap.init()
or Bootstrap.duplicate()
2013-01-22 07:06:02 +01:00
Norman Maurer
4192222b38 Rname StreamOioByteChannel to OioByteStreamChannel 2013-01-21 12:10:07 +01:00
Norman Maurer
7316a3c65c [#965] Allow to adjust the SO_TIMEOUT on the fly 2013-01-21 11:48:05 +01:00
Norman Maurer
082b5f0dff [#962] Read data as soon as it is present in OIO and not wait till it match Buffer.writableBytes()
- Also add a new abstract class called StreamOioByteChannel which can be used by OIO channel implementation which are Stream based as a starting point.
2013-01-21 10:14:21 +01:00
Norman Maurer
57e504a7e6 Add javadocs to the *ChannelConfig interfaces to make clear which ChannelOptions implementations are expect to support 2013-01-20 08:10:15 +01:00
Norman Maurer
76d7829d38 [#960] Fix calculation of writerIndex() which was incorrect and so result in truncated DatagramPackets when using NIO 2013-01-19 17:22:28 +01:00
Norman Maurer
1295f6d331 Fix formatting 2013-01-19 16:52:12 +01:00
Norman Maurer
d8f0e3fdf7 Add missing udp option 2013-01-19 16:51:00 +01:00
Norman Maurer
4dd462d0b5 [#907] Stop flush if one outboundbuffer was freed and do the same for inboundBufferUpdated if an inboundbuffer was freed 2013-01-18 07:08:11 +01:00
Trustin Lee
24acfe7008 Remove io.netty.monitor as discussed in #922 2013-01-18 11:08:57 +09:00
Trustin Lee
2c7be32393 Tiny optimization 2013-01-18 10:49:53 +09:00
Norman Maurer
16f729cd95 [#907] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated() was called once the channel was closed 2013-01-17 20:41:08 +01:00
Norman Maurer
677886f470 [#907] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated(), flush(..), write(..) was triggered after the channel was closed 2013-01-17 15:12:32 +01:00
Trustin Lee
4472fe9795 Remove 'get' prefix 2013-01-17 15:06:46 +09:00
Trustin Lee
f568aa42f0 Hide the constructors of ChannelOption to force using dedicated option type 2013-01-17 14:14:41 +09:00
Norman Maurer
f136eafd5e [#943] Fix CanceledKeyException which can happen on frequently deregister/register while using the NIO Transport 2013-01-16 15:27:27 +01:00
Norman Maurer
895bce6cd5 [#917] Move transport depending ChannelOption to the specific transport to make it consistent 2013-01-16 08:04:09 +01:00
Trustin Lee
506474f569 Overhaul pipeline implementation for clarity and memory efficiency
This pull request cleans up our pipeline implementation by moving most
inter-context traversal code to DefaultChannelHandlerContext.
Previously, outbound traversal was done in DefaultChannelPipeline while
inbound traversal was done in DefaultChannelHandlerContext.

Also, to address the memory inefficiency issue raised in #920, all
runnables are lazily instantiated.
2013-01-16 00:38:14 +09:00
Trustin Lee
573a723dc2 Fix a bug where ChannelPIpeline.remove/replace() fails when its channel is not registered yet 2013-01-14 21:50:08 +09:00
Trustin Lee
e263769a55 Fix a bug where the buffers are freed too early when a handler is removed or replaced 2013-01-14 21:43:45 +09:00
Trustin Lee
a03bc6ea1d Fix a bug where freeInbound/OutboundBuffer() is not called when a handler is removed from a pipeline. 2013-01-14 20:54:12 +09:00
Norman Maurer
eb91a6d4e6 [#924] [#914] Fix high CPU usage which was caused because the OP_CONNECT flag was not cleared after the connect was complete 2013-01-11 19:42:21 +01:00
Trustin Lee
64ae8b6a37 Replace and merge DetectionUtil and DirectByteBufUtil into PlatformDependent and PlatformDependent0
PlatformDependent delegates the operations requires sun.misc.* to PlatformDependent0 to avoid runtime errors due to missing sun.misc.* classes.
2013-01-11 14:03:27 +09:00
Trustin Lee
8975406b86 Ensure the outbound buffer is not freed on write completion
- Fixes #919
2013-01-10 21:05:51 +09:00
Trustin Lee
665d022e82 Use a heap buffer from the allocator because it doesn't seem to cause OOME anymore 2013-01-10 16:23:40 +09:00
Trustin Lee
eb337ff5a7 Fix various inspection warnings 2013-01-10 15:23:58 +09:00
Trustin Lee
3c9d912355 Use InetSocketAddress wherever possible / Tighten the return type of Channel.parent() 2013-01-10 14:17:54 +09:00
Trustin Lee
793a571465 Fix a runtime type cast exception when calling RxtxChannel.local/remoteAddress() 2013-01-10 14:01:17 +09:00
Trustin Lee
137f29ba65 Do not read if a channel is inactive 2013-01-09 21:28:31 +09:00
Trustin Lee
46e364e7b7 Remove unnecessary parameters 2013-01-09 20:36:16 +09:00
Trustin Lee
b9352ded13 Fix a bug where prev/next context is not always set 2013-01-09 20:34:22 +09:00
Trustin Lee
8586d43b23 Fix DefaultChannelPipeline.toString() / Remove unnecessary conditions 2013-01-09 19:16:09 +09:00
Trustin Lee
b6fcf3acc4 Simplify DefaultChannelPipeline 2013-01-09 19:13:43 +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
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
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
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
2f6e17f681 Make sure we catch UnsupportedOperationException for derived buffers 2013-01-03 22:49:54 +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
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
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