Commit Graph

174 Commits

Author SHA1 Message Date
Trustin Lee
6206d82b2c Split AbstractChannel into AbstractOioChannel and AbstractNioChannel
- Simpler OIO transport
- Suits better for other transports such as AIO, RXTX, IOStream
- Add ChannelBufferHolders.discardBuffer()
2012-05-26 22:48:48 -07:00
Trustin Lee
a1bdf671f1 Simplified EventLoop implementation names
- Also
  - Fixed a test failure
  - Fixed compiler warnings related with ChannelInitializer type
    parameters
2012-05-25 15:51:22 -07:00
Trustin Lee
61314ef51b Split AbstractChannel.doFlush() into two variants for simpler user impl
- Also renamed doRead() to doReadMessages() and doReadBytes()
2012-05-25 15:32:28 -07:00
Trustin Lee
f60f918763 Fixed all SPDY echo tests / Handle closed old I/O channels correctly 2012-05-25 14:24:25 -07:00
Trustin Lee
01aa1647bb Reduce GC in OioDatagramChannel.doRead/doFlush 2012-05-25 14:12:43 -07:00
Trustin Lee
2395bcd805 Process task queue before start to read
- Otherwise some tasks scheduled right after activation will be executed
  with 1 second delay.
2012-05-25 14:06:33 -07:00
Trustin Lee
3d490810b8 Hide internal class from users 2012-05-25 14:01:19 -07:00
Trustin Lee
778fbc36a9 Remove selector spinning optimization 2012-05-25 13:59:31 -07:00
Trustin Lee
e2d69120bb Ported OIO socket/datagram transport to the new API 2012-05-25 13:58:56 -07:00
Trustin Lee
bc5e8b6be1 Do not create an iterator unnecessarily 2012-05-25 06:30:30 -07:00
Trustin Lee
59f11ed64f Optimize AbstractChannel and related classes
- AbstractChannel.doRead() is split into two versions so that the
  implementation doesn't have to validate the buffer type.
- Optimized ChannelBufferHolder a little bit
- Reduced GC related with flush future notification
  - Added FlushCheckpoint and DefaultChannelFuture implements it
    opportunistically
-
2012-05-25 06:16:25 -07:00
Trustin Lee
25599018f2 Tiny bit of optimization in event loop 2012-05-24 21:04:12 -07:00
Trustin Lee
02144f70e1 Genericize ChannelInitializer 2012-05-24 15:12:14 -07:00
Trustin Lee
4a3c54b0fa Add UDP_RECEIVE_PACKET_SIZE option for datagram transport 2012-05-24 10:37:51 -07:00
Trustin Lee
c7c923cab3 Ported the QOTM example to the new API
- Fixed bugs in the NIO datagram transports
  - DefaultNioDatagramChannelConfig did not initialize on Java 6
2012-05-24 09:32:14 -07:00
Trustin Lee
c6f3b5762e Implement NIO datagram transport with the new API
- AbstractChannel now handles flushing a message buffer
- Cleaned up DatagramChannel interface
- Removed ProtocolFamily because a user can create an NIO
  DatagramChannel and specify it as a constructor parameter
- UniqueName and UniqueKey constructors became public so that
  I don't need to create a subclass every time.
2012-05-24 08:57:10 -07:00
Trustin Lee
cd11786994 Fix typo in the comment 2012-05-24 08:51:46 -07:00
Trustin Lee
21a3d3fe02 Add more constructor to NioSocketChannel 2012-05-23 23:28:15 -07:00
Trustin Lee
a2d57144b4 Fix compilation errors 2012-05-23 11:47:37 -07:00
Trustin Lee
c883b61503 Ported codec-http to the new API
- Added ChannelBufferHolders.catchAllBuffer()
- Relaxed UnsupportedMessageTypeException constructor signature
- EmbeddedChannel now uses the catchAllBuffer
- ChanelInboundMessageHandlerAdapter.messageReceive() throws Exception
- Added ChannelInboundStreamHandlerAdapter
2012-05-23 11:42:10 -07:00
Trustin Lee
7ecad7a8ac Add ChannelInboundMessageHandlerAdapter 2012-05-23 09:47:38 -07:00
Trustin Lee
baa3388859 Make the default constructor of CombinedChannelHandler protected 2012-05-20 20:57:00 +09:00
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
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
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
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
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
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
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
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