Trustin Lee
04ec2e1330
Add Recycler.Handle.recycle() so that it's possible to recycle an object without an explicit reference to Recycler
2013-12-19 01:10:52 +09:00
Trustin Lee
3e8a1ed611
Fix a race condition where flush() can be triggered before write()
...
.. when a handler overrides write() but not flush().
2013-12-17 09:51:41 +09:00
Trustin Lee
94d6e44bba
Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
...
.. so that there's no need to explicitly down-cast.
Fixes #2067
2013-12-16 22:22:47 +09:00
Trustin Lee
4302c016d2
Rename flushAndWrite() to writeAndFlush()
...
- Related: #2066
2013-12-16 14:58:14 +09:00
Norman Maurer
1a9eb05ba0
[ #2065 ] Fix NPE in AbstractOioByteChannel during write to the socket
2013-12-15 11:44:51 +01:00
Trustin Lee
b8ca01bd9e
Disable logging temporarily when running testRegistrationAfterShutdown
2013-12-08 14:17:35 +09:00
Trustin Lee
0d70ba4938
Disable logging temporarily when running testRegistrationAfterShutdown2
2013-12-08 14:12:10 +09:00
Trustin Lee
524726fd99
Fix NoSuchElementException raised by ChannelInitializer
...
.. again.
2013-12-07 11:03:55 +09:00
Trustin Lee
3d54a323ca
Revert "Fix NoSuchElementException raised by ChannelInitializer"
...
This reverts commit 3c453f5dba
.
2013-12-07 10:57:13 +09:00
Norman Maurer
643ce2f8c0
Fix all leaks reported during tests
...
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:47:30 +09:00
Trustin Lee
3c453f5dba
Fix NoSuchElementException raised by ChannelInitializer
2013-12-07 00:39:41 +09:00
Trustin Lee
974d1ebf0a
Merge package private interfaces into public ones.
...
- Related: #1989 and #1991
2013-11-27 18:42:23 +09:00
Trustin Lee
110745b0eb
Remove the distinction of inbound handlers and outbound handlers
...
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c
Simplify bundle generation / Add io.netty.versions.properties to all JARs
...
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging. This is
more robust because some strict build tools fail to retrieve the
artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:00:14 +09:00
Trustin Lee
132af3a485
Introduce ChannelHandlerInvoker, dedeciated for invoking event handler methods, and move most handler invocation code in ChannelHandlerContext to the default ChannelHandlerInvoker implementation
...
- Fixes #1912
- Add ChannelHandlerInvoker and its default implementation
- Add pipeline manipulation methods that accept ChannelHandlerInvoker
- Rename Channel(Inbound|Outbound)Invoker to
Channel(Inbound|Outbound)Ops to avoid confusion
- Remove the Javadoc references to the package-private interfaces
2013-11-21 14:14:23 +09:00
Trustin Lee
d0e928db70
Additional fix for potential race condition which occurs when a user cancels a connection attempt
...
- Fixes #1986
2013-11-18 17:00:23 +09:00
Trustin Lee
38f57adb70
Fix an unexpected IllegalStateException from a selector loop when a user cancels a connection attempt
...
- Fixes #1986
2013-11-18 16:33:49 +09:00
Trustin Lee
786fdbd6e0
Bring back ChannelGroup.find(id)
2013-11-18 15:59:44 +09:00
Trustin Lee
2235873537
Resurrect Channel.id() with global uniqueness
...
- Fixes #1810
- Add a new interface ChannelId and its default implementation which generates globally unique channel ID.
- Replace AbstractChannel.hashCode with ChannelId.hashCode() and ChannelId.shortValue()
- Add variants of ByteBuf.hexDump() which accept byte[] instead of ByteBuf.
2013-11-18 15:30:12 +09:00
Trustin Lee
daf15fc167
Don't create an EmbeddedSocketAddress every time
2013-11-08 18:01:29 +09:00
Norman Maurer
a86e215718
Fix regression which lead to leak buffers when nothing could be read from the Channel.
...
This was introduced as part of #1812 , but fortunatualy was not part of any release.
2013-11-07 07:13:20 +01:00
Trustin Lee
7fff25c0de
Remove AUTO_CLOSE option
...
- Related #1952
- Since 5.0, we ask users decide to close the channel on write failure.
2013-11-05 17:34:48 +09:00
Trustin Lee
e2de807fb0
Add AUTO_CLOSE option
...
- Fixes #1952
- If AUTO_CLOSE is turned on, Netty will close the channel immediately and automatically on write failure. The default is false.
2013-11-05 17:23:58 +09:00
Trustin Lee
26415b8f4c
Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
...
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2013-11-04 19:42:33 +09:00
Trustin Lee
6b0025430e
Bump the version to 5.0.0.Alpha1
2013-11-04 19:14:40 +09:00
Norman Maurer
de2c6acecf
[ #1940 ] Add javadoc to explain how the FileChannel is closed when using DefaultFileRegion
2013-11-02 15:59:56 +01:00
Trustin Lee
9d611a182f
Rename SimpleChannelInboundHandler.channelRead0() to messageReceived()
...
- Related: #1590
2013-11-02 19:59:21 +09:00
Norman Maurer
542efdc7c7
[ #1812 ] All to have NioMessageUnsafe.read() inlined
2013-10-26 17:43:10 +02:00
Trustin Lee
0dda7df344
Add a shortcut method for collision-free naming
2013-10-25 20:01:31 +09:00
Trustin Lee
dc009b2c2c
Replace UniqueName with Constant and ConstantPool
...
- Proposed fix for #1824
UniqueName and its subtypes do not allow getting the previously registered instance. For example, let's assume that a user is running his/her application in an OSGi container with Netty bundles and his server bundle. Whenever the server bundle is reloaded, the server will try to create a new AttributeKey instance with the same name. However, Netty bundles were not reloaded at all, so AttributeKey will complain that the name is taken already (by the previously loaded bundle.)
To fix this problem:
- Replaced UniqueName with Constant, AbstractConstant, and ConstantPool. Better name and better design.
- Sctp/Udt/RxtxChannelOption is not a ChannelOption anymore. They are just constant providers and ChannelOption is final now. It's because caching anything that's from outside of netty-transport will lead to ClassCastException on reload, because ChannelOption's constant pool will keep all option objects for reuse.
- Signal implements Constant because we can't ensure its uniqueness anymore by relying on the exception raised by UniqueName's constructor.
2013-10-25 19:21:53 +09:00
Norman Maurer
98541be4b7
[ #1947 ] Handle RejectExecutionException graceful for outbound operations
2013-10-25 07:57:25 +02:00
Norman Maurer
db765e5dd4
[ #1812 ] Allow for inline for most common cases when use NioByteUnsafe.read()
2013-10-23 19:53:54 +02:00
Norman Maurer
da1418e269
[ #1920 ] Fix IndexOutOfBoundsException when using PooledByteBufAllocator with SCTP and NIO Datagram channels
2013-10-16 11:51:50 +02:00
Trustin Lee
16bf687aec
Ensure the selector implementation can be instrumented before attempting instrumentation
...
- Fixes #1908
2013-10-11 12:07:46 +09:00
Trustin Lee
136e1ebba8
Fix compilation errors / Cleanup
2013-10-08 17:20:07 +09:00
Trustin Lee
9097fce9e3
Allow empty handler list when creating a new EmbeddedChannel
...
.. so that it can be used for dynamically initialized pipelines
- Fixes #1899
2013-10-08 17:18:41 +09:00
Trustin Lee
1c15ba0c95
Rename getChildGroup() to childEventLoopGroup() / Minor cleanup
2013-10-08 17:03:50 +09:00
Bill Gallagher
e743a27e75
Pass eventLoop and childEventLoopGroup as Channel constructor parameters
...
- Add ServerChannelFactory for ServerBootstrap which is the counterpart
of ChannelFactory for Bootstrap
2013-10-08 17:03:50 +09:00
Trustin Lee
8864792499
Fixes the problem where the promise of the outbound operation that causes a channel closure is notified after channelInactive()
...
- Fixes #1897
2013-10-08 12:24:32 +09:00
Norman Maurer
44293291a7
Use direct ByteBuf for the test to make sure it is not copied
2013-10-07 08:07:38 +02:00
Norman Maurer
7ad3c1e10c
[ #1890 ] Correctly expand ByteBuffer array in all cases
...
The problem was that we did not handle the case correctly when doubling the array was not enough. We need to keep doubling until everything fits in.
2013-10-06 15:30:51 +02:00
Norman Maurer
a4a207fc4f
Fix checkstyle
2013-10-02 06:44:10 +02:00
Bill Gallagher
a5220198ba
use enum for state in LocalChannel
2013-10-02 06:32:03 +02:00
Bill Gallagher
f80109f423
use enum for state in EmbeddedChannel
2013-10-01 21:08:45 +02:00
Bill Gallagher
20d5361403
[ #1832 ] - Channel writability change notifications sometimes fail to fire
2013-09-30 20:09:28 +02:00
Norman Maurer
c2101d3c56
Cache underlying ByteBuffers and count in ChannelOutboundBuffer.Entry to reduce object creation and so GC pressure
...
Beside this it also helps to reduce CPU usage as nioBufferCount() is quite expensive when used on CompositeByteBuf which are
nested and contains a lot of components
2013-09-26 21:01:40 +02:00
Norman Maurer
cd5f9a2212
Introduce a new ChannelOption called DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION. Related to [ #1830 ]
...
This ChannelOption allows to tell the DatagramChannel implementation to be active as soon as they are registrated to their EventLoop. This can be used to make it possible to write to a not bound DatagramChannel.
The ChannelOption is marked as @deprecated as I'm looking for a better solution in master which breaks default behaviour with 4.0 branch.
2013-09-24 11:51:54 +02:00
Sasha Zverev
71c062167d
Slip in DefaultOioSocketChannelConfig (setAllowHalfClosure used to ignore argument)
2013-09-21 20:14:12 +02:00
Norman Maurer
3cfcf09af8
More efficient handling of incomplete writes.
...
The problem with the old way was that we always set the OP_WRITE when the buffer could not be written
until the write-spin-count was reached. This means that in some cases the channel was still be writable
but we just was not able to write out the data quick enough. For this cases we should better break out the
write loop and schedule a write to be picked up later in the EventLoop, when other tasks was executed.
The OP_WRITE will only be set if a write actual returned 0 which means there is no more room for writing data
and this we need to wait for the os to notify us.
2013-09-17 07:01:05 +02:00
Norman Maurer
8dc57f6933
[ #1836 ] Add comment to explain why read is triggered
2013-09-17 06:58:23 +02:00
Norman Maurer
87a6a68059
[ #1830 ] Add testcase for write to not bound DatagramChannel impls and revert change in OIO as it breaks things as the udnerlying socket lazy binds
2013-09-12 09:29:40 +02:00
Norman Maurer
50106f3d41
Make DatagramChannel impls .isActive() return true when the underlying Channel is open. This also fixes [ #1830 ]
2013-09-11 20:38:04 +02:00
Norman Maurer
98633e0aee
Allow to only register a Channel via AbstractBootstrap and bind/connect it later. Related to [ #1829 ]
2013-09-11 20:37:53 +02:00
Norman Maurer
6716dca17a
Use a Thread-local based direct buffer pool if non pooled allocator is used
2013-09-05 11:58:03 +02:00
Trustin Lee
95576d6559
Ensure operationProgressed is invoked even on completion
...
- Fixes #1809
2013-09-05 18:36:48 +09:00
Norman Maurer
9331226406
Split up the nioBuffers() method to allow for inline. Related to #1812
...
This move less common method patterns to extra methods and so make the nioBuffers() method with most common pattern (backed by one ByteBuffer) small enough for inlining.
2013-09-05 09:24:27 +02:00
Norman Maurer
d75897bb2d
[ #1805 ] Fix example in javadocs of SimpleChannelInboundHandler
2013-09-03 20:31:42 +02:00
Norman Maurer
a52bbd20f4
Make sure only direct ByteBuffer are passed to the underlying jdk Channel.
...
This is needed because of otherwise the JDK itself will do an extra ByteBuffer copy with it's own pool implementation. Even worth it will be done
multiple times if the ByteBuffer is always only partial written. With this change the copy is done inside of netty using it's own allocator and
only be done one time in all cases.
2013-09-02 20:17:34 +02:00
Norman Maurer
70f5a4e2ce
[ #1683 ] Remove used ChannelOptions
2013-09-02 10:07:10 +02:00
bgallagher
c149f4bcc0
Remove support from deregister a Channel from a EventLoop manually
2013-08-29 18:11:16 +02:00
Vladimir Krivosheev
761e9ba956
ability to use Executor instead of ThreadFactory
2013-08-27 07:59:27 +02:00
Norman Maurer
6fc297bc42
[ #1785 ] Fix incorrect javadocs
2013-08-27 06:54:50 +02:00
Norman Maurer
09a748abdb
Bump up version to 4.1.0.Alpha1-SNAPSHOT
2013-08-26 15:18:18 +02:00
Norman Maurer
2e39b25cd4
[maven-release-plugin] prepare for next development iteration
2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866
[maven-release-plugin] prepare release netty-4.0.8.Final
2013-08-26 12:00:54 +02:00
Norman Maurer
5e9b199296
@deprecated all methods which are related to deregister as it will be removed in 4.1.0.Final
2013-08-26 11:36:56 +02:00
Norman Maurer
80d30c3dd8
Small code improvements
2013-08-26 07:52:47 +02:00
Norman Maurer
77d4222db5
[ #1777 ] Use correct Thread when close per channel
2013-08-25 21:22:53 +02:00
Norman Maurer
f76c01c3aa
[ #1782 ] Fix IndexOutOfBoundException with direct buffer and gathering writes
2013-08-24 18:16:05 +02:00
Trustin Lee
7aefd0cbdb
Make AbstractBootstrap public
...
.. to work around the issue with JDK reflection described here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4283544
Fixes #1780
2013-08-24 17:20:53 +09:00
Norman Maurer
9ca20b73d3
Add testcase to show channelRegistered is called
2013-08-23 17:17:28 +02:00
bgallagher
51fa795819
fix race condition in test
2013-08-23 16:20:02 +02:00
Norman Maurer
206dc2a391
[ #1772 ] Make sure ChannelOutboundBuffer.recycle() does also reset unflushed, flushed and tail.
...
This fix a IndexOutOfBoundsException which as triggered if recycle() did cut down the buffer[] to the initial size.
2013-08-23 09:01:16 +02:00
Norman Maurer
9fd35d09a2
[ #1770 ] Fix NPE which was thrown if connection timeout was disabled and the connect did not finish directly when using NIO
2013-08-22 12:38:56 +02:00
bgallagher
6a2f340ec0
trim buffers before recycling
2013-08-21 20:28:54 +02:00
bgallagher
fb619f2394
fix writability callback
2013-08-21 16:39:50 +02:00
Norman Maurer
217b8e255c
[ #1763 ] Fill ChannelOutboundBuffer.nioBuffers with null on close to allow the content to be GC'ed
2013-08-20 21:15:05 +02:00
Trustin Lee
15cfa47ad9
Fix checkstyle
2013-08-20 14:40:28 +09:00
Trustin Lee
caf91b9c06
Fix IllegalStateException triggered while shutting down ThreadPerChannelEventLoopGroup
...
- Fix #1718
- Add the test case contributed by @mkw
2013-08-20 14:37:57 +09:00
bgallagher
a383988cdb
add struct to replace parallel arrays consolidate flushed & unflushed buffers
2013-08-18 19:19:57 +02:00
bgallagher
06e250e493
remove unused initialCapacity
2013-08-17 14:10:33 +02:00
bgallagher
9f88552f12
remove some dead code
2013-08-10 20:46:48 +02:00
Norman Maurer
280afda013
[ #1715 ] Remove extra call socket.configureBlocking(false)
2013-08-10 20:33:19 +02:00
bgallagher
59c2fd8813
[ #1723 ] invoke close in eventloop
2013-08-10 08:19:16 +02:00
Norman Maurer
9d8c4ded50
Move method in correct scope
2013-08-09 13:30:04 +02:00
Norman Maurer
4d0621855a
Remove unused package private method and so remove some complexity
2013-08-09 11:44:41 +02:00
Norman Maurer
b54937ab50
[ #1711 ] Allow to use ChannelOption for set / get MessageSizeEstimator
2013-08-08 20:37:35 +02:00
Norman Maurer
f40a3f34b1
[ #1692 ] Allow to set WRITE_BUFFER_HIGH_WATER_MARK and WRITE_BUFFER_LOW_WATER_MARK via ChannelOption
2013-08-08 20:30:01 +02:00
Norman Maurer
1d3560e389
[maven-release-plugin] prepare for next development iteration
2013-08-08 13:53:28 +02:00
Norman Maurer
8e97e6c461
[maven-release-plugin] prepare release netty-4.0.7.Final
2013-08-08 13:53:19 +02:00
Norman Maurer
fc6213604d
Make sure ChannelOutboundBuffer not throw NPE during increment/decrement pending writes
2013-08-08 13:42:25 +02:00
Norman Maurer
b934b6009c
Share some code, related to [ #1707 ]]
2013-08-07 20:28:33 +02:00
Norman Maurer
5ef30b6d8b
[ #1707 ] More efficient implementation of ChannelHandlerContext.writeAndFlush(..)
2013-08-07 20:15:10 +02:00
Norman Maurer
5b6e762bf4
Allow to have the Channel GC'ed ASAP
2013-08-07 10:32:03 +02:00
Norman Maurer
48a7a21541
Correctly update Channel.isWritable() when the write happens from outside the EventLoop in a fast fashion. Fixes [ #1697 ]
...
Introduce a new interface called MessageSizeEstimator. This can be specific per Channel (via ChannelConfig). The MessageSizeEstimator will be used to estimate for a message that should be written. The default implementation handles ByteBuf, ByteBufHolder and FileRegion. A user is free to plug-in his/her own implementation for different behaviour.
2013-08-07 10:10:43 +02:00
Norman Maurer
de44917e62
Use recyclable write task to reduce GC pressure
2013-08-05 14:59:58 +02:00
Trustin Lee
17b91f416d
Remove an irrelevant comment
...
.. because firedChannelActive is gone long ago
2013-08-05 16:50:25 +09:00
Norman Maurer
3f2000fa3a
[maven-release-plugin] prepare for next development iteration
2013-08-01 10:59:55 +02:00
Norman Maurer
3f70d5caa4
[maven-release-plugin] prepare release netty-4.0.6.Final
2013-08-01 10:59:46 +02:00
Norman Maurer
a06295fe0a
Correctly fix problem in ByteToMessageDecoder and ReplayingDecoder which could let to have a released buffer passed to the decode methods.
...
This fixes #1664 and revert also the original commit which was meant to fix it 3b1881b523
. The problem with the original commit was that it could delay handlerRemove(..) calls and so mess up the order or forward bytes to late.
2013-08-01 09:54:07 +02:00
Norman Maurer
e3410680de
[maven-release-plugin] prepare for next development iteration
2013-07-31 20:08:14 +02:00
Norman Maurer
0e124583d6
[maven-release-plugin] prepare release netty-4.0.5.Final
2013-07-31 20:08:05 +02:00
Trustin Lee
81de2275e4
Remove unnecessary traversal of pipeline which occurs when a Channel is closed
...
- Remove unnecessary ascending traversal of pipeline in DefaultChannelHandlerContext.freeInbound()
- Move DefaultChannelHandlerContext.teardownAll() to DefaultChannelPipeline
2013-07-31 20:45:37 +09:00
Trustin Lee
3b1881b523
Make sure ChannelHandler.handlerRemoved() is invoked while handler methods are not running
...
- Fixes #1664
2013-07-31 20:35:51 +09:00
Norman Maurer
3049f5ddc4
Fix checkstyle
2013-07-31 12:21:50 +02:00
Trustin Lee
c79a3cdefe
Fix a bug in NioSocketChannel.doWrite() where flush() triggered from a ChannelFutureListener is ignored
...
- Fixes #1679
2013-07-31 19:13:45 +09:00
Norman Maurer
ca29f1a37d
[ #1683 ] Mark unused ChannelOption @deprecated, to prepare for removal in 4.1.0.Final
2013-07-31 10:50:39 +02:00
Trustin Lee
e81368af06
Simplify handler invocations in DefaultChannelHandlerContext
...
- Sometimes we delegated executor.inEventLoop() to the next context and sometimes we did not. Now we always check inEventLoop() before delegating.
2013-07-31 16:34:32 +09:00
Norman Maurer
e09aea5902
Rename methods of EmbeddedChannel and mark old ones as @deprecated
2013-07-31 16:04:08 +09:00
Jeff Pinner
3922c518cd
Clean up AbstractUnsafe#bind and AbstractUnsafe#disconnect.
2013-07-29 06:54:42 +02:00
Jeff Pinner
bf2430d255
Change AbstractChannel#doRegister return type from Runnable to void.
2013-07-27 20:22:02 +02:00
Jeff Pinner
ca59c1201e
Change AbstractChannel#doDeregister return type from Runnable to void.
2013-07-26 22:21:41 +02:00
Norman Maurer
15279b2525
[ #1654 ] Notify close future after the close was complete
2013-07-26 14:21:11 +02:00
Norman Maurer
cffbba94ee
[ #1654 ] Remove AbstractChannel.doPreClose() and notify close future on register failure. Based on patch of @jpinner
2013-07-26 14:10:31 +02:00
Norman Maurer
5f363e8ade
Revert "remove AbstractChannel#doPreClose"
...
This reverts commit 241f856cc7
.
2013-07-26 11:23:11 +02:00
Jeff Pinner
241f856cc7
remove AbstractChannel#doPreClose
2013-07-26 10:12:01 +02:00
Norman Maurer
fabefba791
[ #1650 ] Make it possible to override isSharable() to simplify things for clojure users
2013-07-25 20:24:27 +02:00
Norman Maurer
6ff87cc20d
Small optimitation to limit volatile reads
2013-07-25 09:28:54 +02:00
Trustin Lee
5e4169802f
Fix potential reentrance issue in ChannelOutboundBuffer
2013-07-24 11:26:03 +09:00
Norman Maurer
0bc7d3f5d1
[maven-release-plugin] prepare for next development iteration
2013-07-23 10:04:23 +02:00
Norman Maurer
ca00182797
[maven-release-plugin] prepare release netty-4.0.4.Final
2013-07-23 10:04:14 +02:00
Norman Maurer
0b17586731
[ #1623 ] Fix javadocs for ChannelGroup
2013-07-23 09:03:42 +02:00
Trustin Lee
7903697c36
Remove Arrays.fill(..., null)
...
.. because we can just set each element to null while looping
2013-07-23 15:09:14 +09:00
Trustin Lee
a89b17fa94
Merge ChannelOutboundBuffer.failUnflushed() and recycle() into a single method and make sure it is run later on reentrance
...
- Previously, failUnflushed() did not run when inFail is true, which made unflushed writes are not released on reentrance. This has been fixed by this commit.
- Also, AbstractUnsafe.outboundBuffer is set to null as early as possible to remove the chance of any write attempts made after the closure.
2013-07-23 14:34:10 +09:00
Trustin Lee
d4aa5b53d6
Simplify the validation logic proposed in 25f96b1644
2013-07-23 13:48:22 +09:00
kerr
ada07cb9e0
Fix types in javadocs
2013-07-22 19:14:36 +02:00
Norman Maurer
25f96b1644
[ #1606 ] Reduce overhead during writes because of ChannelPromise validation
2013-07-22 11:28:02 +02:00
Norman Maurer
81612f8e9b
[ #1624 ] Fix resource leak when writing to a closed / not-open channel
2013-07-22 10:59:06 +02:00
Norman Maurer
0f6cc0cc7b
[ #1630 ] Fix re-entrance bug in ChannelOutboundBuffer.remove(...)
2013-07-22 10:44:33 +02:00
tsingxu
125070958d
Fix up ChannelPipeline javadocs by add lost "don't "
2013-07-22 07:14:42 +02:00
Norman Maurer
7f86550ef8
[ #1619 ] Fix bug in ChannelOutboundBuffer which could lead to invalid write order when fireChannelWritabilityChanged() write another message
2013-07-20 10:03:53 +02:00
Norman Maurer
60529ac3ee
Fix checkstyle
2013-07-20 08:09:08 +02:00
Jeff Pinner
6c9c151d66
minor documentation cleanup
2013-07-20 08:01:14 +02:00
Norman Maurer
4d69848aec
Fix broken javadocs
2013-07-19 07:40:12 +02:00
Trustin Lee
19c92ceb59
Separate 'progress total' and 'pending number of bytes'
...
- Reverted the recent changes in AbstractChannel.calculateMessageSize()
2013-07-19 14:09:08 +09:00
Trustin Lee
762adfcb69
Update HttpStaticFileServer example / Fix bugs related with progress notification
...
- Fix a bug in DefaultProgressivePromise.tryProgress() where the notification is dropped
- Fix a bug in AbstractChannel.calculateMessageSize() where FileRegion is not counted
- HttpStaticFileServer example now uses zero copy file transfer if possible.
2013-07-19 13:21:32 +09:00
Trustin Lee
f96a8e5951
Implement ProgressivePromise notification in NIO byte channels and ChunkedWriteHandler
...
- Refine the contract of GenericProgressiveFutureListener.
- Negative 'total' now means 'unknown', which is useful for ChunkedWriteHandler.
2013-07-19 12:53:23 +09:00
Trustin Lee
0653efcd75
Even better promise validation messages
2013-07-19 09:38:25 +09:00
Trustin Lee
d5e202d755
Better promise validation messages
2013-07-19 09:37:56 +09:00
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