Commit Graph

706 Commits

Author SHA1 Message Date
Trustin Lee
9c0b2ad75c Update netty-build to the latest version
From this commit, checkstyle considers an unnecessary empty line as a
violation.
2012-12-04 16:46:46 +09:00
Norman Maurer
85c570505b [maven-release-plugin] prepare for next development iteration 2012-12-03 20:34:05 +01:00
Norman Maurer
17d77ed160 [maven-release-plugin] prepare release netty-4.0.0.Alpha8 2012-12-03 20:33:49 +01:00
Norman Maurer
f9225df0a9 Add back support for FileRegion. See #668 2012-12-03 12:08:17 +01:00
Trustin Lee
33c0c89fef Remove unnecessary empty lines 2012-12-03 19:58:13 +09:00
Trustin Lee
5f9090a7f0 Fix invalid memory access in AIO writes
To perform writes in AioSocketChannel, we get a ByteBuffer view of the
outbound buffer and specify it as a parameter when we call
AsynchronousSocketChannel.write().

In most cases, the write() operation is finished immediately.  However,
sometimes, it is scheduled for later execution.  In such a case, there's
a chance for a user's handler to append more data to the outbound
buffer.

When more data is appended to the outbound buffer, the outbound buffer
can expand its capacity by itself.  Changing the capacity of a buffer is
basically made of the following steps:

1. Allocate a larger new internal memory region.
2. Copy the current content of the buffer to the new memory region.
3. Rewire the buffer so that it refers to the new region.
4. Deallocate the old memory region.

Because the old memory region is deallocated at the step 4, the write
operation scheduled later will access the deallocated region, leading
all sort of data corruption or even segfaults.

To prevent this situation, I added suspendIntermediaryDeallocations()
and resumeIntermediaryDeallocations() to UnsafeByteBuf.

AioSocketChannel.doFlushByteBuf() now calls suspendIntermediaryDealloc()
to defer the deallocation of the old memory regions until the completion
handler is notified.
2012-12-02 21:50:33 +09:00
Trustin Lee
72e0acbe84 Use correct timeout in AioSocketChannel.beginRead() 2012-12-02 20:38:59 +09:00
Trustin Lee
bfe2a96505 Fix AssertionError from AsyncSocketChannel.beginRead()
An AssertionError is triggered by a ByteBuf when beginRead() attempts to
access the buffer which has been freed already.  This commit ensures the
buffer is not freed before performing an I/O operation.

To determine if the buffer has been freed, UnsafeByteBuf.isFreed() has
been added.
2012-12-02 20:17:53 +09:00
Trustin Lee
95e8ec1db9 Handle the case where JDK notifies aync I/O handler immediately
After some debugging, I found that JDK AIO implementation often performs
I/O immediately from the caller thread if the caller thread is the I/O
thread, and notifies the completion handler also immediately.  This
commit handles such a case correctly during reads and writes.

Additionally, this commit also changes SingleThreadEventExecutor to let
it handle unexpected exceptions such as AssertionError in a robus
manner.
2012-12-02 20:03:35 +09:00
Trustin Lee
00c4b944e4 Fix more inspector warnings introduced by recent mergences 2012-12-01 00:10:42 +09:00
Trustin Lee
6208c62888 Fix inspector warnings introduced by recent mergences 2012-11-30 23:01:57 +09:00
Trustin Lee
818a7b42a3 Fix all Xlint:unchecked warnings 2012-11-30 22:49:51 +09:00
Trustin Lee
c661c344ed Add proper toString() implementation for internal ChannelFactory impls 2012-11-26 17:15:14 +09:00
Trustin Lee
918666481e Ensure lazily instantiated outbound buffers are instantiated from the event loop 2012-11-26 17:14:21 +09:00
Trustin Lee
74749ec15d Implement Bootstrap.toString() and use it in the testsuite
By implementing Bootstrap.toString() and printing it for each test case helps us figure out which transport is causing a trouble.
2012-11-26 16:14:24 +09:00
Trustin Lee
dbbc6ad73f Reduce the chance of RejectedExecutionException
When a Netty application shuts down, a user often sees a REE
(RejectedExecutionException).

A REE is raised due to various reasons we don't have control over, such
as:

- A client connects to a server while the server is shutting down.

- An event is triggered for a closed Channel while its event loop is
  also shutting down.  Some of them are:
  - channelDeregistered (triggered after a channel is closed)
  - freeIn/OutboundBuffer (triggered after channelDeregistered)
  - userEventTriggered (triggered anytime)

