Commit Graph

724 Commits

Author SHA1 Message Date
Norman Maurer
38ee575839 Let ChannelGroupFuture.addListener(..) return itself to make consistent with ChannelFuture 2013-02-08 07:41:24 +01:00
Norman Maurer
539418ecac Let ChannelPipeline.set* methods return itself to be more consistent with the reset 2013-02-08 07:24:55 +01:00
Norman Maurer
32e0b59761 Let ChannelPipeline implement Iterable 2013-02-08 07:10:46 +01:00
Trustin Lee
e5616c85c4 Automatic messageType detection for ChannelInboundMessageHandlerAdapter 2013-02-08 13:48:47 +09:00
Trustin Lee
df65b93032 Use Message<Object> instead of Message<I> 2013-02-08 13:05:27 +09:00
Trustin Lee
ac72c3512e Ensure ChannelInboundMessageHandlerAdapter.endMessageReceived() is always called after handling the inbound message queue. / Call fireInboundBufferUpdated() automatically if the next inbound message buffer was changed. 2013-02-08 13:03:45 +09:00
Trustin Lee
9319e3ebd0 Fix SocketShutdownOutputByPeerTest failure
- With half-close enabled, the selector loop was spinning due to uncleared OP_READ flag.
 - Added some delay to the test for more reliable failure
2013-02-08 01:50:44 +09:00
Trustin Lee
d8c0bf3be2 Add the 'nextBufferType' parameter to ByteArrayEncoder like did to StringEncoder / Consistent parameter order 2013-02-08 01:36:41 +09:00
Trustin Lee
b8c0751023 Fix a regression where writing a ByteBuf are discarded 2013-02-08 00:41:35 +09:00
Trustin Lee
30e80f8c5c Fix a regression in ChannelInboundMessageHandlerAdapter
- Should forward the unsupported message to the next inbound buffer rather than the next outbound buffer.
2013-02-08 00:08:39 +09:00
Trustin Lee
ec51b359c9 Fix checkstyle again 2013-02-08 00:00:14 +09:00
Trustin Lee
9aa9d8a99b Fix checkstyle
- Basically a workaround for IntelliJ's automatic import optimization
2013-02-07 23:58:21 +09:00
Trustin Lee
d4742bbe16 Clean up abstract ChannelHandler impls / Remove ChannelHandlerContext.hasNext*()
- Rename ChannelHandlerAdapter to ChannelDuplexHandler
- Add ChannelHandlerAdapter that implements only ChannelHandler
- Rename CombinedChannelHandler to CombinedChannelDuplexHandler and
  improve runtime validation
- Remove ChannelInbound/OutboundHandlerAdapter which are not useful
- Make ChannelOutboundByteHandlerAdapter similar to
  ChannelInboundByteHandlerAdapter
- Make the tail and head handler of DefaultChannelPipeline accept both
  bytes and messages.  ChannelHandlerContext.hasNext*() were removed
  because they always return true now.
- Removed various unnecessary null checks.
- Correct method/field names:
  inboundBufferSuspended -> channelReadSuspended
