Trustin Lee
faf8b76b5a
Fix a potential bug where AbstractUnsafe.flush0() fails to clear the inFlush0 flag
...
- Fixes #1609
2013-07-19 08:56:17 +09:00
Trustin Lee
8178322c5c
A little bit of Javadoc for ChannelOutboundBuffer
2013-07-19 01:17:00 +09:00
Trustin Lee
fef838f197
Make sure channelInactive() and channelDeregistered() are triggered even if outboundBuffer.recycle() fails
2013-07-19 01:09:19 +09:00
Trustin Lee
8828d5327a
Move inFlush0 and outboundBuffer in AbstractChannel to AbstractUnsafe
...
.. because they are accessed by AbstractUnsafe much more often.
2013-07-18 23:33:39 +09:00
Trustin Lee
5e5df6bd09
Fix NPE
2013-07-18 23:29:13 +09:00
Trustin Lee
4cd7e62555
Make ChannelOutboundBuffer recycled
2013-07-18 23:26:45 +09:00
Trustin Lee
46ea0d4e7b
Implement gathering writes in NioSocketChannel
...
- Add some support methods in ChannelOutputBuffer
2013-07-18 23:14:39 +09:00
Trustin Lee
4f0a952241
Checkstyle
2013-07-18 21:01:01 +09:00
Trustin Lee
bcef796dc7
Rewrite ChannelOutboundBuffer
...
- Merge MessageList into ChannelOutboundBuffer
- Make ChannelOutboundBuffer a queue-like data structure so that it is nearly impossible to leak a message
- Make ChannelOutboundBuffer public so that AbstractChannel can expose it to its subclasses.
- TODO: Re-enable gathering write in NioSocketChannel
2013-07-18 20:59:14 +09:00
Trustin Lee
b130ee6a6c
[maven-release-plugin] prepare for next development iteration
2013-07-18 11:17:42 +09:00
Trustin Lee
10d395e829
[maven-release-plugin] prepare release netty-4.0.3.Final
2013-07-18 11:17:31 +09:00
Trustin Lee
568166d554
Cleanup
2013-07-18 10:29:34 +09:00
Trustin Lee
473af5c98e
Fix checkstyle
2013-07-18 10:25:16 +09:00
Trustin Lee
e28594952b
Make the cleanup logic in ChannelOutboundBuffer more robust
...
- Fixes #1601
2013-07-18 10:23:26 +09:00
Trustin Lee
9c8d980a74
Fix a bug where a ChannelFutureListener can allow Unsafe.close() and Unsafe.flush() to overlap and reenter from flush() to close().
...
- Fixes #1600
2013-07-18 10:14:55 +09:00
Norman Maurer
fc7c950b08
[maven-release-plugin] prepare for next development iteration
2013-07-17 15:58:36 +02:00
Norman Maurer
bbbf72359e
[maven-release-plugin] prepare release netty-4.0.2.Final
2013-07-17 15:58:28 +02:00
Trustin Lee
88cbdb50d2
Fail unflushed writes with ClosedChannelException
...
... instead of cryptic exception message.
2013-07-17 21:25:51 +09:00
Trustin Lee
5f235eafc3
Fix checkstyle
2013-07-17 21:17:52 +09:00
Trustin Lee
31ecd17212
Fix test failure
2013-07-17 21:16:52 +09:00
Trustin Lee
cc9b9567b9
Make sure all write attempts made after a channel is closed are marked as failure
2013-07-17 21:14:07 +09:00
Trustin Lee
a8d67b0282
Fix data structure corruption and resource leak in ChannelOutboundBuffer
2013-07-17 21:02:56 +09:00
Trustin Lee
dcf7896172
Do not close ServerChannel on IOException while accepting an incoming connection
...
.. so that we can recover from 'too many open files'
- Fixes #1578
2013-07-16 18:39:29 +09:00
Trustin Lee
57eb531eb8
[maven-release-plugin] prepare for next development iteration
2013-07-16 17:16:10 +09:00
Trustin Lee
76cefcc421
[maven-release-plugin] prepare release netty-4.0.1.Final
2013-07-16 17:15:54 +09:00
Norman Maurer
5297eba280
[maven-release-plugin] prepare for next development iteration
2013-07-15 15:48:15 +02:00
Norman Maurer
c5d8af446a
[maven-release-plugin] prepare release netty-4.0.0.Final
2013-07-15 15:48:05 +02:00
Trustin Lee
246a3ecdcb
[maven-release-plugin] prepare for next development iteration
2013-07-15 20:58:33 +09:00
Trustin Lee
e8fd209115
[maven-release-plugin] prepare release netty-4.0.0.Final
2013-07-15 20:58:21 +09:00
Norman Maurer
2de491aa7f
Use UnpooledByteBufAllocator as default
2013-07-15 10:44:33 +02:00
Norman Maurer
d5f052f39c
Rename ChannelGroupMatcher to ChannelMatcher
2013-07-15 10:42:36 +02:00
Norman Maurer
9dfad35423
Fix checkstyle
2013-07-14 18:32:10 +02:00
Norman Maurer
75997545ed
Fix checkstyle
2013-07-14 18:13:47 +02:00
Norman Maurer
c20c852602
More javadoc fixes
2013-07-14 18:04:33 +02:00
Norman Maurer
43d22f6d23
Remove unused class which was package private anyway
2013-07-14 17:54:07 +02:00
Norman Maurer
a07abee55f
Add and correct javadocs
2013-07-13 19:42:02 +02:00
Norman Maurer
2af7db361b
[ #1573 ] Fix NPE which could be triggered one failed promises that trigger a close89
2013-07-12 22:57:03 +02:00
Norman Maurer
2871079c4a
[ #1557 ] Make the contract of Channel.Unsafe.flush() more clear
...
* Remove boolean parameter from Channel.Unsafe.flush() method
* Move NIO related things to AbstractNioChannel.NioUnsafe
2013-07-12 19:45:31 +02:00
Trustin Lee
660729bd56
Kill the cruft
2013-07-12 20:41:29 +09:00
Trustin Lee
456994607b
|| -> &&
2013-07-12 20:32:49 +09:00
Trustin Lee
99716993f6
Add a boolean parameter to Channel.Unsafe.flush() so that SelectionKey state check can be bypassed.
2013-07-12 20:14:50 +09:00
Trustin Lee
e10e9d38c4
Fix embarassing compilation error :-/
2013-07-12 20:12:18 +09:00
Trustin Lee
85a2ba3752
Remove dead code
...
- Fixed #1557
2013-07-12 20:10:39 +09:00
Trustin Lee
6d1220b55e
Reduce garbage in AbstractUnsafe.flush0()
2013-07-12 20:04:01 +09:00
Trustin Lee
529d904d29
Fix a bug where ChannelOutboundBuffer.addFlush() is called multiple times
2013-07-12 20:01:38 +09:00
Trustin Lee
e2fcb06d9a
Remove unnecessary try-catch block in AbstractUnsafe.flush()
2013-07-12 20:00:30 +09:00
Norman Maurer
43f12569aa
Cache flush(..) tasks which are used when executing with different EventExecutor to lower GC pressure
2013-07-12 11:57:33 +02:00
Norman Maurer
aa64c13bb8
Cleanup
2013-07-12 11:48:26 +02:00
Norman Maurer
d23c3b3382
Introduce ChannelGroupMatcher which can be used to only apply operations of a ChannelGroup on matching Channels.
...
This is often useful if you for example use a ChannelGroup to hold all connected Channels and want to broadcast a message too all of them
except one Channel.
2013-07-11 10:58:53 +02:00
Norman Maurer
12ea35fd5f
Add missing javadocs
2013-07-11 10:26:10 +02:00
Jeff Pinner
224f05e626
Use correct permission mode for java files
2013-07-10 21:58:12 +02:00
Trustin Lee
b7a7c33fe3
Fix a bug in ChannelOutboundBuffer.addFlush()
...
It should not advance the tail if no write() was issued so far.
2013-07-11 01:05:26 +09:00
Norman Maurer
b57d9f307f
Allow per-write promises and disallow promises on flush()
...
- write() now accepts a ChannelPromise and returns ChannelFuture as most
users expected. It makes the user's life much easier because it is
now much easier to get notified when a specific message has been
written.
- flush() does not create a ChannelPromise nor returns ChannelFuture.
It is now similar to what read() looks like.
2013-07-11 00:49:48 +09:00
Norman Maurer
dd763698dc
Adjust ChannelGroup to behave the same like a Channel in terms of write and flush
2013-07-10 08:27:11 +02:00
Trustin Lee
7bedd8f28e
Simplify the exception handling of ChannelOutboundHandler.write()
...
DefaultChannelHandlerContext does not trigger exceptionCaught() immediately when ChannelOutboundHandler.write() raises an exception. It just records the exception until flush() is triggered. On invokeFlush(), if there's any exception recorded, DefaultChannelHandlerContext will fail the promise without calling ChannelOutboundHandler.flush(). If more than one exception were raised, only the first exception is used as the cause of the failure and the others will be logged at warn level.
2013-07-10 00:36:47 +09:00
Trustin Lee
26e9d70457
Remove channelReadSuspended / Rename messageReceived(Last) to channelRead(Complete)
...
- Remove channelReadSuspended because it's actually same with messageReceivedLast
- Rename messageReceived to channelRead
- Rename messageReceivedLast to channelReadComplete
We renamed messageReceivedLast to channelReadComplete because it
reflects what it really is for. Also, we renamed messageReceived to
channelRead for consistency in method names.
2013-07-09 23:58:51 +09:00
Trustin Lee
cbd8817905
Remove MessageList from public API and change ChannelInbound/OutboundHandler accordingly
...
I must admit MesageList was pain in the ass. Instead of forcing a
handler always loop over the list of messages, this commit splits
messageReceived(ctx, list) into two event handlers:
- messageReceived(ctx, msg)
- mmessageReceivedLast(ctx)
When Netty reads one or more messages, messageReceived(ctx, msg) event
is triggered for each message. Once the current read operation is
finished, messageReceivedLast() is triggered to tell the handler that
the last messageReceived() was the last message in the current batch.
Similarly, for outbound, write(ctx, list) has been split into two:
- write(ctx, msg)
- flush(ctx, promise)
Instead of writing a list of message with a promise, a user is now
supposed to call write(msg) multiple times and then call flush() to
actually flush the buffered messages.
Please note that write() doesn't have a promise with it. You must call
flush() to get notified on completion. (or you can use writeAndFlush())
Other changes:
- Because MessageList is completely hidden, codec framework uses
List<Object> instead of MessageList as an output parameter.
2013-07-09 23:51:48 +09:00
Trustin Lee
7396f9f2b2
Remove Channel.id completely / Use 64-bit hashCode internally to reduce the chance of collision in compareTo()
2013-07-09 14:49:06 +09:00
Norman Maurer
9c1b31d20a
[ #1535 ] Remove Channel.id() and so fix the possible leakage of the previous used Channel id map
...
The user can still use Channel.hashCode() for logging. It's just not 100% unique but should be good enough for most cases
2013-07-08 14:07:18 +02:00
Norman Maurer
39b57b889c
[ #1539 ] Fix bug in DefaultChannelGroup.close() which was blocking the close() call on ServerChannel
2013-07-08 13:36:39 +02:00
Trustin Lee
a52ac692a9
Faster MessageList iteration in NioSocketChannel.doWrite()
2013-07-07 15:15:52 +09:00
Trustin Lee
2b2f8db5d2
Use ThreadLocalRandom where possible
2013-07-07 12:37:36 +09:00
Norman Maurer
086ae3536c
[ #1533 ] Introduce ByteBufHolder.duplicate() and make use of it in DefaultChannelGroup.write(...)
2013-07-06 21:17:51 +02:00
Trustin Lee
eb8df35f21
Use MessageList.first() and last() wherever possible
...
- Related issue: #1530
2013-07-05 14:11:09 +09:00
Trustin Lee
b7e6a86c1e
Add MessageList.first() and last() for convenience.
...
- Fixes #1530
2013-07-05 14:07:51 +09:00
Trustin Lee
0b9235f072
Simplify ByteBufProcessor and MessageListProcessor and Add internal component accessors to CompositeByteBuf
...
- Fixes #1528
It's not really easy to provide a general-purpose abstraction for fast-yet-safe iteration. Instead of making forEachByte() less optimal, let's make it do what it does really well, and allow a user to implement potentially unsafe-yet-fast loop using unsafe operations.
2013-07-05 14:00:46 +09:00
Norman Maurer
2bda1b530a
[ #1523 ] Fix bug which lead to have SelectedKeys handled two times and so caused a NPE on heavy load
2013-07-04 16:15:33 +02:00
Norman Maurer
08b75e594c
[ #1519 ] VoidChannelPromise don't fire CancellationException anymore which was incorrect
2013-07-04 09:32:38 +02:00
Norman Maurer
cea873286e
[ #1517 ] Only fire the exception throught the pipeline if the channel is registered when using VoidChannelPromise
2013-07-04 09:20:24 +02:00
Trustin Lee
998b408db3
Fix NPE in OioByteStreamChannel
...
- Do not assign null to 'is' and 'os' but assign an alternative stream implementation
2013-07-04 12:04:28 +09:00
Norman Maurer
7ec12d327f
Remove deprecated ByteBufUtil.release(..) and ByteBufUtil.retain(..) methods and its usage. Also fix a problem where an object would have been released two times.
...
* The problem with the release(..) calls here was that it would have called release on an unsupported message and then throw an exception. This exception will trigger ChannelOutboundBuffer.fail(..), which will also try to release the message again.
* Also use the same exception type for unsupported messages as in other channel impls.
2013-07-03 10:00:13 +02:00
Norman Maurer
ec5e793a2f
[maven-release-plugin] prepare for next development iteration
2013-07-02 11:41:18 +02:00
Norman Maurer
ca73eaef0d
[maven-release-plugin] prepare release netty-4.0.0.CR9
2013-07-02 11:41:09 +02:00
Norman Maurer
830c559405
[maven-release-plugin] rollback the release of netty-4.0.0.CR9
2013-07-02 11:34:29 +02:00
Norman Maurer
66a16b133c
[maven-release-plugin] prepare release netty-4.0.0.CR9
2013-07-02 10:45:12 +02:00
Trustin Lee
956c0f8b90
Better explanation of reentrance issue of ChannelOutboundBuffer
2013-07-02 17:22:56 +09:00
Norman Maurer
5437835832
[ #1501 ] Fix NPE correctly which could accour if ChannelOutboundBuffer.fail(..) triggered another call to ChannelOutboundBuffer.fail(...)
2013-07-02 09:58:41 +02:00
Norman Maurer
8dfbcbda29
[ #1501 ] Fix NPE which could accour if ChannelOutboundBuffer.fail(..) triggered another call to ChannelOutboundBuffer.fail(...)
2013-07-02 09:32:34 +02:00
Trustin Lee
7e3a01cc51
[maven-release-plugin] prepare for next development iteration
2013-07-02 10:26:48 +09:00
Trustin Lee
149db34c19
[maven-release-plugin] prepare release netty-4.0.0.CR8
2013-07-02 10:26:32 +09:00
Trustin Lee
efd9c94775
Use higher maxMessagesPerRead as default for ServerChannels
...
- Fixes #1493
2013-07-02 10:20:15 +09:00
Trustin Lee
26b56d3add
Fix a bug in MessageList.add(T[])
...
- where it uses incorrect source index while iteration
2013-07-02 10:11:17 +09:00
Trustin Lee
720de2e6cc
Add missing sanity check for DefaultChannelHandlerContext.write(...)
2013-07-02 09:36:01 +09:00
Trustin Lee
4b11aff08f
Less confusing log messages for system properties
...
- Fixes #1502
2013-07-02 09:23:29 +09:00
Norman Maurer
5d88c423df
[ #1500 ] Remove @deprecated methods
2013-07-01 08:53:02 +02:00
Norman Maurer
617ab6321b
[ #1489 ] Correctly handle channelReadSuspended and channelWritabilityChanged in CombinedChannelDuplexHandler
2013-06-30 17:18:33 +02:00
Trustin Lee
613547b0b9
[maven-release-plugin] prepare for next development iteration
2013-06-28 22:15:33 +09:00
Trustin Lee
a6abd2feb2
[maven-release-plugin] prepare release netty-4.0.0.CR7
2013-06-28 22:15:20 +09:00
Trustin Lee
ea963c25c9
Improve Javadoc of ChannelPipeline
...
- Fixes #1226
2013-06-28 22:09:00 +09:00
Trustin Lee
5f1aa6afde
Remove potentially misleading exception message
...
.. because the MessageList itself is not read-only.
2013-06-28 21:25:15 +09:00
Trustin Lee
591dce565a
checkExclusive() -> checkIndex()
2013-06-28 21:17:18 +09:00
Trustin Lee
d4665f1703
Fix test failures
2013-06-28 21:14:23 +09:00
Trustin Lee
1e0146da3e
Optimize MessageList.add(MessageList, int, int)
2013-06-28 20:53:57 +09:00
Trustin Lee
7cf88a1a3c
Add MessageList.array() / Rewrite MessageList.add(T[], int, int)
...
- MessageList.array() should give better performance + concise code
- MessageList.add(T[], int, int) iterated over the source array 3 times at worst case. This commit reduces that to 1 time.
2013-06-28 20:47:19 +09:00
Trustin Lee
0dcf352f4c
Vastly simplified ByteBufProcessor and MessageListProcessor
...
- Related: #1378
- They now accept only one argument.
- A user who wants to use a buffer for more complex use cases, he or she can always access the buffer directly via memoryAddress() and array()
2013-06-28 20:29:00 +09:00
Trustin Lee
52691488ee
Update Javadoc of ByteBufProcessor and MessageListProcessor
...
- in response to @shacharo's suggestion
2013-06-27 19:01:01 +09:00
Trustin Lee
4dd9b6ef2e
Add ByteBufProcessor and ByteBuf.forEach(...)
...
- Fixes #1378
- Needs to provide optimized forEach implementations though.
2013-06-27 13:55:42 +09:00
Trustin Lee
734ec51ac9
Allow specifying 0 as the default number of threads when instantiating an EventLoopGroup
...
- Fixes #1426
- We already allow a user instantiate an EventLoopGroup with the default number of threads via the default constructor, so I think it's OK although it's not always optimal.
2013-06-27 10:39:39 +09:00
Trustin Lee
bc483724f4
Improve the documentation of MessageList
...
- Fixes #1459
2013-06-25 18:27:29 +09:00
Trustin Lee
1f27c3b390
Make NioByteUnsafe.read() respect ChannelConfig.maxMessagesPerRead and adjust the default from 16 to 1
...
- Fixes #1486
- Decreased the default from 16 to 1 because unnecessary extra read on req-res protocols results in lower throughput due to extra syscalls.
2013-06-25 18:08:39 +09:00