To address this issue, a new method called confirmShutdown() has been
added to SingleThreadEventExecutor.  After a user calls shutdown(),
confirmShutdown() runs any remaining tasks in the task queue and ensures
no events are triggered for last 2 seconds.  If any task are added to
the task queue before 2 seconds passes, confirmShutdown() prevents the
event loop from terminating by returning false.

Now that SingleThreadEventExecutor needs to accept tasks even after
shutdown(), its execute() method only rejects the task after the event
loop is terminated (i.e. isTerminated() returns true.)  Except that,
there's no change in semantics.

SingleThreadEventExecutor also checks if its subclass called
confirmShutdown() in its run() implementation, so that Netty developers
can make sure they shut down their event loop impementation correctly.

It also fixes a bug in AioSocketChannel, revealed by delayed shutdown,
where an inboundBufferUpdated() event is triggered on a closed Channel
with deallocated buffers.

Caveats:

Because SingleThreadEventExecutor.takeTask() does not have a notion of
timeout, confirmShutdown() adds a dummy task (WAKEUP_TASK) to wake up
takeTask() immediately and instead sleeps hard-coded 100ms.  I'll
address this issue later by modifying takeTask() times out dynamically.

Miscellaneous changes:

SingleThreadEventExecutor.wakeup() now has the default implementation.
Instead of interrupting the current thread, it simply adds a dummy task
(WAKEUP_TASK) to the task queue, which is more elegant and efficient.
NioEventLoop is the only implementation that overrides it. All other
implementations' wakeup()s were removed thanks to this change.
2012-11-22 20:36:13 +01:00
Trustin Lee
81e2db10fa ByteBufAllocator API w/ ByteBuf perf improvements
This commit introduces a new API for ByteBuf allocation which fixes
issue #643 along with refactoring of ByteBuf for simplicity and better
performance. (see #62)

A user can configure the ByteBufAllocator of a Channel via
ChannelOption.ALLOCATOR or ChannelConfig.get/setAllocator().  The
default allocator is currently UnpooledByteBufAllocator.HEAP_BY_DEFAULT.

To allocate a buffer, do not use Unpooled anymore. do the following:

  ctx.alloc().buffer(...); // allocator chooses the buffer type.
  ctx.alloc().heapBuffer(...);
  ctx.alloc().directBuffer(...);

To deallocate a buffer, use the unsafe free() operation:

  ((UnsafeByteBuf) buf).free();

The following is the list of the relevant changes:

- Add ChannelInboundHandler.freeInboundBuffer() and
  ChannelOutboundHandler.freeOutboundBuffer() to let a user free the
  buffer he or she allocated. ChannelHandler adapter classes implement
  is already, so most users won't need to call free() by themselves.
  freeIn/OutboundBuffer() methods are invoked when a Channel is closed
  and deregistered.

- All ByteBuf by contract must implement UnsafeByteBuf. To access an
  unsafe operation: ((UnsafeByteBuf) buf).internalNioBuffer()

- Replace WrappedByteBuf and ByteBuf.Unsafe with UnsafeByteBuf to
  simplify overall class hierarchy and to avoid unnecesary instantiation
  of Unsafe instances on an unsafe operation.

- Remove buffer reference counting which is confusing

- Instantiate SwappedByteBuf lazily to avoid instantiation cost

- Rename ChannelFutureFactory to ChannelPropertyAccess and move common
  methods between Channel and ChannelHandlerContext there. Also made it
  package-private to hide it from a user.

- Remove unused unsafe operations such as newBuffer()

- Add DetectionUtil.canFreeDirectBuffer() so that an allocator decides
  which buffer type to use safely
2012-11-22 15:10:59 +09:00
Mike Heath
40e53b9b68 Fixed exception handling to call the exceptionCaught method in the current handler. By default the handler will call ctx.fireExceptionCaught which is what was happening before. 2012-11-20 10:00:27 +01:00
dantran
4107b08f29 Only generate OSGi manifest only at all-in-on sub module to reduce the complexity to the build 2012-11-19 06:27:18 +01:00
coltnz
fea7475080 [#749] Report non @Shareable handler name that has been re-added. 2012-11-18 11:40:01 +01:00
Evans Yang
a0da613e86 [#743] Make the "tail" point to the last channel handler context. And add several cases for DefaultChannelPipeline. 2012-11-16 07:33:32 +01:00
Evans Yang
37d04c26a8 [#739] Potential NullPointException without checking the initialCtx's status 2012-11-16 07:08:45 +01:00
Shawn Silverman
0bd73b8d80 [#732] [#672] Allow replacing an inbound or outbound buffer of a handler 2012-11-13 21:17:42 +01:00
Norman Maurer
d177fd5a17 [#735] Make sure the handshake ChannelFuture is notified after the right encoder is present in the ChannelPipeline 2012-11-13 09:25:19 +01:00
dantran
105f952f5d Clean up maven-bungle-plugin warnings 2012-11-12 11:42:42 +01:00
dantran
e236f5b77d [#154] [#727] Use maven-plugin-plugin to generate OSGi manifest 2012-11-12 09:15:36 +01:00
Trustin Lee
45de76f58d More helpful IllegalArgumentException message 2012-11-12 16:02:30 +09:00
Trustin Lee
b3be15204d Fix 'channelFactory already set' error 2012-11-12 15:59:25 +09:00
Trustin Lee
a05064d3eb Fix more inspection warnings + compilation errors 2012-11-12 13:25:00 +09:00
Trustin Lee
36c8eb02e8 Fix parameter namings + some more 2012-11-12 12:59:37 +09:00
Trustin Lee
6f2840193a Fix inspection warnings related with JUnit usage 2012-11-12 12:45:06 +09:00
Trustin Lee
aedf8790c3 Fix various Javadoc issues / Do not use argN parameter names 2012-11-12 12:26:19 +09:00
Trustin Lee
ea4a0e3535 Prefer {@code ...} to <code>...</code> / Fix deprecation warnings 2012-11-12 11:51:23 +09:00
Trustin Lee
15642f2cd8 Do not call static methods via instances 2012-11-12 11:23:06 +09:00
Trustin Lee
d78f5a4f76 Optimize imports / Remove britspace 2012-11-12 09:51:59 +09:00
Trustin Lee
9746bb2036 Make a member field final wherever possible 2012-11-12 09:43:55 +09:00
Trustin Lee
4dce19b814 Replace a variable with a constant wherever possible 2012-11-12 09:43:14 +09:00
Trustin Lee
1cb589a950 Replace a loop that runs only once with a single statement (Second take)
Fix potential NoSuchElementException
2012-11-12 09:39:16 +09:00
Trustin Lee
18f1b1f1d0 Replace a loop that runs only once with a single statement 2012-11-12 09:35:50 +09:00
Trustin Lee
aa7cd691df Remove redundant 'else' branches. 2012-11-12 09:31:40 +09:00
Trustin Lee
91a61d7f43 Remove unnecessary qualifiers 2012-11-12 09:11:48 +09:00
Norman Maurer
fa805c4c13 Allow easier use of AIO transport via bootstrap. Related to [#725] 2012-11-10 20:43:53 +01:00
Trustin Lee
1cc104e1c0 Fix a compilation error 2012-11-10 08:51:59 +09:00
Trustin Lee
b4f796c5e3 Use 'x' over "x" wherever possible / String.equals("") -> isEmpty() 2012-11-10 08:03:52 +09:00
Trustin Lee
05c416b674 Add 'static' modifier to the methods that don't need to be member methods 2012-11-10 07:54:33 +09:00
Trustin Lee
f77f13faf0 Make classes static wherever possible 2012-11-10 07:32:53 +09:00
Trustin Lee
0d0eb0abfb Remove unused imports 2012-11-10 07:05:18 +09:00
Trustin Lee
23883d25ee Remove various unnecessary qualifiers 2012-11-10 07:03:07 +09:00
Trustin Lee
5c57dd9f0d Remove redundant field initialization 2012-11-10 06:56:39 +09:00
Trustin Lee
b9fbed49bd Suppress false positives related with utility class inspections.
IntelliJ IDEA inspection for private utility classes seems flawed.
2012-11-10 06:53:34 +09:00
Trustin Lee
958d04a42b Remove redundant throws clauses / Suppress inspections for some false positives 2012-11-10 06:47:59 +09:00
Trustin Lee
a5a19efb4b Remove unnecessary this, parenthesis, and semicolons 2012-11-10 02:27:33 +09:00
Trustin Lee
a9cfde97f0 Add missing final modifiers 2012-11-10 02:19:11 +09:00
Trustin Lee
58ba0de659 Remove unnecessarily qualified static access 2012-11-10 01:32:21 +09:00
Trustin Lee
bbcb035246 Prefer isEmpty() over size() == 0 or length() == 0 2012-11-10 01:24:04 +09:00
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