Commit Graph

1225 Commits

Author SHA1 Message Date
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