Commit Graph

1253 Commits

Author SHA1 Message Date
Trustin Lee
3ca3efac52 Fix a bug where adaptive recvbuf size prediction doesn't work correctly when maxMessagesPerRead is > 1 2013-12-21 19:56:36 +09:00
Trustin Lee
4e05c52c2e More graceful registration failure
- Fixes #2060
- Ensure to return a future/promise implementation that does not fail with 'not registered to an event loop' error for registration operations
- If there is no usable event loop available, GlobalEventExecutor.INSTANCE is used as a fallback.
- Add VoidChannel, which is used when an instantiation of a channel fails.
2013-12-21 18:47:03 +09:00
Norman Maurer
e1c47632e8 [#2079] Stop reading once the NIO byte Channel was complete drained 2013-12-21 10:39:29 +01:00
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