Commit Graph

814 Commits

Author SHA1 Message Date
Norman Maurer
af4b71a00e Remove special handling of Object[] in codec framework (a.k.a unfolding)
- Fixes #1229
- Primarily written by @normanmaurer and revised by @trustin

This commit removes the notion of unfolding from the codec framework
completely.  Unfolding was introduced in Netty 3.x to work around the
shortcoming of the codec framework where encode() and decode() did not
allow generating multiple messages.

Such a shortcoming can be fixed by changing the signature of encode()
and decode() instead of introducing an obscure workaround like
unfolding.  Therefore, we changed the signature of them in 4.0.

The change is simple, but backward-incompatible.  encode() and decode()
do not return anything.  Instead, the codec framework will pass a
MessageBuf<Object> so encode() and decode() can add the generated
messages into the MessageBuf.
2013-04-03 21:44:54 +09:00
Trustin Lee
117ad8acd7 Add MultithreadEventLoopGroup.DEFAULT_EVENT_LOOP_THREADS / Add DefaultThreadFactory
- Allow overriding the default thread factory when a user specified no thread factory
2013-04-03 17:49:30 +09:00
Trustin Lee
312a35dfed Remove MultithreadEventExecutorGroup.DEFAULT_POOL_SIZE
- We should never define a default nThread for MultithreadEventExecutorGroup because we don't know what a user do with it.
2013-04-03 17:15:25 +09:00
Trustin Lee
b7797917ab Deprecate Bootstrap.shutdown() and use EventLoopGroup.shutdown() wherever possible
There are still some tests that use Bootstrap.shutdown() though.  They need non-trivial refactoring, which will come soon.
2013-04-03 16:15:33 +09:00
Andrew Cox
3f8a830963 Fix DefaultChannelPipeline.first() so that it returns null when only the sentinel handlers remain (this is how DefaultChannelPipeline.last() works already) 2013-04-03 06:55:55 +02:00
Trustin Lee
0f3dc0409a Log various properties at startup time for easier diagnosis 2013-04-03 11:44:30 +09:00
Norman Maurer
bcb0b83b44 Use unfoldAndAdd(..) for now 2013-04-02 13:58:15 +02:00
George Cao
436380c41e Fix Javadoc issues. Replace Upstream with Inbound and Downstream with Outbound. 2013-04-02 15:13:39 +09:00
Norman Maurer
96bf71e814 Let EventExecutorGroup extend ScheduledExecutorService as it shares quite some semantic 2013-04-01 13:56:46 +02:00
Adam Vandenberg
8e23ab6886 Fix typo in BufType javadoc 2013-03-29 21:47:55 +09:00
Trustin Lee
19ffdd5c29 Revamp the selector auto rebuild checker
- Count the number of select() calls made to wait until reaching at the expected dead line, and rebuild selectors if too many select() calls were made.
2013-03-22 14:33:47 +09:00
Trustin Lee
69e5a0eb9c Log prematurly returning select() at DEBUG level and increase the minimum required consecutive premature returns to log 2013-03-22 12:59:47 +09:00
Trustin Lee
d525295d20 Revert NioEventLoop.hasTasks() which is not really true 2013-03-22 12:46:31 +09:00
Trustin Lee
34853e7ba0 Selector auto-rebuilder tweaks 2013-03-22 12:37:11 +09:00
Trustin Lee
f6e0df125a Allow disabling automatic selector rebuilding by specifing non-positive threshold 2013-03-22 11:50:53 +09:00
Trustin Lee
1ab2813405 Enable automatic selector rebuilding by default
- Fixes #1192
- Log at WARN level for easier diagnosis
2013-03-22 11:48:41 +09:00
Trustin Lee
fa02ffddae Remove TaskScheduler and ImmediateEventExecutor that requires TaskScheduler
- Related issue: #817
2013-03-22 09:06:08 +09:00
Trustin Lee
4097dee49d Make SingleThreadEventExecutor independent from TaskScheduler
- Related issue: #817
2013-03-22 09:00:38 +09:00
Trustin Lee
8fb80e9179 Fix a dead lock in ServerBootstrap as described in #1175
- Reduce code duplication between bootstrap implementations
2013-03-21 21:34:13 +09:00
Trustin Lee
9b208028ef Use clearer term when data is discarded by pipeline 2013-03-21 20:22:25 +09:00
Trustin Lee
a8723412dd Fix checkstyle 2013-03-21 19:51:11 +09:00
Norman Maurer
f858a2fe62 Fix multiple calls to fireChannelActive() when using AIO 2013-03-21 11:49:58 +01:00
Trustin Lee
4fa7e85493 Make sure ChannelFuture of Bootstrap.bind() and connect() notify with the right cause when registration fails
- Related: #1175
2013-03-21 19:41:38 +09:00
Norman Maurer
b6dd5938ab No need to do any deadlock check here 2013-03-21 11:24:26 +01:00
Trustin Lee
c08919d0a0 Fix the dead lock described in #1175
- Similar to @normanmaurer's fix in that this commit also makes Bootstrap.init(Channel) asynchronous, but it is simpler and less invasive.
- Also made sure a connection attempt failure in the local transport does not trigger an exceptionCaught event
2013-03-21 19:19:14 +09:00
Trustin Lee
bd8d53eaed Fix checkstyle 2013-03-21 19:02:34 +09:00
Trustin Lee
2aa0bf73dc Add a unit test that reproduces the dead lock described in #1175
- The offending test case is annotated with `@Ignore`
- Also fixed a bug where channel initialization failure swallows the original cause of initialization failure
2013-03-21 18:43:03 +09:00
Trustin Lee
a980638190 Ensure the best effort is made even if future listeners could not be notified / Handle registration failure in a robust manner
- Related: #1187
2013-03-21 17:48:10 +09:00
Trustin Lee
8b722d29a7 Add constructor parameters that do not perform type parameter auto-detection for the languages without type parameters
- Fixes #1177
- Add TypeParameterMatcher.get(parameterType)
- Add alternative constructors
2013-03-21 16:11:47 +09:00
Norman Maurer
2b014ce82a [#1183] Fix BlockingOperationException in ChannelGroup.close().awaitUninterruptibly() 2013-03-20 18:28:55 +01:00
Norman Maurer
ce87b627be Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose. 2013-03-19 10:45:42 +01:00
Michael Nitschinger
5a88227856 Transport: Clarifying the role of AbstractBootstrap#bind()
This small changeset clarifies the role of AbstractBootstrap#bind(),
especially when not used in a ServerBoostrap context.
2013-03-18 17:58:46 +09:00
Trustin Lee
f4c18c6e74 Fix a bug where NioEventLoop.processSelectedKeys() enters an infinite loop when too many connections are closed at once
- Fixes #1171
2013-03-18 15:01:19 +09:00
Jeff Pinner
7498e0f913 make deregister protected in ThreadPerChannelEventLoop 2013-03-17 20:11:33 +01:00
Trustin Lee
70a51bcd8d Fix memory leak in AbstractEmbeddedChannel
- Allow a transport implementation to perform an arbitrary task when a channel has been deregistered completely
2013-03-14 15:51:33 +09:00
Trustin Lee
9c96791176 Move the methods that's only used by DefaultChannelPipeline to DefaultChannelPipeline 2013-03-14 15:01:35 +09:00
Trustin Lee
d55567e21b Remove DefaultChannelHandlerContext.needsLazyBufInit which is used only by the head handler 2013-03-14 14:35:56 +09:00
Trustin Lee
f1ecb4ab1a Remove ChannelHandlerContext.types() which is barely useful / Remove ChannelHandlerType together 2013-03-14 14:14:04 +09:00
Trustin Lee
9feb27d58c Specify timeout on Selector.select() 2013-03-14 08:54:33 +09:00
Trustin Lee
644d5abbda Add an empty line 2013-03-14 06:54:57 +09:00
Trustin Lee
8dcb1387e3 Add I/O ratio parameter to NioEventLoop
- Add SingleThreadEventExecutor.runAllTasks(timeout)
- Add NioEventLoop.ioRatio property
- Merge SelectorUtil into NioEventLoop
2013-03-14 06:49:08 +09:00
Norman Maurer
fe66f33f42 Fix issue where the bytes/messages are forwarded to the wrong handler 2013-03-12 08:37:27 +01:00
Norman Maurer
17ebbdec20 Let ChannelGroupFuture extends ChannelFuture and ChannelGroupFutureListener GenericFutureListener 2013-03-12 08:35:39 +01:00
Norman Maurer
f2a35273e6 Fix checkstype 2013-03-12 08:35:24 +01:00
Trustin Lee
397830d238 Allow SingleOutboundMessageHandler.beginFlush() to reject the flush request by returning false / Replace PartialFlushException with IncompleteFlushException which is more correct. 2013-03-12 15:20:46 +09:00
Trustin Lee
83cdbeca1d Add ThreadPerChannelEventLoopGroup and ThreadPerChannelEventLoop to enable a user to write a new thread-per-channel transport easily
- Fixes #1124
2013-03-12 14:50:38 +09:00
Norman Maurer
2406a9f8b8 Use LinkedHashSet 2013-03-11 06:38:39 +01:00
Norman Maurer
806e9b1f8c Make sure we handle outbound messages of type ByteBuf special 2013-03-11 08:59:00 +09:00
Norman Maurer
0a1bc86569 Javadocs cleanup / added 2013-03-10 21:07:19 +01:00
Norman Maurer
0504a442ae Check for NPE and also optimze HashSet allocation 2013-03-10 21:06:59 +01:00