Commit Graph

122 Commits

Author SHA1 Message Date
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
Trustin Lee
da9ecadfc0 Introduce bypass buffer and use it in LoggingHandler
- Added ChannelBufferHolders.(inbound|outbound)BypassBuffer()
  - The holder returned by these methods returns the next handler's
    buffer.  When a handler's new(Inbound|Outbound)Buffer returns
    a bypass holder, your inboundBufferUpdated() and flush()
    implementation should check if the buffer is a bypass and should not
    modify the content of the buffer.
- Channel(Inbound|Outbound)?HandlerAdapter is now abstract.
  - A user has to specify the exact inbound/outbound buffer type
  - It's because there's no way to determine the best buffer type
- Implemented LoggingHandler using the new API.
  - It doesn't dump received or sent messages yet.
- Fixed a bug where DefaultUnsafe.close() does not trigger deregister()
- Fixed a bug where NioSocketChannel.isActive() does not return false
  when closed
2012-05-10 23:19:59 +09:00
Trustin Lee
532672deae Fix unnecessary application of Math.abs() 2012-05-10 21:56:10 +09:00
Trustin Lee
b4764f6164 Fix infinity loop and timing issues
- Made sure unnecessary interestOps are not OR'd
- Fixed a bug where DefaultChannelFuture.rethrowIfFailed() returns
  silently if the future is not done yet - there's no ways to tell
  the differences between failure and incompleteness.
2012-05-09 23:42:01 +09:00
Trustin Lee
129a2af86a Initial working version of the echo server example
- Optimized AbstractChannelBuffer.discardReadBytes()
- Split ChannelHandlerInvoker into ChannelInboundInvoker and
  ChannelOutboundInvoker
  - Channel implements ChannelOutboundInvoker
  - ChannelOutboundInvoker.nextOut() is now out()
  - ChannelOutboundHandlerContext.out() is now prevOut()
  - Added the outbound operations without future
    parameter to ChannelOutboundInvoker for user convenience
- All async operations which requires a ChannelFuture as a parameter
  now returns ChannelFuture for user convenience
- Added ChannelFutureFactory.newVoidFuture() to allow a user specify
  a dummy future that is of no use
  - I'm unsure if it is actually a good idea to introduce it. It might
    go away later.
- Made the contract of AbstractChannel.doXXX() much simpler and moved
  all common code up to AbstractChannel.DefaultUnsafe
- Added Channel.isOpen()
- Fixed a bug where MultithreadEventLoop always shut down its child
  event loops on construction
- Maybe more changes I don't remember :-)
2012-05-09 22:09:06 +09:00
Trustin Lee
607d784e5e Retrofit/overhaul the NIO transport with the new API
- Remove large portion of code thanks to the new API
- SocketChannel implementations are instantiated without factories
- Retrofit the existing code with the new API
2012-05-02 21:05:53 +09:00
Trustin Lee
9e6f8b46df Retrofit the NIO transport with the new API / improve the new API
- Remove the classes and properties that are not necessary anymore
- Remove SingleThreadEventLoop.newRegistrationTask() and let
  Channel.Unsafe handle registration by itself
- Channel.Unsafe.localAddress() and remoteAddress()
  - JdkChannel is replaced by Channel.Unsafe.
2012-05-02 15:01:58 +09:00
Trustin Lee
5dda9d1840 Retrofit the socket channel API with the new API 2012-05-02 14:07:50 +09:00
Trustin Lee
e65e496fc0 Clear Channel.eventLoop on deregistration 2012-05-01 23:19:31 +09:00
Trustin Lee
1356a0b61e Replace Channel.Unsafe.setEventLoop() with register()
- Added AbstractChannel.doRegister()
2012-05-01 23:18:29 +09:00
Trustin Lee
a83b9704fa Make sure ChannelFutureListeners are invoked from an event loop thread 2012-05-01 18:31:17 +09:00
Trustin Lee
0682421ce1 Remove unused classes
- ChannelPipelineFactory will be replaced with sometime else when I
  refactory the bootstrap package
- FileRegion is going away.  A user can deregister a channel and perform
  such operations by him/herself.  If this turns out to be too
  difficult, I'll introduce a new 'sendfile' operation to the outbound
  handler.
2012-05-01 18:23:59 +09:00
Trustin Lee
1b5960a1a8 Add ClientChannelConfig and move connectTimeoutMillis there 2012-05-01 18:17:12 +09:00
Trustin Lee
f4423ac555 Remove unused configuration properties and their related classes 2012-05-01 17:53:38 +09:00
Trustin Lee
c34d63d159 Fix compilation errors in ChannelGroup and its related types
- Also removed the operations not valid anymore
2012-05-01 17:49:41 +09:00
Trustin Lee
825d7964c9 Add ChannelFutureFactory & removeClosureListener()
- Channel and ChannelHandlerContext extends ChannelFutureFactory.
- Added Channel.removeClosureListener()
2012-05-01 17:48:24 +09:00
Trustin Lee
368156f5d0 Another round of the new API design
- Channel now creates a ChannelPipeline by itself

  I find no reason to allow a user to use one's own pipeline
  implementation since I saw nobody does except for the cases where a
  user wants to add a user attribute to a channel, which is now covered
  by AttributeMap.

- Removed ChannelEvent and its subtypes because they are replaced by
  direct method invocation.
