Commit Graph

2801 Commits

Author SHA1 Message Date
Trustin Lee
83f1b5fa35 Implement spinning in SelectorUtil.select()
- this seems to improve performance when the number of connections is
  very small
2012-05-20 16:29:31 +09:00
Trustin Lee
cab983244d Tidy up AbstractChannel.read() 2012-05-20 15:03:28 +09:00
Trustin Lee
3a8c10cc5a Do not call expandReadBuffer too often 2012-05-20 14:30:26 +09:00
Trustin Lee
af37ec4f23 Ported the HTTP snoop example to the new API
- Replaced pipeline factories with initializers
- Ported essential parts related with HTTP to the new API
- Replaced ChannelHandlerAdapter.combine() with CombinedChannelHandler
- Fixed a bug where ReplayingDecoder does not notify the next handler
- Fixed a bug where ReplayingDecoder calls wrong callDecode() method
- Added a destination buffer as an argument to AbstractChannel.doRead()
  for easier implementation
- Fixed a bug where NioSocketChannel did not try to increase the inbound
  buffer size (moved the logic to AbstractChannel)
2012-05-20 14:19:11 +09:00
Trustin Lee
e846505ceb Add combined codec classes and related utility method 2012-05-20 12:53:22 +09:00
Trustin Lee
e5da7b53dd Add UnsupportedMessageTypeException
- Replaced some IllegalArgumentExceptions with
  UnsupportedMessageTypeException
- MessageToMessage(Encoder|Decoder) should continue polling the
  inbound buffer if encode() or decode() returns null
  - aggregating codec can do that