2013-02-07 23:47:45 +09:00
Norman Maurer
a13246a2b6 [#1024] Limit the number of SelectionKey.interestedOps(..) calls for performance reasons 2013-02-07 15:34:38 +01:00
Norman Maurer
fd75615d7a [#870] Convert all modules into osgi bundles 2013-02-06 07:57:11 +01:00
Norman Maurer
46bedb8151 Add javadocs to make contract more clear 2013-02-05 20:29:38 +01:00
Norman Maurer
86b4cde82f Make sure the inbound/outbound buffer of the ChannelHandlerContext is only modified within the EventLoop 2013-02-05 16:19:04 +01:00
Trustin Lee
2e44a1ba91 Fix test failures in SingleThreadEventLoopTest on Windows
- It seems like Windows sometimes sleeps less than specified.
- Related issue: #726
2013-02-05 16:27:37 +09:00
Norman Maurer
ade3cc1329 Move non socket specific stuff out of the socket package 2013-02-01 09:10:28 +01:00
Trustin Lee
2ec932798f Replace .readable() and .writable() to .isReadable() and .isWritable() 2013-01-31 18:24:33 +01:00
Trustin Lee
42c65cca3a Make MessageBuf bounded
- Move common methods from ByteBuf to Buf
- Rename ensureWritableBytes() to ensureWritable()
- Rename readable() to isReadable()
- Rename writable() to isWritable()
- Add isReadable(int) and isWritable(int)
- Add AbstractMessageBuf
- Rewrite DefaultMessageBuf and QueueBackedMessageBuf
  - based on Josh Bloch's public domain ArrayDeque impl
2013-01-31 18:11:06 +01:00
Norman Maurer
ec013bf2d3 [#983] Force the user to implement an actual ChannelInboundHandler or ChannelOutboundHandler
For this ChannelInboundHandler* and ChannelOutboundHandler* was made package private
2013-01-31 15:50:27 +01:00
Trustin Lee
39357f3835 Enable TCP_NODELAY and SCTP_NODELAY by default
- Fixes #939
- Add PlatformDependent.canEnableTcpNoDelayByDefault()
  - Currently returns false on Android. Will change if necessary later.
2013-01-31 12:17:09 +09:00
Trustin Lee
152c969eab Make Bootstrap and ServerBootstrap thread-safe
- Additional fix for: #970
- Use LinkedHashMap again to save memory consumption
- ServerBootstrap now makes a copy of child parameters so that modifying ServerBootstrap after bind() does not affect the already-bound servers. This also makes child channel initialization potentially faster due to reduced garbage iterator.
2013-01-31 11:34:28 +09:00
Norman Maurer
eeab6767db Tighten up generics on ServerBootstrap again as it was fixed in UDT 2013-01-30 21:38:15 +01:00
Trustin Lee
33c9f3f1e5 Relax ServerBootstrap type constraint to support UDT properly 2013-01-30 22:04:20 +09:00
Trustin Lee
05d16cd361 Made Bootstrap and ServerBootstrap copy constructors private as suggested 2013-01-30 21:55:10 +09:00
Trustin Lee
b1b0319bbe Fix build errors and warnings 2013-01-30 21:47:34 +09:00
Norman Maurer
1bb003d9ae [#995] Replace AtomicReference usage with AtomicReferenceFieldUpdater
This will safe as an example 2gb mem when have 10 DefaultHandlerContext instances per connection and the connection count is 1000000.
Also kind of related to [#920]
2013-01-30 13:45:39 +01:00
Trustin Lee
23438de66f Move AbstractBootstrap.ChannelFactory out of AbstractBootstrap and hide AbstractBootstrap from a user
- Fixes #998
- Also generified ChannelFactory
2013-01-30 21:40:49 +09:00
Trustin Lee
86135a4080 Make ServerBootstrap final
- Related: #997
2013-01-30 21:14:23 +09:00
Trustin Lee
7c50c1e2e6 Make Bootstrap and ServerBootstrap implement Cloneable and rename duplicate() to clone()
- Fixes #997
- Replace duplicate() with clone()
- Add copy constructor for simplicity
- Can now clone invalid/incomplete bootstrap
- Upgrade to netty-build-14 to disable SuperClone checkstyle module
- Finalize class hierarchy so no subclasses are introduced
2013-01-30 21:12:42 +09:00
Trustin Lee
64e6c4021d Use the clearer parameter names that indicate the address is for Internet connections 2013-01-30 20:14:59 +09:00
Trustin Lee
788d7e9b8b Remove Bootstrap operations that require a promise and add various ad-hoc bind() and connect() operations
- Update examples to use the newly added bind() and connect()
  operations.
2013-01-30 20:11:00 +09:00
Norman Maurer
a54217053f [#988] Fix typo 2013-01-28 11:26:53 +01:00
Norman Maurer
d7bfd44e10 [#982] [#977] [#858] Allow to transfer the content a ChannelHandlers inbound/outbound buffer on removal/replacement
This changes the behavior of the ChannelPipeline.remove(..) and ChannelPipeline.replace(..) methods in that way
that after invocation it is not possible anymore to access any data in the inbound or outbound buffer. This is
because it empty it now to prevent side-effects. If a user want to preserve the content and forward it to the
next handler in the pipeline it is adviced to use one of the new methods which where introduced.

 - ChannelPipeline.removeAndForward(..)
 - ChannelPipeline.replaceAndForward(..)
2013-01-28 10:25:38 +01:00
Norman Maurer
a27d1cc365 [#986] DefaultChannelHandlerContext.fireUserEventTriggered(...) uses correct ChannelHandlerContext now 2013-01-26 16:47:00 +01:00
Norman Maurer
cc278d45c2 Disable test as this let fail the build 80% times on osx and slow linux servers. Need to investigate 2013-01-26 16:17:12 +01:00
Norman Maurer
b9aaf9a167 [#977] Stop processing messages/bytes in a loop when the handler was removed from the ChannelPipeline 2013-01-23 07:35:44 +01:00
Norman Maurer
3f72add89a [#976] Fix exception which will be raised by ChannelInboundHandler.discardInboundReadBytes() and ChannelOutboundHandler.discardOutboundReadBytes() if the handler remove it self from the pipeline 2013-01-23 07:27:00 +01:00
Norman Maurer
a25f7fa2e5 Revert "[#972] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed"
This reverts commit 4ac3bace0f.
2013-01-23 06:45:44 +01:00
Norman Maurer
4ac3bace0f [#972] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed 2013-01-22 21:18:13 +01:00
Brian Roach
54af70f067 Bootstrap thread safety
Changed options and attrs from LinkedHashMap to ConcurrentHashMap to
avoid a possible ConcurrentModificationException if a thread was
adding/removing options/attrs while another was calling Bootstrap.init()
or Bootstrap.duplicate()
2013-01-22 07:06:02 +01:00
Norman Maurer
4192222b38 Rname StreamOioByteChannel to OioByteStreamChannel 2013-01-21 12:10:07 +01:00
Norman Maurer
7316a3c65c [#965] Allow to adjust the SO_TIMEOUT on the fly 2013-01-21 11:48:05 +01:00
Norman Maurer
082b5f0dff [#962] Read data as soon as it is present in OIO and not wait till it match Buffer.writableBytes()
- Also add a new abstract class called StreamOioByteChannel which can be used by OIO channel implementation which are Stream based as a starting point.
2013-01-21 10:14:21 +01:00
Norman Maurer
57e504a7e6 Add javadocs to the *ChannelConfig interfaces to make clear which ChannelOptions implementations are expect to support 2013-01-20 08:10:15 +01:00
Norman Maurer
76d7829d38 [#960] Fix calculation of writerIndex() which was incorrect and so result in truncated DatagramPackets when using NIO 2013-01-19 17:22:28 +01:00
Norman Maurer
1295f6d331 Fix formatting 2013-01-19 16:52:12 +01:00
Norman Maurer
d8f0e3fdf7 Add missing udp option 2013-01-19 16:51:00 +01:00