- Replaced ChannelSink with Channel.unsafe()
- Various getter renaming (e.g. Channel.getId() -> Channel.id())
- Added ChannelHandlerInvoker interface
- Implemented AbstractChannel and AbstractServerChannel
- Some other changes I don't remember
2012-05-01 17:19:41 +09:00
Trustin Lee
f57ef3d414 Add ChannelBufferHolder.toString() 2012-04-29 21:51:12 +09:00
Trustin Lee
3804f3cbbb Remove ChannelLocal (deprecated) 2012-04-29 20:40:58 +09:00
Trustin Lee
447545bb19 Remove the methods related with half-close 2012-04-29 18:49:44 +09:00
Trustin Lee
470e7da5d7 Add MultithreadEventLoop
- Add EventLoopException to wrap the exceptions while an event loop does
something
- Make EventLoop.register() return EventLoop so that the caller knows
the actual EventLoop that will handle the Channel even if the caller
called register() from MultithreadEventLoop
2012-04-29 18:40:55 +09:00
Trustin Lee
e76e2aeac8 Add missing @Override annotation 2012-04-29 17:59:42 +09:00
Trustin Lee
cdd1ba93f0 Second round of new channel handler API design
- Rename ChannelReader to ChannelInboundHandler
- Rename ChannelWriter to ChannelOutboundHandler
- Introduce ChannelBufferHolder instead of adding the common super type
  of message buffers and byte buffers
  - This is more type-safe and natural.
- Remove the notification methods for buffer closure (might add back
  later when revisiting half-closed connection support)
2012-04-29 17:53:50 +09:00
Trustin Lee
22a815eaf8 Revamp channel handler API
- Merged LifeCycleAwareChannelHandler into ChannelHandler
- Replaced ChannelUpstreamHandler and ChannelDownstreamHandler with
  ChannelReader and ChannelWriter
  - These two new interfaces are much more type-safe than its ancestor.
- Simplified channel state model as described in #68
- Handler creates send/receive buffer.
  - Previously, Netty created them, but it led to more memory copies and
    inflexibility.  I'm going to allow a handler to create a bounded
    queue for example.
  - It currently uses Queue<T> but I'll define a new interface and make
    ChannelBuffer implement it (e.g. Queue<Byte>)
- Introduced AttributeMap which replaces attachments in Channel and
  ChannelHandlerContext and ChannelLocal
2012-04-12 17:39:01 +09:00
norman
97561315fd Add final keyword 2012-04-11 10:54:53 +02:00
norman
16c625cfd0 Allow to share a WorkerPool for boss and worker threads but also allow to have them separate. See #240 2012-04-11 10:54:41 +02:00
norman
f88cd3120d Fix a bug which lead to only use two threads for all tasks all the time, even if the WorkerPool contained more. See #240 2012-04-11 10:54:27 +02:00
norman
d0f432b4d4 Accept all ready sockets for the SelectionKey. See #240 2012-04-10 11:20:23 +02:00
Norman Maurer
07ff3d76cd Await for close of the channels. See #235 2012-04-10 08:17:38 +02:00
Norman Maurer
019d942a28 Correct javadoc. See #235 2012-04-10 08:17:21 +02:00
Norman Maurer
7eaf635059 Take care of releasing the local channel when releaseExternalResources() is called. See #235 2012-04-10 08:16:58 +02:00
Norman Maurer
a847ec1d88 Add test case to show that issue #235 is due some incorrect usage 2012-04-10 08:16:40 +02:00
Norman Maurer
33c085b9b9 Make sure Future get notified before event is fired. See #254 2012-04-07 22:03:58 +02:00
norman
db87c6ea37 Make sure Channel connected event is not fired on connect failure. See #249 2012-04-04 07:41:38 +02:00
Trustin Lee
049fb35bc1 Add Channel.deregister() 2012-04-03 22:29:26 +09:00
Trustin Lee
5a63cc4e1a Allow specifying a non-default SelectorProvider 2012-04-03 22:25:01 +09:00
Trustin Lee
a8647d6dc8 AbstractNioWorker -> SelectorEventLoop 2012-04-03 22:21:11 +09:00
Trustin Lee
0d8afa7a4c attach -> register 2012-04-03 22:19:35 +09:00
Trustin Lee
116054a364 Initial incomplete checkin of the event loop API 2012-04-03 22:03:04 +09:00
norman
805270c5d9 Finish support for UDP Multicast in UDP. See #216 2012-04-03 12:04:33 +02:00
Norman Maurer
9c1f3c6fe8 Fix UDP nio impl and add simple tests 2012-04-02 21:02:41 +02:00
Norman Maurer
dd6069c681 Fix broken UDP support. This got broken in 3.4.0.Alpha1 2012-04-02 19:37:28 +02:00
norman
023227917f cleanup 2012-04-02 15:27:40 +02:00
norman
221a77409a Only use the source address to join a multicast group if it was specified. See #216 2012-04-02 15:25:40 +02:00
norman
7f8408065b Fix UDP Multicast writes. See #237 2012-04-02 14:22:13 +02:00
norman
b350e8d289 Fix UDP Multicast writes. See #237 2012-04-02 14:20:40 +02:00
norman
9b90e3191a Finish support of NIO UDP multicast. This also change the methods to
return a ChannelFuture. See #216
2012-04-02 11:57:32 +02:00
norman
72f9f502bb Add support for UDP multicast in NIO. See #216
Add some javadocs. See #216

Use the correct key to lookup MembershipKey. See #216
2012-04-02 11:14:31 +02:00