2012-05-18 21:59:02 +09:00
Trustin Lee
9d3eeb9719 Fix compilation errors 2012-05-18 17:50:38 +09:00
Trustin Lee
ddb839eaf9 Make ReplayingDecoder extend StreamToMessageDecoder 2012-05-18 17:38:44 +09:00
Trustin Lee
d4a26c3c52 Add StreamToMessageDecoder.replace() (#332) 2012-05-18 17:37:41 +09:00
Trustin Lee
ca12e41406 Fix a compiler warning 2012-05-18 16:58:40 +09:00
Trustin Lee
5c3b432f60 Fix test failures due to recent changes with codec exceptions 2012-05-18 15:45:12 +09:00
Trustin Lee
2802b231e5 Make all codecs throw a CodecException
- Added CodecException which is either EncoderException or
  DecoderException
- Made all decoder exceptions a subtype of DecoderException
- Replaced CodecEmbedderException with CodecException
- All abstract handlers wraps an exception with a CodecException
2012-05-18 15:42:36 +09:00
Trustin Lee
251a18160c Move VoidEnum to util 2012-05-18 14:34:42 +09:00
Trustin Lee
dbd973d825 Introduce UniqueName, UniqueKey, and Signal
- UniqueKey removes the duplication between ChannelOption and
  AttributeKey
- UniqueName provides common name collision check for AttributeKey,
  ChannelOption, and Signal.
- Replaced ReplayError with Signal
2012-05-18 14:30:42 +09:00
Trustin Lee
5344dc242c Finish porting the codec package to the new API
- Removed deprecated classes
- Changed type parameter of StreamToMessageDecoder and
  MessageToMessageDecoder for more flexibility
- Made all tests in the codec package pass
2012-05-17 16:38:25 +09:00
Trustin Lee
1bf0dfe64a Retrofit ReplayingDecoder with the new API
- Moved up to 'codec' from 'codec.replay'
- Test passes with Redis client codec
2012-05-17 12:37:37 +09:00
Trustin Lee
2c99fda7b5 Remove unnecessary field 2012-05-16 23:07:19 +09:00
Trustin Lee
d3a3b329f3 Fix a compilation error 2012-05-16 23:05:58 +09:00
Trustin Lee
3669e31e14 Fix a compilation error in DefaultChannelPipeline 2012-05-16 23:03:11 +09:00
Trustin Lee
92a688e5b2 Retrofit the codec framework with the new API (in progress)
- Replaced FrameDecoder and OneToOne(Encoder|Decoder) with:
  - (Stream|Message)To(String|Message)(Encoder|Decoder)
- Moved the classes in 'codec.frame' up to 'codec'
- Fixed some bugs found while running unit tests
2012-05-16 23:02:06 +09:00
Trustin Lee
894ececbb7 Convert DOS line ending to UNIX line ending 2012-05-15 17:14:02 +09:00
Trustin Lee
dd2e36e5d9 Remove unused or unmaintainable internal classes 2012-05-15 17:10:54 +09:00
Trustin Lee
957c04e597 Fix boundary check in DefaultChannelPipeline.addFirst(..)
- Thanks @normanmaurer
2012-05-15 14:49:23 +09:00
Trustin Lee
e16c835780 Simplify the echo client example 2012-05-15 14:16:27 +09:00
Trustin Lee
6eb540ca40 Add more convenient methods to ChannelPipeline
.. to simplify pipeline construction as shown in the echo example
2012-05-15 14:08:42 +09:00
Trustin Lee
d01d1d0843 Rename (Server)ChannelBuilder to (Server)ChannelBootstrap
- It does not build a new Channel but just helps bootstrapping it.
- Added shutdown() method for simpler deinitialization
- ServerChannelBootstrap has shorter method names for the parent channel
2012-05-15 13:45:25 +09:00
Trustin Lee
128851dd09 Bump up the backlog value 2012-05-15 13:18:46 +09:00
Trustin Lee
f00fadb9fd Simplify the construction of multi-threaded selector event loop
- Hide InternalLogger from users
2012-05-15 13:11:47 +09:00
Trustin Lee
311f17f6ef Replace Bootstrap with ChannelBuilder and ServerChannelBuilder
- Added ChannelInitializer which is supposed to be used with the
  builders
- Echo examples use ChannelBuilder and ServerChannelBuilder now
- Replace ChannelFuture.rethrowIfFailed() with sync*()
- Bug fixes
2012-05-14 23:57:23 +09:00
Trustin Lee
18d1861243 Remove duplicate groupId 2012-05-14 23:09:13 +09:00
Trustin Lee
05f955ee10 Clean up echo example / Fix a bug where closeFuture is not notified 2012-05-14 14:17:40 +09:00
Trustin Lee
6a0040a14e Fix compilation errors 2012-05-13 18:45:57 +09:00
Trustin Lee
3642879d98 Move up write spinning from SelectorEventLoop to AbstractChannel 2012-05-13 05:09:05 +09:00
Trustin Lee
6d14fac99c Revive Channel.closeFuture
- ChannelPipeline now rejects an unsafe ChannelFuture, so there's no
  need to hide/remove closeFuture.
2012-05-13 01:37:16 +09:00
Trustin Lee
175acb7899 Prevent unsafe ChannelFutures from being passed to a pipeline 2012-05-13 01:35:43 +09:00
Trustin Lee
91c02c2823 Improve AttributeKey.toString() 2012-05-13 00:40:52 +09:00
Trustin Lee
08137e2c49 Implement flush-future properly / Make channel options type-safe
- AbstractChannel keeps the expected number of written bytes so that
  the ChannelFuture of a flush() operation is notified on right timing.
  - Added ChannelBufferHolder.size() to make this possible
- Added AbstractChannel.isCompatible() so that only compatible EventLoop
  is accepted by a channel on registration
- Added ChannelOption to make channel options type-safe
- Moved writeSpinCount property to ChannelConfig and removed Nio*Config
- Miscellaneous cleanup

introducing
ChannelOption
2012-05-13 00:40:28 +09:00
Trustin Lee
95f05ae215 Uncomment logging in EchoClient 2012-05-12 08:32:43 +09:00
Trustin Lee
efe7fd9539 Uncomment logging in EchoServer 2012-05-12 08:31:55 +09:00
Trustin Lee
7a5f4721b9 Optimize LoggingHandler using lookup tables 2012-05-12 08:31:13 +09:00
Trustin Lee
c57d7dd098 Add EventLoopFactory and make MultithreadEventLoop use it
- based on the feed back from @normanmaurer
2012-05-11 21:47:07 +09:00
Trustin Lee
97c07708a2 Remove unused class 2012-05-11 21:36:47 +09:00
Trustin Lee
1db0cd60c4 Do not attempt to flush when waiting for OP_WRITE 2012-05-11 21:26:54 +09:00
Trustin Lee
4b673c4ebb Fix infinite loop while handling a client socket / Retrofit EchoClient 2012-05-11 21:19:19 +09:00
Trustin Lee
b4610acda1 Implement connect timeout
- Merged ClientChannelConfig back to ChannelConfig
- AbstractChannel handles connect timeout making use of
  EventLoop.schedule()
2012-05-11 20:44:00 +09:00
Trustin Lee
83026f29a4 Make EventLoop a ScheduledExecutorService
- SingleThreadEventLoop now implements ScheduledExecutorService
  - Scheduled tasks are automatically fetched into taskQueue by
    pollTask() and takeTask()
- Removed MapBackedSet because Java 6 provides it
2012-05-11 20:19:57 +09:00
Trustin Lee
a4678a6030 Close all channels when SelectorEventLoop shuts down
- Also removed a FIXME which was fixed already
2012-05-11 11:01:44 +09:00
Trustin Lee
f6d6d1282c Simplify AbstractChannel.toString() 2012-05-11 10:47:45 +09:00
Trustin Lee
2134848111 Ensure the specified future has the correct channel / Cleanup 2012-05-11 09:00:35 +09:00
Trustin Lee
cb718a07c8 Move ChannelFutureFactory.newVoidFuture() to Channel.Unsafe() / Cleanup 2012-05-11 00:57:42 +09:00