Commit Graph

801 Commits

Author SHA1 Message Date
Trustin Lee
8c0e5626c2 Remove concatenation with empty string 2012-11-09 17:55:28 +09:00
Trustin Lee
57aa842b63 Move private methods only used from inner classes to the inner classes 2012-11-09 17:17:25 +09:00
Norman Maurer
1a7e7a1bff [#654] Fix race which could lead to some concurrent side-effects like raise a ConcurrentModificationException when using the nio transport 2012-11-07 19:15:11 +01:00
Norman Maurer
313f777491 [maven-release-plugin] prepare for next development iteration 2012-11-05 23:08:39 +01:00
Norman Maurer
57da8222a4 [maven-release-plugin] prepare release netty-4.0.0.Alpha7 2012-11-05 23:08:28 +01:00
Norman Maurer
87cc67306f [maven-release-plugin] prepare for next development iteration 2012-10-28 18:41:25 +01:00
Norman Maurer
7315490fca [maven-release-plugin] prepare release netty-4.0.0.Alpha6 2012-10-28 18:41:17 +01:00
Norman Maurer
afc687436a Revert "[maven-release-plugin] prepare release netty-4.0.0.Alpha6"
This reverts commit 95de4db0f1.
2012-10-28 18:36:15 +01:00
Norman Maurer
16eb4ec713 Revert "[maven-release-plugin] prepare for next development iteration"
This reverts commit e3e0776c20.
2012-10-28 18:35:47 +01:00
Norman Maurer
e3e0776c20 [maven-release-plugin] prepare for next development iteration 2012-10-28 13:06:07 +01:00
Norman Maurer
95de4db0f1 [maven-release-plugin] prepare release netty-4.0.0.Alpha6 2012-10-28 13:05:59 +01:00
Trustin Lee
43dc0bd8a3 [#275 & #686] Ability to pass a custom parameter to Bootstrap.connect() / Replace Bootstrap.newBootstrap() with duplicate()
- Add Bootstrap.attr() and ServerBootstrap.attr()/childAttr() so that a
  user can initialize the attribute map from the beginning.
- Replace newBootstrap() with duplicate()
2012-10-26 14:55:24 -07:00
Trustin Lee
3bc330d477 Remove unnecessarily split line 2012-10-24 17:09:40 -07:00
Trustin Lee
abd37dacd6 [#681] Allow a user to access the Selector of an EventLoop
- Make NioEventLoop public so that a user can downcast it
- Add NioEventLoop.register()
- Add NioTask to let user specify what to do on select()
2012-10-24 17:08:42 -07:00
Trustin Lee
63d3210cff NioUnsafe.ch() should return SelectableChannel 2012-10-24 11:37:41 -07:00
Norman Maurer
985fa97c9b Check if message is supported before cast. See #678 2012-10-24 07:03:02 +02:00
Trustin Lee
c43b9b4dd2 [#662] Fix race in AioEventLoopGroup
- Fix a bug where shutdown() blocks indefinitely sometimes
2012-10-23 16:09:59 -07:00
Trustin Lee
c38c1d0e6f [#662] Fix race in AioEventLoopGroup
- Ensure the event loop threads are never terminated before all tasks
  submitted by JDK are executed
- Close all open connections before terminating an event loop
2012-10-23 15:07:13 -07:00
Norman Maurer
5d51aed846 Change ChannelInboundMessageHandlerAdapter.beginMessageReceived(..) to return a boolean that will be used to check if data should be processed. See #674 2012-10-23 20:43:58 +02:00
Trustin Lee
279712a6a0 [#670] Intermittent IllegalStateException with ByteToMessageDecoder impl with bounded inbound buffer
* AioSocketChannel.expandReadBuffer() should not call discardReadBytes()
becuase it messes up with NIO.2
2012-10-22 12:42:07 -07:00
Trustin Lee
ae839db383 [#670] Intermittent IllegalStateException with ByteToMessageDecoder impl with bounded inbound buffer
* Ensure to call discardReadBytes() before giving up expanding the buffer
2012-10-22 11:53:25 -07:00
Norman Maurer
e7c6c88063 Fix releasing of resources in AioEventLoopGroup, as it missed to shutdown the AsynchronousChannelGroup before. See #659 2012-10-16 20:18:52 +02:00
Norman Maurer
e9d2ebea3d Disable SCTP tests on platforms that not support them, also not run tests for sctp OIO. See #633 2012-10-13 09:19:01 +02:00
Norman Maurer
6143626427 Cleanup of sctp code based on comments in #633 2012-10-12 07:45:00 +02:00
Norman Maurer
592f1fcc60 Merge pull request #633 from jestan/master
SCTP Transport Codecs and TestCases
2012-10-11 22:38:07 -07:00
AtKaaZ
9b35513fa5 server handler wasn't working due to field being overwritten in subclass 2012-10-09 20:55:24 +02:00
Norman Maurer
da7bcfa8f6 Add tests for AioChannelFinder implementations 2012-10-01 06:46:55 +02:00
Jestan Nirojan
6904b62c2f Resolved conflicts in SctpData/SctpMessage refactoring 2012-09-29 02:01:00 +08:00
Trustin Lee
820af50b63 [maven-release-plugin] prepare for next development iteration 2012-09-28 17:57:40 +09:00
Trustin Lee
595e1067c7 [maven-release-plugin] prepare release netty-4.0.0.Alpha5 2012-09-28 17:57:04 +09:00
Trustin Lee
bd8ee64366 Pull #625 from @CruzBishop selectively 2012-09-27 19:04:35 +09:00
Trustin Lee
a6bd91dce5 Sync the default select timeout with 3.x 2012-09-23 17:28:52 +09:00
Trustin Lee
d49d02ffe4 [#610] alpha4: DefaultSctpServerChannelConfig options in current java 7
Fix a wrong signature in com.sun.nio.sctp.SctpServerChannel.setOption()
2012-09-23 17:25:24 +09:00
Jestan Nirojan
b268f0b333 Added SCTP Codec Handlers + minor refactoring 2012-09-23 14:12:32 +08:00
Trustin Lee
cf7a55106c Fix checkstyle violation 2012-09-22 12:09:45 +09:00
Trustin Lee
0b71afb81c Improve the stability of ServerSocketSuspendTest 2012-09-22 12:05:00 +09:00
Trustin Lee
256f55b2e9 [#608] Channel MessageBridge concurrency issues
Fixed ArrayIndexOutOfBoundsException caused by a race condition that the peer's inbound buffer is accessed concurrently.
2012-09-22 11:22:02 +09:00
Norman Maurer
93b34e3856 Some more cleanup 2012-09-21 22:33:11 +02:00
Norman Maurer
a15213d751 Cleanup imports and add javadocs 2012-09-21 22:08:12 +02:00
Jestan Nirojan
bf22173ed1 Added Multi-Homing in SctpOioChannel 2012-09-21 12:16:06 +08:00
Jestan Nirojan
db4a3a4789 Merge remote-tracking branch 'upstream/master' 2012-09-21 11:56:47 +08:00
Jestan Nirojan
47eafa386c Added SCTP OIO Transport
- Sctp OioChannel/ServeChannel implementation.
- Changed interrupt handling in OioEventLoop.
- SctpOioEchoClient/Server Example.
2012-09-21 11:56:13 +08:00
Norman Maurer
fd8db4eba2 Check if the remoteAddress is null before set it on DatagramPacket to prevent IllegalArgumentException. See #615 2012-09-18 21:25:29 +02:00
norman
3295145e88 [maven-release-plugin] prepare for next development iteration 2012-09-13 10:40:52 +02:00
norman
42685759de [maven-release-plugin] prepare release netty-4.0.0.Alpha4 2012-09-13 10:40:44 +02:00
norman
058dfd0a78 Just add a comment to show that the code is related to #597 2012-09-13 10:25:59 +02:00
norman
df72356d7d Rename classes as result of descussion on #594 2012-09-12 14:04:41 +02:00
norman
d22480c0f4 Add more javadocs and also two helper methods that make it easy to create new Clientbootstrap instances from an existing one 2012-09-11 10:32:59 +02:00
norman
281f73fe1a Some javadocs love 2012-09-11 10:04:05 +02:00
norman
ec1339d775 Finish the refactoring of bootstrap 2012-09-11 09:34:51 +02:00
Norman Maurer
4ce85827ed Start to refactor bootstraps to share more code and allow for reuse 2012-09-11 08:31:20 +02:00
Norman Maurer
1eea3cf503 Support unbindAddress and bindAddress for SCTP. See #560 2012-09-08 20:20:02 +02:00
Jestan Nirojan
22cbaa489a Ported SCTP Transport
- Ported SCTP Echo Server/Client Example
- Added SctpMessage, SctpData and SctpNotification classes
2012-09-04 17:47:48 +05:30
Jestan Nirojan
5395944499 SCTP channel classes ported to Netty 4.x 2012-09-03 17:42:09 +05:30
Jestan Nirojan
359d09bd4d Merge remote-tracking branch 'upstream/master' 2012-09-03 16:53:05 +08:00
Trustin Lee
5a9d6e59c1 Remove unnecessary annotation 2012-09-01 17:03:37 +09:00
Trustin Lee
5c347c5683 Remove unused import 2012-09-01 16:56:44 +09:00
Trustin Lee
e781bd0b1e Disable epoll bug woakraround by default 2012-09-01 16:56:09 +09:00
Trustin Lee
00f737c3a4 Move system property access operations to SystemPropertyUtil 2012-09-01 16:52:47 +09:00
Trustin Lee
f2538a996d [maven-release-plugin] prepare for next development iteration 2012-08-30 16:47:52 +09:00
Trustin Lee
628c5598b3 [maven-release-plugin] prepare release netty-4.0.0.Alpha3 2012-08-30 16:46:58 +09:00
Trustin Lee
a1e8dad4ad Fix a bug in shutdownOutput() implementations where wrong ChannelFuture is notified 2012-08-30 16:38:08 +09:00
Trustin Lee
68e86d8667 [#576] UDP socket bind to specific IP does not receive broadcast on Linux
- Log a warning message if a user attempts to bind to a non-wildcard
  address with SO_BROADCAST set on non-Windows
2012-08-30 15:50:55 +09:00
Trustin Lee
59e511fdc6 Better method names 2012-08-30 14:18:04 +09:00
Trustin Lee
47045e12cd Fix a checkstyle violation 2012-08-30 14:06:56 +09:00
Trustin Lee
c4e7ecbb5d [#575] Sending EMPTYBUFFER via NIO-UDP results in spaming the socket 2012-08-30 14:04:13 +09:00
Norman Maurer
44bfc47a52 Correctly convert to nanos. See #565 2012-08-30 07:24:22 +03:00
Trustin Lee
9580c417c6 Javadoc 2012-08-29 21:52:39 +09:00
Trustin Lee
d03de0f3ca [#107] Add support for closing either input or output part of a channel
- Add ChannelOption.ALLOW_HALF_CLOSURE
  - If true, ChannelInputShutdownEvent is fired via userEventTriggered()
    when the remote peer shuts down its output, and the connection is 
    not closed until a user calls close() explicitly.
  - If false, the connection is closed immediately as it did before.
- Add SocketChannel.isInputShutdown()
- Add & improve test cases related with half-closed sockets
2012-08-29 21:49:39 +09:00
Norman Maurer
a1b668bb2f Fix checkstyle. See #535 2012-08-29 08:12:19 +02:00
Norman Maurer
3d44aeca50 Merge workaround for epoll(..) bug into master branch. See #365 , #535 and #327 2012-08-29 08:03:32 +02:00
Trustin Lee
02f3df55a8 [#107] Add support for closing either input or output part of a channel
- Add shutdownOutput() and isOutputShutdown() to SocketChannel
2012-08-29 13:26:29 +09:00
Trustin Lee
dca860e0d5 Remove code duplication in OIO transport / Make concrete unsafe final 2012-08-29 12:58:00 +09:00
Trustin Lee
37f8710f2b Rename DefaultAioChannelFinder to ReflectiveAioChannelFinder 2012-08-29 12:13:50 +09:00
Trustin Lee
1b810c4be6 Rename to the correct method name 2012-08-29 12:04:56 +09:00
Trustin Lee
9a177d99bf Make AioChannelFinder implementations final 2012-08-28 17:02:03 +09:00
Trustin Lee
a643bdd331 Fix a checkstyle violation 2012-08-28 17:00:54 +09:00
Trustin Lee
cc2ada0b6c Add missing license headers 2012-08-28 16:59:30 +09:00
Trustin Lee
709b3abd83 Improve AioChannelFinder implementations
- Use copy-on-write map
- Fix a potential bug where the old implementation assumed that one 
  Runnable type always wraps the same Runnable
- Cache offset value instead of Field in UnsafeAioChannelFinder
2012-08-28 16:57:45 +09:00
Trustin Lee
17ecbdd804 Better error message 2012-08-28 16:26:57 +09:00
Trustin Lee
c565b59fe3 Remove a unnecessary annotation 2012-08-28 16:25:01 +09:00
Trustin Lee
fe4a8d6dc9 Extract ChannelFinder into separate top level classes 2012-08-28 16:14:35 +09:00
Trustin Lee
e55a1f11b5 [#559] Fix SocketSuspendTest.testSuspendAccept()
- Reimplemented the test
- Fixed various bugs related with read/accept suspension found while testing
  - defaultInterestOps of NioServerSocketChannel should be OP_ACCEPT
  - There's no need do deregister and re-register to suspend/resume accept()
  - Occational infinite loop with 100% CPU consumption in OioEventLoop, caused by OioSocketChannel
  - Even if read/accept is suspended, what's read or accepted should be notified to a user
2012-08-28 15:55:51 +09:00
Trustin Lee
f3c940d208 Add ChannelPipeline.first/lastContext() / Cleanup 2012-08-28 13:03:41 +09:00
Norman Maurer
2710af1b8a More javadocs 2012-08-28 02:10:17 +02:00
Norman Maurer
100dd541ba Rename ChannelHandlerContext.type() to ChannelHandlerContext.types() as it return a Set 2012-08-28 01:19:45 +02:00
Norman Maurer
ea3d304206 Some javadocs love 2012-08-28 01:14:05 +02:00
Norman Maurer
6a62c259ab Merge pull request #566 from netty/unsafe_channel_access
Use Unsafe when possible to access AbstractAioChannel to prevent slow Re...
2012-08-27 01:49:35 -07:00
Norman Maurer
778599baf8 Allow to adjust timeout of Selector.select(timeout) via io.netty.selectTimeout property. See #568 2012-08-26 10:05:20 +02:00
Norman Maurer
967b5424c5 Use Unsafe when possible to access AbstractAioChannel to prevent slow Reflection usage. This is kind of related to #528 2012-08-25 22:50:31 +02:00
Cruz Julian Bishop
ca952e11c0 AbstractChannel: Remove function getRandom()
Requested by @trustin and @normanmaurer

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-25 20:01:57 +10:00
Cruz Julian Bishop
1e3fe3ffc3 AbstractChannel: hashCode() now returns the channel's ID
Requested by @trustin

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-25 13:36:34 +10:00
Cruz Julian Bishop
ad7f7a2f25 Merge branch 'master' into pseudorandom-channel-IDs 2012-08-25 13:34:17 +10:00
Norman Maurer
cd9a36d4e7 Merge pull request #553 from jfallows/aio-unmodified-buffer
Ensure unmodified buffer delivered via pipeline after AIO read completes
2012-08-24 09:25:01 -07:00
Trustin Lee
ba6c032180 [#557] Provide pre/post handler methods to ChannelInboundMessageHandler.inboundBufferUpdated()
- Add pre- and post- handler methods
2012-08-24 17:25:07 +09:00
Trustin Lee
c9174e0733 Prefer discardSomeReadBytes() 2012-08-24 17:22:14 +09:00
Cruz Julian Bishop
d6023ef129 Merge branch 'master' into pseudorandom-channel-IDs 2012-08-23 09:59:02 +10:00
Cruz Julian Bishop
7e3bfaf24c Generate channel IDs in a pseudorandom fashion
Requested by @psweeny in #547

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-23 09:56:58 +10:00
Trustin Lee
00188a2923 [#160] No response to write if server is using SslHandler and client is not
- Make SslHandler close the connection on SSLException or NotSslRecordException
2012-08-22 13:38:09 +09:00
Trustin Lee
73720c422d [maven-release-plugin] prepare for next development iteration 2012-08-21 15:41:04 +09:00
Trustin Lee
68bef8cb99 [maven-release-plugin] prepare release netty-4.0.0.Alpha2 2012-08-21 15:40:45 +09:00
Trustin Lee
0a43350c66 [maven-release-plugin] prepare for next development iteration 2012-08-21 14:41:45 +09:00
Trustin Lee
56211fee59 [maven-release-plugin] prepare release netty-4.0.0.Alpha2 2012-08-21 14:39:59 +09:00
Trustin Lee
a0e34fd93a [maven-release-plugin] prepare for next development iteration 2012-08-21 14:13:38 +09:00
Trustin Lee
72ccf65093 [maven-release-plugin] prepare release netty-4.0.0.Alpha2 2012-08-21 14:13:17 +09:00
Trustin Lee
b25996d024 [#486] Make NoSuchBufferException give more useful message.
- Remove confusing exception messages
- Do not use default exception messages wherever possible
2012-08-20 21:03:23 +09:00
John Fallows
3cce40bd79 Suppress unchecked cast warnings for config options. 2012-08-19 13:49:09 -07:00
Trustin Lee
2bb114bcb7 [#504] SslHandler.flush() notifies futures prematurely.
- Make use of ChannelFlushFutureNotifier to notify flush futures
  correctly
- Improve the test case to ensure this commit fixes the bug
2012-08-19 17:36:58 +09:00
Trustin Lee
3f101ad3d1 [#504] SslHandler.flush() notifies futures prematurely.
- Add ChannelFlushFutureNotifier
  - Extracted the functionality that keeps track of flush futures in
    AbstractChannel.  Will be used in SslHandler.
2012-08-19 17:05:51 +09:00
Trustin Lee
ebf33c6e3b No need to make the timeout of thread model test too long
Using m1.large instance fixed the unstable build problem with CloudBees
2012-08-19 15:18:51 +09:00
Trustin Lee
7b213d2c93 Double the timeout of LocalTransportThreadModelTest
- because it seems to make the build unstable in CloudBees
2012-08-19 15:12:18 +09:00
Trustin Lee
8bfbebc772 Rename TaskScheduler to ChannelTaskScheduler 2012-08-19 15:10:09 +09:00
Trustin Lee
44daa99d3f [#530] Allow using a bounded ByteBuf as the first inbound buffer
- Clean up
- Do not stop reading when reached at maxCapacity.
  - Just let handler drain the buffer and try again quickly.
- No more magic number in OIO buffer expansion
2012-08-19 14:48:56 +09:00
Trustin Lee
9e75a33d3d [#530] Allow using a bounded ByteBuf as the first inbound buffer 2012-08-19 13:55:12 +09:00
John Fallows
cd8e2576b4 Ensure unmodified buffer delivered via pipeline after read completes but before next read begins. 2012-08-18 11:04:10 -07:00
Trustin Lee
11c742f392 [#59] Make ChannelFuture implement Future<Void> 2012-08-18 22:53:58 +09:00
Jestan Nirojan
e257eae287 Merge remote-tracking branch 'upstream/master' 2012-08-18 20:11:00 +08:00
Trustin Lee
f75ba72aeb Allow using non-BlockingQueue
- NioEventLoop never uses takeTask(), and ConcurrentLinkedList is faster
  than LinkedBlockingQueue
2012-08-18 18:48:44 +09:00
Trustin Lee
421eabe666 [#473] Fix elevated context switching in SingleThreadEventExecutor
- Remove polling in SingleThreadEventExecutor
- Create a dedicated scheduled task scheduler called 'TaskScheduler'
- TaskScheduler is created per EventLoopGroup / EventExecutorGroup
- SingleThreadEventExecutor delegates all scheduled execution requests
  to TaskScheduler provided as a constructor parameter
- TaskScheduler is a specialized form of single threaded 
  ScheduledExecutorService which requires an EventExecutor as a
  parameter for all requests.
2012-08-18 18:40:21 +09:00
Trustin Lee
9c17304755 Use different EventLoopGroup for AIO transport tests
- plus tiny cleanup
2012-08-17 12:18:00 +09:00
Norman Maurer
8b66e65277 Merge pull request #515 from jfallows/master
Add support for AIO server channel accepting new channels onto a separate child event loop group. See #514.
2012-08-14 09:58:47 -07:00
John Fallows
148e629104 Use childGroup for accepted AioSocketChannels, children of previously bound AioServerSocketChannel. 2012-08-13 23:12:50 -07:00
norman
061252e4b4 Allow to config read/write timeout for the AIO transport. See #509 2012-08-14 08:06:54 +02:00
John Fallows
06fd869711 Add support for AIO scattering reads and gathering writes.
o Add ByteBuf.hasNioBuffers() method
 o Promote CompositeByteBuf.nioBuffers() methods to ByteBuf
 o Use ByteBuf.nioBuffers() methods from AioSocketChannel
2012-08-12 17:29:07 -07:00
Jestan Nirojan
7ab8ca4d14 Merge remote-tracking branch 'upstream/master' 2012-08-12 20:12:51 +08:00
Jestan Nirojan
4550ad88a6 Initial port of SCTP basic classes and interfaces to Netty 4.0 2012-08-12 20:12:25 +08:00
Trustin Lee
d3a2835503 Add ServerBootstrap.group() that takes a single group 2012-08-10 20:26:04 +09:00
Trustin Lee
d298707198 [#502] Split EventLoop/EventExecutor into parent and children
- Add EventExecutorGroup and EventLoopGroup
- EventExecutor and EventLoop extends EventExecutorGroup and
  EventLoopGroup
  - They form their own group so that .next() returns itself.
- Rename Bootstrap.eventLoop() to group()
- Rename parameter names such as executor to group
- Rename *EventLoop/Executor to *EventLoop/ExecutorGroup
- Rename *ChildEventLoop/Executor to *EventLoop/Executor
2012-08-10 20:17:18 +09:00
Trustin Lee
f4fa5698c1 Add a TODO which should be done when buffer pool is implemented 2012-08-10 10:19:01 +09:00
Trustin Lee
a2aadef4da Add ByteBuf.Unsafe.discardSomeReadBytes() to reduce discardReadBytes() 2012-08-08 17:34:00 +09:00
norman
0334333c82 Fix checkstyle 2012-08-07 15:38:52 +02:00
norman
3ed3827760 Merge branch 'master' of ssh://github.com/netty/netty 2012-08-07 14:59:54 +02:00
norman
947f3bcd5f Merge branch 'master' of ssh://github.com/netty/netty 2012-08-07 14:46:01 +02:00
John Fallows
ed7613e183 Resolve issue #489 with an atomic readInProgress guard to prevent ReadPendingException. 2012-08-05 15:11:12 -07:00
Trustin Lee
f2eeed77e0 Remove a redundant method declaration 2012-08-05 18:43:32 +09:00
norman
3992472b30 cleanup 2012-08-01 14:06:54 +02:00
norman
b4991facf8 Remove unused import 2012-08-01 11:35:17 +02:00
norman
a3a58ecbc0 Fix a bug in suspend read. See #71 2012-08-01 11:35:03 +02:00
norman
6a15f7f5ce Merge branch 'master' into suspend_feature
Conflicts:
	transport/src/main/java/io/netty/channel/DefaultChannelHandlerContext.java
2012-08-01 09:03:33 +02:00
norman
16a4088344 Address @trustin 's comments and also make sure the accept of AIO is only triggered from the event loop. See #71 2012-07-31 11:42:29 +02:00
norman
8b473dce6c Rename class 2012-07-30 15:07:12 +02:00
norman
ba1c7c5c55 Replace usage of QueueFactory with ConcurrentLinkedQueue and LinkedBlockingQueue. See #477 2012-07-30 08:01:46 +02:00
Norman Maurer
57e7255566 Add support to suspend reads. See #71 2012-07-27 20:02:47 +02:00
Daniel Bevenius
927c4ee8cb Minor typo in exception message 2012-07-25 20:51:06 +02:00
Trustin Lee
5a613f379e Make ByteBuf dynamic / Introduce an interface for composite buffers
- Replace ByteBufferBackedByteBuf with DirectByteBuf
- Make DirectByteBuf and HeapByteBuf dynamic
- Remove DynamicByteBuf
- Replace Unpooled.dynamicBuffer() with Unpooled.buffer() and
  directBuffer()
- Remove ByteBufFactory (will be replaced with ByteBufPool later)
- Add ByteBuf.Unsafe (might change in the future)
2012-07-19 20:25:47 +09:00
Trustin Lee
7fbd1e5095 [#454] Unnecessary thread interruption in DefaultEventExecutor 2012-07-13 13:17:35 +09:00
Trustin Lee
d801459cb8 [maven-release-plugin] prepare for next development iteration 2012-07-10 23:11:33 +09:00
Trustin Lee
527f2f6c6e [maven-release-plugin] prepare release netty-4.0.0.Alpha1 2012-07-10 23:10:48 +09:00
Trustin Lee
1c4d0d0f57 Optimize AioEventLoop.findChannel() 2012-07-10 18:04:41 +09:00
Trustin Lee
f5fa671459 Fix regression (see comment) 2012-07-10 15:38:31 +09:00
Trustin Lee
d66a187b5d Fixed a bug where discardReadBytes is called in a wrong place 2012-07-10 14:25:46 +09:00
Trustin Lee
170a04fc72 Revert the buggy commit in AioEventLoop
Also decreased the max stack depth of AioCompletionHandler to 4
(Integer.MAX_VALUE was for testing)
2012-07-10 14:12:14 +09:00
Trustin Lee
701cda2819 Require a user specify the same AioEventLoop
.. both when create an AIO channel and registering it

- Also fixed a bug in AbstractChannel where is does not handle
  registration failure correctly.
2012-07-10 13:57:45 +09:00
Norman Maurer
d233be7041 AIO: Act on the right ByteBuf when a exception was caught during write 2012-07-09 17:27:20 +02:00
Trustin Lee
e157ea1a66 Allow a user use any type as a ReplayingDecoder state / AIO cleanup
- Removed VoidEnum because a user can now specify Void instead
- AIO: Prefer discardReadBytes to clear
- AIO: Fixed a potential bug where notifyFlushFutures() is not called
       if flush() was requested with no outbound data
2012-07-09 20:40:43 +09:00
Norman Maurer
0289dadca4 Don't call Field.get(..) if we can avoid it 2012-07-08 17:41:12 +02:00
Norman Maurer
adb4b87fa8 Replace catch of Exception with Throwable as Field.get(..) can also throw an Error 2012-07-08 17:29:42 +02:00
Trustin Lee
a58533fdad Due to the recent changes with AsynchronousChannelGroup use, there's no
need to schedule read operation later.
2012-07-09 00:04:55 +09:00
Trustin Lee
ee019d344e Fix potential NPE in AioEventLoop / Always notify flush futures 2012-07-08 22:44:15 +09:00
Trustin Lee
e7c6ca945f Fix potential NPE / Use discardReadBytes instead of clear() 2012-07-08 22:22:35 +09:00
Trustin Lee
c77f107f5f Made the AIO transport faster / Fixed a bug in SingleThreadEventLoopTest
- Used reflection hack to dispatch the tasks submitted by JDK
  efficiently.  Without hack, there's higher chance of additional
  context switches.
- Server side performance improved to the expected level.
- Client side performance issue still under investigation
2012-07-08 21:49:15 +09:00
Trustin Lee
bf62add6c7 Clean up
- Removed unnecessary 'closed' flag and redundant close() calls, etc.
2012-07-08 15:12:15 +09:00
Trustin Lee
b79e0b0882 Fix another data race 2012-07-08 14:43:34 +09:00
Trustin Lee
b97b3c602b Add missing license header 2012-07-08 02:26:37 +09:00
Trustin Lee
cef7dfc02f Made the AIO transport adhere to Netty thread model strictly
- Fixed data races
- Simplified channel creation using dummy AsyncChannelGroup
2012-07-08 00:53:56 +09:00
Trustin Lee
613834f326 Fix data corruption in the AIO transport 2012-07-07 21:29:03 +09:00
Trustin Lee
2bc26fbc70 Remove seemingly an ad-hoc test class 2012-07-07 18:49:21 +09:00
Trustin Lee
3a84b9dc71 Make test suite mostly pass by avoiding ClosedChannelException
- SSL echo test still fails
2012-07-07 15:34:14 +09:00
Trustin Lee
aea3ed85bd Allow AIO channel's config is accessible as early as possible 2012-07-07 15:25:55 +09:00
Trustin Lee
c0f4f75c6d Use SOMAXCONN as the default backlog if possible 2012-07-07 15:05:10 +09:00
Trustin Lee
ec88f6617c Fix compilation error and warning 2012-07-07 14:48:34 +09:00
Trustin Lee
fae3861c3a Fix a compiler warning 2012-07-07 14:46:43 +09:00
Trustin Lee
de40a8d09b Fix another compilation error 2012-07-07 14:45:18 +09:00
Trustin Lee
c57e903c4d Fix more compilation errors 2012-07-07 14:44:06 +09:00
Trustin Lee
0941d617d9 Fix a compilation error 2012-07-07 14:42:18 +09:00
Trustin Lee
42380b54b3 Revert file mode 2012-07-07 14:39:35 +09:00
Trustin Lee
9535401632 Revert unnecessary change in Bootstrap 2012-07-07 14:37:44 +09:00
Trustin Lee
b86e2730cc Remove unused classes in util.internal 2012-07-07 14:30:26 +09:00
Trustin Lee
81eaea77bd Add DatagramChannel.isConnected()
.. because there is no way for a user with isActive to know if
   DatagramChannel is connected or not
2012-07-07 14:30:24 +09:00
Trustin Lee
a5bb2c7f77 Add ChannelMetadata and remove unnecessary disconnect() impls
- Add Channel.metadata() and remove Channel.bufferType()
- DefaultPipeline automatically redirects disconnect() request to
  close() if the channel has no disconnect operation
- Remove unnecessary disconnect() implementations
2012-07-07 14:30:24 +09:00
Trustin Lee
faf529166f Increase the timeout of LocalTransportThreadModelTest to 1 minute 2012-07-07 14:30:24 +09:00
Norman Maurer
c165a38e15 Revert as it should be in nio2 branch "Commit first round of classes to support nio2/async channel api. Still work in progress.. See #396"
This reverts commit 18aaae3c2e.
2012-07-07 14:30:24 +09:00
norman
31cebd7ce2 No need for AtomicBoolean as we run in the eventloop. See #396 2012-07-03 15:30:15 +02:00
norman
eccc28965e Make sure the ComplationHandler stuff is handled in the eventloop. See #396 2012-07-03 15:25:28 +02:00
norman
7d33846690 Trigger the read() after the registration was complete. See #396 2012-07-03 13:10:29 +02:00
norman
e58d657421 Supress exception logging if the exception was expected. See #396 2012-07-03 12:01:52 +02:00
norman
c3770a0fba Revert "Check that eventloop's were setup correctly. See #396"
This reverts commit 82834c2f34.
2012-07-03 11:50:50 +02:00
Norman Maurer
82834c2f34 Check that eventloop's were setup correctly. See #396 2012-07-01 22:39:33 +02:00
Norman Maurer
12112ac857 Use the correct outbound buffer for flush the writes. See #396 2012-07-01 22:32:45 +02:00
Norman Maurer
0562aad91f Make sure all pending writes are flushed. See #396 2012-07-01 22:20:36 +02:00
Norman Maurer
8c0146fbd8 Supress warnings 2012-07-01 21:50:44 +02:00
Norman Maurer
e1cbcd6456 Remove left-overs. See #396 2012-07-01 21:50:17 +02:00
Trustin Lee
5caf78acc0 Fix a bug where channelActive is not fired for an accepted channel 2012-06-18 17:22:06 +09:00
Norman Maurer
127e9c1d1e Calling clear is wrong. See #396 2012-06-17 20:28:47 +02:00
Norman Maurer
7412c371f2 Fix writes. See #396 2012-06-17 13:12:15 +02:00
Norman Maurer
22bc8fecca Implement the right interfaces 2012-06-17 11:07:21 +02:00
Norman Maurer
5d1e710adc Package was renamed. See #396 2012-06-16 22:31:43 +02:00
Norman Maurer
70c4f59c45 Some clean. See #396 2012-06-16 22:29:25 +02:00
Norman Maurer
314ac37732 Rename classes from Async* -> Aio*. See #396 2012-06-16 21:20:57 +02:00
Norman Maurer
67be5aeda8 Rename package from nio2 -> aio. See #396 2012-06-16 21:18:25 +02:00
Norman Maurer
ffc6551acc Adjust name. See #396 2012-06-16 21:17:45 +02:00
Norman Maurer
2ff22ff4c3 Add javadocs and also handle writes correctly. See #396 2012-06-16 21:16:54 +02:00
Norman Maurer
70baea35da Make reads work like expected with AOI. See #396 2012-06-16 20:51:45 +02:00
Norman Maurer
f8ef5d5d78 Next round for async channel api support a.k.a nio2. See See #396 2012-06-14 21:02:47 +02:00
Norman Maurer
5d01062da4 Revert as it should be in nio2 branch "Commit first round of classes to support nio2/async channel api. Still work in progress.. See #396"
This reverts commit 18aaae3c2e.
2012-06-13 22:24:32 +02:00
Norman Maurer
032912d938 Commit first round of classes to support nio2/async channel api. Still work in progress.. See #396 2012-06-13 22:24:16 +02:00
Norman Maurer
18aaae3c2e Commit first round of classes to support nio2/async channel api. Still work in progress.. See #396 2012-06-13 22:23:21 +02:00
Trustin Lee
8b7af2ca3b Generate Javadoc with APIviz 2012-06-13 12:11:11 +09:00
Trustin Lee
90b12ba5d2 Fix a ClassCastException in EmbeddedMessageChannel 2012-06-12 21:09:33 +09:00
Trustin Lee
dfce95dd5a Remove unused type 2012-06-12 18:09:05 +09:00
Trustin Lee
660e4548a6 Fix an unexpected RejectedExecutionException
- Ensure to run all remaining tasks before marking the executor as
  'shut down'.
2012-06-12 17:41:06 +09:00
Trustin Lee
3393629eed Log the cause of exceptionCaught event when failed to notify 2012-06-12 17:25:27 +09:00
Trustin Lee
3b562c917d Move ChannelBufferType to netty-buffers and rename it to ChannelBufType
- Also add ChannelBuf.type()
2012-06-12 17:05:28 +09:00
Trustin Lee
ecd0ae5406 Prefer MessageBuf over Queue where possible
- Also replaced thread safe queues with non-thread-safe ones where
  possible
- Unpooled.wrappedBuffer(Queue<T>) does not wrap MessageBuf anymore
2012-06-12 17:02:00 +09:00
Trustin Lee
e1faea035e Automatic clean-up with Eclipse
- Mostly import organization & whitespace removal
2012-06-11 23:04:04 +09:00
Trustin Lee
6211e53e86 Code clean-up based on IntelliJ code analysis 2012-06-11 22:54:28 +09:00
Trustin Lee
876847fd20 Merge MessageBufs and ByteBufs into Unpooled
- e.g. Unpooled.messageBuffer()
- It will make much more sense once we introduce pooling:
  - i.e. Pooled.buffer()
2012-06-11 17:02:29 +09:00
Trustin Lee
d27a27c980 Fix a bug where channelInactive() is not triggered for local transport 2012-06-11 11:59:00 +09:00
Trustin Lee
cf0259661e Fix a race condition where local channel's closeFuture is notified early
- Added AbstractChannel.doPreClose() to allow a transport to perform
  a task before closeFuture is notified
2012-06-11 11:53:43 +09:00
Trustin Lee
632542e0cd Make a CPU-intensive test pass on a slow machine 2012-06-11 11:42:11 +09:00
Trustin Lee
f3bbb7291e Remove a bad assertion 2012-06-11 11:39:44 +09:00
Trustin Lee
9dce123938 Use MessageBuf instead of Queue wherever possible in channel API 2012-06-11 10:43:47 +09:00
Norman Maurer
ad4f05f5d6 Add missing license headers 2012-06-10 20:31:31 +02:00
Trustin Lee
574d84e98e Remove ChannelBufferHolder / Add more handler interfaces for type safety
- ChannelInboundHandler and ChannelOutboundHandler does not have a type
  parameter anymore.  
- User should implement ChannelInboundMessageHandler or
  ChannelOutboundMessageHandler.
2012-06-10 12:22:32 +09:00
Trustin Lee
a849d11877 ChannelBuffers -> ByteBufs / Add MessageBuf & ChannelBuf
- Add MessageBuf which replaces java.util.Queue
- Add ChannelBuf which is common type of ByteBuf and ChannelBuf
- ChannelBuffers was renamed to ByteBufs
- Add MessageBufs
- All these changes are going to replace ChannelBufferHolder.
2012-06-10 11:31:39 +09:00
Trustin Lee
5164d91255 Rename ChannelBuffer to ByteBuf as discussed before
- ChannelBuffer gives a perception that it's a buffer of a
  channel, but channel's buffer is now a byte buffer or a message
  buffer.  Therefore letting it be as is is going to be confusing.
2012-06-10 11:08:43 +09:00
Trustin Lee
87f52aa604 Ensure that a user implements flush() or inboundBufferUpdated()
- Also prohibited a user from overriding
  ChannelInbound(Byte|Message)HandlerAdapter.  If a user wants to do
  that, he or she should extend ChannelInboundHandlerAdapter instead.
2012-06-10 10:48:11 +09:00
Trustin Lee
e376888d48 Replace 'Stream' with 'Byte'
- In computing, 'stream' means both byte stream and message stream,
  which is confusing.
- Also, we were already mixing stream and byte in some places and
  it's better use the terms consistently.
  (e.g. inboundByteBuffer & inbound stream)
2012-06-09 21:05:59 +09:00
Trustin Lee
24e1f936a8 ChannelType -> ChannelBufferType / Optimize DefaultChannelPipeline
- Channel.type() -> bufferType()
- Use simpler bit mask operation for pipeline traversal
2012-06-09 09:44:30 +09:00
Trustin Lee
5661bff062 Rename SocketAddresses to NetworkConstants 2012-06-09 08:44:56 +09:00
Trustin Lee
a507ea97ef Move some logic from DefaultChannelPipeline to DefaultChannelHandlerContext
- Using the fact that head is always non-null, we can remove some code
  in DefaultChannelPipeline and move some to
  DefaultChannelHandlerContext
2012-06-08 23:11:15 +09:00
Trustin Lee
468a3228a4 Fit every line into 120 columns 2012-06-08 19:28:12 +09:00
Trustin Lee
353357fbd5 Moved AsyncPipelineModification to a new file 2012-06-08 12:44:47 +09:00
Trustin Lee
493e77a5a7 Remove trailing whitespace 2012-06-08 11:14:47 +09:00
Trustin Lee
8970ee751c Fix a weird compilation error in DefaultChannelPipeline
probably a compiler bug - working around
2012-06-08 10:57:38 +09:00
Trustin Lee
50fafdc3d3 Rewrite SslHandler / Reduce the chance of OIO-OIO dead lock
- SslHandler always begins handshake unless startTls is true
  - Removed issueHandshake property
  - If a user wants to start handshake later, he/she has to add 
    SslHandler later.
- Removed enableRenegotiation property
  - JDK upgrade fixes the security vulnerability - no need to complicate
    our code
- Some property name changes
  - getSSLEngineInboundCloseFuture() -> sslCloseFuture() 
- Updated securechat example
- Added timeout for handshake and close_notify for better security
  - However, it's currently hard-coded.  Will make it a property later.
2012-06-08 01:22:35 +09:00
Trustin Lee
4a23c2a6eb Fix checkstyle errors 2012-06-07 22:01:59 +09:00
Trustin Lee
10f7a31908 Fixed SpdySessionHandlerTest / Fixed NPE in EmbeddedChannel
- Some tests like SpdySessionHandlerTest accesses outbound buffer
  even before the outbound buffer is initialized by
  AbstractEmbeddedChannel's subclasses, leading to NPE at <init>.
  To fix this problem, subclasses now pass the outbound buffer as
  a constructor parameter to AbstractEmbeddedChannel.
2012-06-07 21:33:31 +09:00
Trustin Lee
994038975a Port HttpContentEncoder/Decoder to use EmbeddedStreamChannel / Cleanup
- Removed unused constructor parameter in AbstractChannel
- Re-enabled GZIP encoding in HTTP snoop example
2012-06-07 21:06:56 +09:00
Trustin Lee
3442ff90e8 Ported all tests in netty-codec to the new embedder 2012-06-07 20:17:26 +09:00
Trustin Lee
7bc10f2eba Replace codec embedder with EmbeddedChannel which can test any handlers
- Added EventExecutor.inEventLoop(Thread) and replaced executor identity
  comparison in DefaultChannelPipeline with it - more elegant IMO
- Removed the test classes that needs rewrite or is of no use
2012-06-07 19:39:37 +09:00
Trustin Lee
8701e24b9a Add back Channel(Inbound|Outbound)(Message|Stream)HandlerAdapter
- they are useful when creating an anonymous class
- Also added back CombinedChannelHandler with extra constraints
2012-06-07 17:49:45 +09:00
Trustin Lee
aab71ccd8a Remove Channel(Inbound|Outbound)HandlerAdapter which does nothing
- Thanks to the recent refactoring, Channel(Inbound|Outbound)Handler-
  Adapter ended up having empty body.  No need to keep.
2012-06-07 17:25:15 +09:00
Trustin Lee
09570db091 Fixed a bug where ChannelInitializer can trigger the same event twice 2012-06-07 17:06:13 +09:00
Trustin Lee
6b819fb993 Fix a NPE in DefaultChannelPipeline.write(...)
- Also re-enabled logging handler in the echo example
2012-06-07 17:00:21 +09:00
Trustin Lee
ea0c9cfe79 Post-overhaul fixes / Split LoggingHandler into three
- LoggingHandler now only logs state and operations
- StreamLoggingHandler and MessageLoggingHandler log the buffer content
- Added ChannelOperationHandlerAdapter
  - Used by WriteTimeoutHandler
2012-06-07 16:56:21 +09:00
Trustin Lee
5e93d206ff Overhaul - Split ChannelHandler & Merge ChannelHandlerContext
- Extracted some handler methods from ChannelInboundHandler into
  ChannelStateHandler
- Extracted some handler methods from ChannelOutboundHandler into
  ChannelOperationHandler
- Moved exceptionCaught and userEventTriggered are now in
  ChannelHandler
  
- Channel(Inbound|Outbound)HandlerContext is merged into
  ChannelHandlerContext
- ChannelHandlerContext adds direct access methods for inboud and
  outbound buffers
  - The use of ChannelBufferHolder is minimal now.
    - Before: inbound().byteBuffer()
    - After: inboundByteBuffer()
    - Simpler and better performance
    
- Bypass buffer types were removed because it just does not work at all
  with the thread model.
  - All handlers that uses a bypass buffer are broken.  Will fix soon.

- CombinedHandlerAdapter does not make sense anymore either because
  there are four handler interfaces to consider and often the two
  handlers will implement the same handler interface such as
  ChannelStateHandler.  Thinking of better ways to provide this feature
2012-06-07 14:52:33 +09:00
Trustin Lee
4831eb49da Fix a test failure in LocalChannelRegistryTest 2012-06-07 08:54:37 +09:00
Trustin Lee
843a94b989 Fix compilation errors (#384)
- ECJ worked fine with the old code, but the official compiler does not
2012-06-06 23:02:47 +09:00
norman
caa35c9772 Rethrow the Throwable which accoured while execution the modification in the EventExecutor 2012-06-05 11:34:47 +02:00
norman
4eb42125a7 Make sure we can't deadlock even if the ChannelPipeline modification is executed by the EventExecutor 2012-06-05 11:21:44 +02:00
Trustin Lee
c2e65016fd Fixed some checkstyle errors 2012-06-04 13:43:02 -07:00
Trustin Lee
1eced1e9e3 Update license headers 2012-06-04 13:31:44 -07:00
Trustin Lee
36dbbc4867 Fix a test failure 2012-06-04 12:14:42 -07:00
Trustin Lee
4630905b92 Do not wrap exceptions if possible 2012-06-04 12:10:13 -07:00
Trustin Lee
b9fc67c9b8 Get the executor of the context earlier if possible. 2012-06-04 11:59:31 -07:00
Trustin Lee
b322e98712 Remove unnecessary parameters and fields / Clean-up 2012-06-04 11:56:00 -07:00
Norman Maurer
6b637ab22f No need for a custom Runnable implementation, just use EventExecutor.submit(..).get(). Thanks @trusting for review 2012-06-04 20:49:31 +02:00
Norman Maurer
ecea558e03 Add missing synchronized 2012-06-04 20:40:17 +02:00
Norman Maurer
0e74b089c2 Merge branch 'master' of github.com:netty/netty 2012-06-04 20:34:16 +02:00
Norman Maurer
c31fbc67c2 Let DefaultChannelPipeline call lifecycle methods of ChannelHandler with respect to the new ThreadModel 2012-06-04 20:34:09 +02:00
Norman Maurer
aac5586428 Fix NPE in test 2012-06-04 20:32:12 +02:00
Trustin Lee
1a9c0fd569 Make use of the existance of bridge references to find a buffer 2012-06-04 11:18:48 -07:00
Trustin Lee
c8c577efc5 Remove an unused field 2012-06-04 09:25:39 -07:00
Trustin Lee
0aa99606d9 Fix a race where 2 handlers in different threads access the same buffer
- DefaultChannelPipeline detects such cases and creates an object called
  'bridge' that works as a man-in-the-middle to deal with a race
  condition
- Slight performance drop is observed but still faster than v3. 
  Couldn't find much from a profiler yet.
2012-06-04 00:24:34 -07:00
Trustin Lee
c1afe3d8c3 Exchanging messages between two handlers is now thread safe
- (not byte buffers yet)
2012-06-03 19:39:35 -07:00
Trustin Lee
f3734e1eb9 Simplified DefaultChannelPipeline by making its list head final
- Previously, head was a volatile field which is null at the beginning.
  While iterating over the pipeline, if the loop hits null, it called
  Channel.Unsafe explicitly.
- Instead, I created an outbound handler that redirects all requests
  to the unsafe and made it a final field of the pipeline.
- As a result, DefaultChannelPipeline code became much simpler.
2012-06-03 18:51:42 -07:00
Trustin Lee
f6e14b636f Improve concurrent message buffer access test to reproduce known issue 2012-06-03 13:21:57 -07:00
Trustin Lee
4d8e2198fa Fix a bug where LocalServerChannel's localAddress is unregistered 2012-06-03 13:20:56 -07:00
Trustin Lee
1cd3156eba Make test case more robust 2012-06-03 13:12:29 -07:00
Trustin Lee
234c4c70db Ensure LocalChannel fire channelActive after peers's channelRegistered
- Also:
  - Made the test case more robust
  - Added a simple concurrent buffer modification test (needs more work)
2012-06-03 12:54:26 -07:00
Trustin Lee
d48973b0ff Add ChannelHandlerContext.hasNext(In|Out)bound(Byte|Message)Buffer 2012-06-03 04:35:38 -07:00
Trustin Lee
bbed0602c1 Use NoSuchBufferException instead of IllegalArgumentException 2012-06-03 04:26:11 -07:00
Trustin Lee
13d7ee1b2f Optimized DefaultChannelPipeline.write(...)
- Also replaced unnecessary function calls with field accesses
2012-06-03 04:25:03 -07:00
Trustin Lee
f991a8c7d4 Fix a bug where DefaultChannelPipeline.write() doesn't find the buffer
- Also fixed failures in SpdySessionHandlerTest
2012-06-03 04:10:32 -07:00
Trustin Lee
ada61d4985 Ported multicast test / Fixed bugs in NioDatagramChannelConfig 2012-06-03 02:57:52 -07:00
Trustin Lee
e6ceb91a85 Add AbstractDatagramTest / Port unicast test / Ignore 'Socket closed' 2012-06-03 02:40:58 -07:00
Trustin Lee
955c89fcf1 Add SocketEchoTest that will simplify a lot of socket testing
- SocketTestCombination generates all possible test combinations of
  socket transports.
- SocketEchoTest iterates over the combinations and runs all tests
  using reflection.
2012-06-03 01:52:39 -07:00
Trustin Lee
3b2c25e8ed Rename (Server)Bootstrap.(child)initializer to (child)handler
- The handler you specify with initializer() is actually simply added
  to the pipeline and that's all.  It's ChannelInitializer which does
  additional work.  For example, a user can specify just a single
  handler with initializer() and it will still work.  This is especially
  common for Bootstrap, so I renamed initializer to handler, which makes
  more sense.
2012-06-03 01:00:16 -07:00
Trustin Lee
19dcb81727 Add comments for easier understanding 2012-06-02 02:43:26 -07:00
Trustin Lee
01a5bd41f0 Add Channel.type() which tells if stream-oriented or message-oriented
- DefaultChannelPipeline uses this information to reject invalid buffer
  access in inbound(Message|Byte)Buffer.  Otherwise, a user can access
  a message buffer when the channel is stream-oriented.
- Because ChannelType cannot be both STREAM and MESSAGE, catch-all
  buffer has been removed to avoid confusion and unexpected behavior
  (it's already causing headache.)
- As a result, codec embedder needs rework.
2012-06-02 01:58:15 -07:00
Trustin Lee
cc4f705029 Replace ChannelBuffer.toByteBuffer() with hasNioBuffer() and nioBuffer()
... just like we do with byte arrays.  toByteBuffer() and
toByteBuffers() had an indeterministic behavior and thus it could not
tell when the returned NIO buffer is shared or not.  nioBuffer() always
returns a view buffer of the Netty buffer.  The only case where
hasNioBuffer() returns false and nioBuffer() fails is the
CompositeChannelBuffer, which is not very commonly used and *slow*.
2012-06-02 01:30:55 -07:00
Trustin Lee
04cf1c8199 Use custom thread factory by default to better recognize the threads
... from their names
2012-06-01 22:57:54 -07:00
Trustin Lee
61e169e53a Remove EventExecutor.parent(), which is of no use 2012-06-01 22:33:53 -07:00
Trustin Lee
4440386494 Little bit of optimization 2012-06-01 18:34:19 -07:00
Trustin Lee
141a05c831 Strict thread model / Allow assign an executor to a handler
- Add EventExecutor and make EventLoop extend it
- Add SingleThreadEventExecutor and MultithreadEventExecutor
- Add EventExecutor's default implementation
- Fixed an API design problem where there is no way to get non-bypass
  buffer of desired type
2012-06-01 17:51:19 -07:00
Trustin Lee
ab5043b3c7 Fixed LocalAddressTest 2012-05-31 21:22:03 -07:00
Trustin Lee
5243d3d0f0 Add @Sharable annotation to ChannelInitializer 2012-05-31 17:05:34 -07:00
Trustin Lee
f2eddda5a4 Call discardReadBytes() on outbound byte buffers when possible
- Also fixed a test failure in codec-http
2012-05-31 16:59:54 -07:00
Trustin Lee
d626561b59 Define a dedicated exception for performing blocking ops in event loop 2012-05-31 16:47:00 -07:00
Trustin Lee
468918227a Remove unnecessary parameter in AttributeKey and ChannelOption
- Removed UniqueKey which does nothing
- The valueType parameter was not needed at all because we do not need
  type information in runtime at all.
2012-05-31 16:03:57 -07:00
Trustin Lee
7ddc93bed8 Ported IdleStateHandler / Forward-ported the UptimeClient example
- Add ChannelHandlerContext.eventLoop() for convenience
- Bootstrap and ServerBootstrap handles channel initialization failure
  better
- More strict checks for missing @Sharable annotation
  - A handler without @Sharable annotation cannot be added more than
    once now.
2012-05-31 14:54:48 -07:00
Trustin Lee
49bda34a5d Fix a bug where ChannelBufferHolder.isEmpty() returns a wrong value
.. when it has a byte buffer
2012-05-31 09:14:39 -07:00
Trustin Lee
0fd824c3bb Fix UnsupportedOperationException 2012-05-31 09:11:07 -07:00
Trustin Lee
2a63acef4d More convenient inbound stream handler / Smarter inbound buffer cleanup
- Added a new convenience method to ChannelInboundstreamHandlerAdapter 
- EchoServerHandler uses the new method
- DefaultChannelPipeline calls inboundByteBuffer.discardReadBytes()
  when it is sure there's no memory copy involved
2012-05-31 09:03:31 -07:00
Trustin Lee
665777e6f9 Add InternetProtocolFamily and use it with NioDatagramChannel 2012-05-31 02:49:39 -07:00
Trustin Lee
7ac89ace4f Finished forward-porting SPDY codec 2012-05-31 01:53:58 -07:00
Trustin Lee
32c982b478 Fix NPE in OioChildEventLoop 2012-05-31 01:19:54 -07:00
Trustin Lee
53f16ce003 Add more convenience methods to Bootstrap and ServerBootstrap 2012-05-30 23:47:15 -07:00
Trustin Lee
67ec4429cc Implement NIO.2 multicast options 2012-05-30 19:03:45 -07:00
Trustin Lee
42abb6df3a QueueFactory cleanup
- Really attempt to create a queue to determine LTQ can be initialized
  in runtime, and cache the result
- Remove unnecessary Class<T> parameter in createQueue()
- Remove unused createQueue(Collection)
2012-05-30 16:19:22 -07:00
Trustin Lee
e3431db547 Use logger instead of System.err 2012-05-30 15:46:38 -07:00
Trustin Lee
e5bcc74cd5 Warn if the last inbound handler forwarded an exceptionCaught() event 2012-05-30 11:48:04 -07:00
Trustin Lee
cca35454d2 Ensure channelInboundBufferUpdated is fired after channelActive 2012-05-30 11:32:39 -07:00
Trustin Lee
47fa2ef2e8 Use LinkedHashSet instead of HashSet to preserve order of execution 2012-05-30 10:17:45 -07:00
Trustin Lee
9f9045c3b4 Add EventLoop implementation for the local transport 2012-05-30 04:33:43 -07:00
Trustin Lee
c17e5b458a Typo 2012-05-30 04:28:01 -07:00
Trustin Lee
4154f42520 Less restriction in shutdown hook modification 2012-05-30 04:27:19 -07:00
Trustin Lee
078a502c5f Add shutdown hooks to SingleThreadEventLoop
- LocalChannel and LocalServerChannel uses it to close themselves on
  shutdown
- LocalEcho example does not call close() anymore because the channels
  are closed automatically on shutdown
2012-05-30 04:23:15 -07:00
Trustin Lee
243f6581c6 Safer shutdown 2012-05-30 04:06:15 -07:00
Trustin Lee
65e224f149 Safer shutdown 2012-05-30 04:05:10 -07:00
Trustin Lee
a53ecbf5f1 Implement the local transport
- Replace the old local example with localecho example
- Channel's outbound buffer is guaranteed to be created on construction
  time.
2012-05-30 03:58:14 -07:00
Trustin Lee
392623749e Fix compilation errors 2012-05-30 02:01:48 -07:00
Trustin Lee
78974e85c5 AbstractUnsafe.out() -> directOutbound()
- to avoid confusion between Channel.outbound()
2012-05-30 00:38:23 -07:00
Trustin Lee
f4c6bcafaf Keep channel's outbound buffer in AbstractChannel
- Replace firstOut() with newOutboundBuffer()
2012-05-30 00:35:53 -07:00
Trustin Lee
a9948d681e Throw NoSuchBufferException instead of returning null
- Exception in this case makes a user less confusing
- To reduce the overhead of filling the stack trace,
  NoSuchBufferException has a public pre-constructed instance.
  - This is necessary because codec framework sometimes need to support
    both type of outbound buffers.
- Fixed a bug where SpdyFrameEncoder did not handle ping messages
- Reduced memory copy in codec embedder (EmbeddedChannel)
2012-05-29 17:25:09 -07:00
Trustin Lee
8237afff64 Ported most examples
- Renamed ChannelBootstrap to Bootstrap
- Renamed ServerChannelBootstrap to ServerBootstrap
- Moved bootstrap classes to io.netty.bootstrap as before
- Moved unfoldAndAdd() to a separate utility class
- Fixed a bug in unfoldAndAdd() where it did not handle ChannelBuffer
  correctly
2012-05-29 16:41:26 -07:00
Trustin Lee
026715e818 Refactor the pipeline API to support stacked codecs
- Previous API did not support the pipeline which contains multiple
  MessageToStreamEncoders because there was no way to find the closest
  outbound byte buffer.  Now you always get the correct buffer even if
  the handler that provides the buffer is placed distantly.
  For example:
  
    Channel -> MsgAEncoder -> MsgBEncoder -> MsgCEncoder
  
  Msg(A|B|C)Encoder will all have access to the channel's outbound
  byte buffer.  Previously, it was simply impossible.

- Improved ChannelBufferHolder.toString()
2012-05-29 12:09:29 -07:00
Trustin Lee
6d39c342b6 Add FIXME 2012-05-28 05:20:32 -07:00
Trustin Lee
e48281471b Limit future notification stack depth / Robost writeCounter management
- Also ported the discard example while testing this commit
2012-05-28 05:05:49 -07:00
Trustin Lee
a2698e65fb Added more convenience methods to bootstraps 2012-05-28 01:23:58 -07:00
Trustin Lee
626c5ef9c9 Remove the classes that are not part of Netty 4.0.0.Alpha1
- Will add them back before Beta1
2012-05-27 19:39:10 -07:00
Trustin Lee
f4a19886d3 Reorder methods / Move buffer expansion logic in OIO 2012-05-27 05:31:18 -07:00
Trustin Lee
7b05f34171 Split AbstractOioChannel into its subtypes
- AbstractOioMessageChannel and AbstractOioStreamChannel
- Replaced 'if' with polymorphism
- Better performance
2012-05-27 05:19:45 -07:00
Trustin Lee
064b3dc9e5 Split AbstractNioChannel into two subtypes
- AbstractNioMessageChannel and AbstractNioStreamChannel
- Better performance
- Replaced 'if' checks with polymorphism
2012-05-27 05:07:23 -07:00
Trustin Lee
7327bb3522 Add SingleThreadEventLoop.runAllTasks()
- Removed duplicated processTaskQueue() in child event loops
- Simplified the cleanup of cancelled keys in NIO transport
2012-05-27 04:43:48 -07:00
Trustin Lee
f29b6ae29a Fix performance issue in OioSocketChannel since previous refactoring 2012-05-26 23:29:23 -07:00
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