Trustin Lee
6282b31bc0
Format
2013-04-24 18:57:14 +09:00
Trustin Lee
7c5dc363fb
Rename methods to catch up the recent changes in handler life cycle listener methods / Ensure to call handlerRemoved() even if ctx.forwardContentAndRemove() failed
2013-04-24 18:55:51 +09:00
Trustin Lee
c72b5341a3
ChannelHandler.handlerRemoved() must be invoked *after* the handler has been removed completely and its buffers should be inaccessible.
2013-04-24 18:46:35 +09:00
Trustin Lee
a68d39fcf2
Fix an infinite exception storm triggered by DefaultChannelHandlerContext.invokeInboundBufferUpdated()
...
- it has to break from the infinite loop when an exception is raised by handler
2013-04-24 18:39:34 +09:00
Trustin Lee
b5989e2449
Reduce exception instantiation overhead in SslHandler / Reduce unnecessary empty array creation
...
- Added EmptyArrays as an internal utility class
2013-04-24 09:32:53 +09:00
Trustin Lee
d292fdafdd
Make sure to close the accept channel which couldn't be initialized or added to the message buffer
2013-04-23 22:42:47 +09:00
Trustin Lee
cc0ad9f1cc
Fix hanging SocketBufReleaseTest / Make sure AioServerSocketChannel closes the accepted channel when the server socket is being shut down
2013-04-23 22:38:28 +09:00
Trustin Lee
f03b2cde62
Fix intermittent infinite loop in AbstractOioByteChannel.doRead()
...
- OioByteStreamChannel.doReadBytes() did not expand the capacity of the inbound buffer properly.
2013-04-23 22:12:07 +09:00
Trustin Lee
f149cf5220
Reduce code duplication
2013-04-23 13:42:00 +09:00
Trustin Lee
5d5c60bdd3
Fix a bug where fireInboundBufferUpdated() and flush() swallow the event too early
...
- Fixes #1292
- Replace DefaultChannelPipeline.inbound/outboundShutdown flag with per-context flags
- Update the flags in free() / freeInbound() / freeOutbound() for clarity
2013-04-23 13:35:32 +09:00
Trustin Lee
8e2e22c270
Change the thread model slightly for new/freeInbound/OutboundBuffer() for future improvement
...
- Related: #1283
- Make ReplayingDecoder work with the modified thread model
2013-04-23 13:06:27 +09:00
Trustin Lee
d85757a008
Fix memory leak in DefaultChannelHandlerContext
...
.. where freeInbound() and freeOutbound() are not called for all contexts
- Fixes #1298
2013-04-22 22:18:10 +09:00
Trustin Lee
e80fb65c36
Clean up the pipeline implementation / Ensure Embedded*Channel does not run pending tasks immediately
...
- Replace ugly 'prev != null' check with explicit event scheduling
- Fix an incorrect flag operation in freeHandlerBuffersAfterRemoval()
- Fix a bug in AbstractEmbeddedChannel.doRegister where it makes pending tasks immediately, where the pending tasks actually triggers inbound events
- Remove unnecessary suppression of inboundBufferUpdated() event in DefaultChannelPipeline, which potentially hides an event ordering bug. Unfortunately, I don't remember why I added it in cca35454d2
.
2013-04-22 19:41:00 +09:00
Norman Maurer
9c4bfa44d9
[ #1294 ] Make sure ByteBuf is released once written to channel
2013-04-22 11:04:56 +02:00
Trustin Lee
f979c17b67
Revert "Fix #1075 : DefaultChannelHandlerContext.fireChannelSuspended and fireInboundBufferUpdated do not work correctly if handlers with EventExecutor are added or removed from pipeline."
...
This reverts commit 273948055a
, which is
incorrect.
- Related: #1075
2013-04-22 16:59:43 +09:00
Trustin Lee
c01d37ad05
Merge forwardBufferContent and setRemoved()
2013-04-22 14:47:17 +09:00
Norman Maurer
9b89c303cc
Return correct type on retain(..)
2013-04-21 13:41:34 +02:00
Norman Maurer
2640832a38
Fix checkstyle
2013-04-21 12:52:42 +02:00
Trustin Lee
5846693577
Typo
2013-04-21 07:45:37 +09:00
Trustin Lee
475039532c
Split dynamic pipeline manipulation test into a new class / Replace PrefixThreadFactory with DefaultThreadFactory / Port the latest tests from the branch 'out-of-order' written by @normanmaurer
2013-04-21 07:44:37 +09:00
Norman Maurer
ca5554dfe7
[ #1236 ] Fix problem where adding a new ChannelHandler could block the eventloop
...
This change also introduce a few other changes which was needed:
* ChannelHandler.beforeAdd(...) and ChannelHandler.beforeRemove(...) were removed
* ChannelHandler.afterAdd(...) -> handlerAdded(...)
* ChannelHandler.afterRemoved(...) -> handlerRemoved(...)
* SslHandler.handshake() -> SslHandler.hanshakeFuture() as the handshake is triggered automatically after
the Channel becomes active
2013-04-19 07:00:50 +02:00
Norman Maurer
58bfd6bf3b
[ #1284 ] Fix bug which can cause in infinity-loop triggered by a handler removal
2013-04-18 22:15:50 +02:00
Trustin Lee
7ee571968c
Use progress + total instead of delta
...
.. because there is sometimes a task whose total is only a rough
estimation
2013-04-15 20:11:02 +09:00
Trustin Lee
e69033a4c3
Replace TransferFuture(Listener) with (Channel)ProgressiveFuture(Listener)
...
- Now works without the transport package
- Renamed TransferFuture to ProgressiveFuture and ChannelProgressiveFuture / same for promises
- ProgressiveFutureListener now extends GenericProgressiveFutureListener and GenericFutureListener (add/removeTransferListener*() were removed)
- Renamed DefaultEventListeners to DefaultFutureListeners and only accept GenericFutureListeners
- Various clean-up
2013-04-15 15:26:20 +09:00
Trustin Lee
391c011764
Renames and typos
2013-04-15 11:03:59 +09:00
kerr
713b200adf
[ #1244 ] Support ChannelTransferPromise for sendFile
2013-04-14 21:22:03 +02:00
Norman Maurer
d8387fa4c3
[ #858 ] Merge ChannelPipeline.replaceAndForward into replace and removeAndForward into remove
2013-04-13 18:19:33 +02:00
Trustin Lee
4a792151b0
Rewrite bridge implementation in DefaultChannelHandlerContext
...
This commit splits bridge into two parts. One is NextBridgeFeeder,
which provides ByteBuf and MessageBuf that are local to the context
whose next*Buffer() has been invoked on. The other is a thread-safe
queue that stores the data fed by NextBridgeFeeder.feed().
By splitting the bridge into the two parts, the data pushed by a handler
is not lost anymore when the next handler who provided the next buffer
is removed from the pipeline.
- Fixes #1272
2013-04-12 17:38:04 +09:00
Norman Maurer
725156f082
[ #1242 ] Fix infinity-loop which was triggered when a write failed and AioSocketChannel was used
2013-04-10 15:39:58 +02:00
Norman Maurer
4746e74124
[ #1247 ] Add javadocs which tell the limitation of the type detection as there is nothing we can do about
2013-04-10 11:27:54 +02:00
Norman Maurer
0efebd5a82
Allow to get an Iterator over all of the EventExecutor an EventExecutorGroup contains. Beside this allow to get basic stats for the EventExecutor like pendingTasks and executorCount
2013-04-09 15:45:18 +09:00
Norman Maurer
067a2af700
Fix a few typos
2013-04-08 21:23:53 +02:00
Norman Maurer
2a162eb140
Rename method to better reflect usage
2013-04-08 08:06:46 +02:00
Norman Maurer
8632d9011e
[ #1239 ] Fix possible NPE while fail flush futures during close
2013-04-05 19:23:49 +02:00
Andrei Pozolotin
a3e760a003
fix #1234 - duplicate package-info.java errors in eclipse requires release of netty-build v 19 and netty-parent update.
2013-04-05 05:38:05 +09:00
Norman Maurer
4505e7f1b3
Make sure OP_WRITE is correctly cleared when using FileRegion and other NioTasks
2013-04-04 08:38:58 +02:00
Norman Maurer
af4b71a00e
Remove special handling of Object[] in codec framework (a.k.a unfolding)
...
- Fixes #1229
- Primarily written by @normanmaurer and revised by @trustin
This commit removes the notion of unfolding from the codec framework
completely. Unfolding was introduced in Netty 3.x to work around the
shortcoming of the codec framework where encode() and decode() did not
allow generating multiple messages.
Such a shortcoming can be fixed by changing the signature of encode()
and decode() instead of introducing an obscure workaround like
unfolding. Therefore, we changed the signature of them in 4.0.
The change is simple, but backward-incompatible. encode() and decode()
do not return anything. Instead, the codec framework will pass a
MessageBuf<Object> so encode() and decode() can add the generated
messages into the MessageBuf.
2013-04-03 21:44:54 +09:00
Trustin Lee
117ad8acd7
Add MultithreadEventLoopGroup.DEFAULT_EVENT_LOOP_THREADS / Add DefaultThreadFactory
...
- Allow overriding the default thread factory when a user specified no thread factory
2013-04-03 17:49:30 +09:00
Trustin Lee
312a35dfed
Remove MultithreadEventExecutorGroup.DEFAULT_POOL_SIZE
...
- We should never define a default nThread for MultithreadEventExecutorGroup because we don't know what a user do with it.
2013-04-03 17:15:25 +09:00
Trustin Lee
b7797917ab
Deprecate Bootstrap.shutdown() and use EventLoopGroup.shutdown() wherever possible
...
There are still some tests that use Bootstrap.shutdown() though. They need non-trivial refactoring, which will come soon.
2013-04-03 16:15:33 +09:00
Andrew Cox
3f8a830963
Fix DefaultChannelPipeline.first() so that it returns null when only the sentinel handlers remain (this is how DefaultChannelPipeline.last() works already)
2013-04-03 06:55:55 +02:00
Trustin Lee
0f3dc0409a
Log various properties at startup time for easier diagnosis
2013-04-03 11:44:30 +09:00
Norman Maurer
bcb0b83b44
Use unfoldAndAdd(..) for now
2013-04-02 13:58:15 +02:00
George Cao
436380c41e
Fix Javadoc issues. Replace Upstream with Inbound and Downstream with Outbound.
2013-04-02 15:13:39 +09:00
Norman Maurer
96bf71e814
Let EventExecutorGroup extend ScheduledExecutorService as it shares quite some semantic
2013-04-01 13:56:46 +02:00
Prajwal Tuladhar
05850da863
enable checkstyle for test source directory and fix checkstyle errors
2013-03-30 13:18:57 +01:00
Adam Vandenberg
8e23ab6886
Fix typo in BufType javadoc
2013-03-29 21:47:55 +09:00
Norman Maurer
59012390f6
Fix version numbering
2013-03-25 08:01:11 +01:00
Norman Maurer
7d7b676eeb
[maven-release-plugin] prepare for next development iteration
2013-03-22 15:20:35 +01:00
Norman Maurer
60fc7dac4d
[maven-release-plugin] prepare release netty-4.0.0.CR1
2013-03-22 15:20:11 +01:00
Trustin Lee
19ffdd5c29
Revamp the selector auto rebuild checker
...
- Count the number of select() calls made to wait until reaching at the expected dead line, and rebuild selectors if too many select() calls were made.
2013-03-22 14:33:47 +09:00
Trustin Lee
69e5a0eb9c
Log prematurly returning select() at DEBUG level and increase the minimum required consecutive premature returns to log
2013-03-22 12:59:47 +09:00
Trustin Lee
d525295d20
Revert NioEventLoop.hasTasks() which is not really true
2013-03-22 12:46:31 +09:00
Trustin Lee
34853e7ba0
Selector auto-rebuilder tweaks
2013-03-22 12:37:11 +09:00
Trustin Lee
f6e0df125a
Allow disabling automatic selector rebuilding by specifing non-positive threshold
2013-03-22 11:50:53 +09:00
Trustin Lee
1ab2813405
Enable automatic selector rebuilding by default
...
- Fixes #1192
- Log at WARN level for easier diagnosis
2013-03-22 11:48:41 +09:00
Trustin Lee
fa02ffddae
Remove TaskScheduler and ImmediateEventExecutor that requires TaskScheduler
...
- Related issue: #817
2013-03-22 09:06:08 +09:00
Trustin Lee
4097dee49d
Make SingleThreadEventExecutor independent from TaskScheduler
...
- Related issue: #817
2013-03-22 09:00:38 +09:00
Trustin Lee
8fb80e9179
Fix a dead lock in ServerBootstrap as described in #1175
...
- Reduce code duplication between bootstrap implementations
2013-03-21 21:34:13 +09:00
Trustin Lee
9b208028ef
Use clearer term when data is discarded by pipeline
2013-03-21 20:22:25 +09:00
Trustin Lee
a8723412dd
Fix checkstyle
2013-03-21 19:51:11 +09:00
Norman Maurer
f858a2fe62
Fix multiple calls to fireChannelActive() when using AIO
2013-03-21 11:49:58 +01:00
Trustin Lee
4fa7e85493
Make sure ChannelFuture of Bootstrap.bind() and connect() notify with the right cause when registration fails
...
- Related: #1175
2013-03-21 19:41:38 +09:00
Norman Maurer
b6dd5938ab
No need to do any deadlock check here
2013-03-21 11:24:26 +01:00
Trustin Lee
c08919d0a0
Fix the dead lock described in #1175
...
- Similar to @normanmaurer's fix in that this commit also makes Bootstrap.init(Channel) asynchronous, but it is simpler and less invasive.
- Also made sure a connection attempt failure in the local transport does not trigger an exceptionCaught event
2013-03-21 19:19:14 +09:00
Trustin Lee
bd8d53eaed
Fix checkstyle
2013-03-21 19:02:34 +09:00
Trustin Lee
2aa0bf73dc
Add a unit test that reproduces the dead lock described in #1175
...
- The offending test case is annotated with `@Ignore`
- Also fixed a bug where channel initialization failure swallows the original cause of initialization failure
2013-03-21 18:43:03 +09:00
Trustin Lee
a980638190
Ensure the best effort is made even if future listeners could not be notified / Handle registration failure in a robust manner
...
- Related: #1187
2013-03-21 17:48:10 +09:00
Trustin Lee
8b722d29a7
Add constructor parameters that do not perform type parameter auto-detection for the languages without type parameters
...
- Fixes #1177
- Add TypeParameterMatcher.get(parameterType)
- Add alternative constructors
2013-03-21 16:11:47 +09:00
Norman Maurer
2b014ce82a
[ #1183 ] Fix BlockingOperationException in ChannelGroup.close().awaitUninterruptibly()
2013-03-20 18:28:55 +01:00
Norman Maurer
ce87b627be
Let EventExecutor return our Future to allow the user to work also with FutureListener here. Also add a special ScheduledFuture that extends our Future for this purpose.
2013-03-19 10:45:42 +01:00
Michael Nitschinger
5a88227856
Transport: Clarifying the role of AbstractBootstrap#bind()
...
This small changeset clarifies the role of AbstractBootstrap#bind(),
especially when not used in a ServerBoostrap context.
2013-03-18 17:58:46 +09:00
Trustin Lee
f4c18c6e74
Fix a bug where NioEventLoop.processSelectedKeys() enters an infinite loop when too many connections are closed at once
...
- Fixes #1171
2013-03-18 15:01:19 +09:00
Jeff Pinner
7498e0f913
make deregister protected in ThreadPerChannelEventLoop
2013-03-17 20:11:33 +01:00
Trustin Lee
2a87950784
[maven-release-plugin] prepare for next development iteration
2013-03-16 18:41:36 +09:00
Trustin Lee
adfb29330b
[maven-release-plugin] prepare release netty-4.0.0.Beta3
2013-03-16 18:40:59 +09:00
ursa
835a40fa25
Port test for handler's life-cycle processing into master branch.
2013-03-14 11:10:02 +01:00
Trustin Lee
70a51bcd8d
Fix memory leak in AbstractEmbeddedChannel
...
- Allow a transport implementation to perform an arbitrary task when a channel has been deregistered completely
2013-03-14 15:51:33 +09:00
Trustin Lee
9c96791176
Move the methods that's only used by DefaultChannelPipeline to DefaultChannelPipeline
2013-03-14 15:01:35 +09:00
Trustin Lee
d55567e21b
Remove DefaultChannelHandlerContext.needsLazyBufInit which is used only by the head handler
2013-03-14 14:35:56 +09:00
Trustin Lee
f1ecb4ab1a
Remove ChannelHandlerContext.types() which is barely useful / Remove ChannelHandlerType together
2013-03-14 14:14:04 +09:00
Trustin Lee
9feb27d58c
Specify timeout on Selector.select()
2013-03-14 08:54:33 +09:00
Trustin Lee
644d5abbda
Add an empty line
2013-03-14 06:54:57 +09:00
Trustin Lee
8dcb1387e3
Add I/O ratio parameter to NioEventLoop
...
- Add SingleThreadEventExecutor.runAllTasks(timeout)
- Add NioEventLoop.ioRatio property
- Merge SelectorUtil into NioEventLoop
2013-03-14 06:49:08 +09:00
Norman Maurer
fe66f33f42
Fix issue where the bytes/messages are forwarded to the wrong handler
2013-03-12 08:37:27 +01:00
Norman Maurer
17ebbdec20
Let ChannelGroupFuture extends ChannelFuture and ChannelGroupFutureListener GenericFutureListener
2013-03-12 08:35:39 +01:00
Norman Maurer
f2a35273e6
Fix checkstype
2013-03-12 08:35:24 +01:00
Trustin Lee
397830d238
Allow SingleOutboundMessageHandler.beginFlush() to reject the flush request by returning false / Replace PartialFlushException with IncompleteFlushException which is more correct.
2013-03-12 15:20:46 +09:00
Trustin Lee
83cdbeca1d
Add ThreadPerChannelEventLoopGroup and ThreadPerChannelEventLoop to enable a user to write a new thread-per-channel transport easily
...
- Fixes #1124
2013-03-12 14:50:38 +09:00
Norman Maurer
2406a9f8b8
Use LinkedHashSet
2013-03-11 06:38:39 +01:00
Norman Maurer
806e9b1f8c
Make sure we handle outbound messages of type ByteBuf special
2013-03-11 08:59:00 +09:00
Norman Maurer
0a1bc86569
Javadocs cleanup / added
2013-03-10 21:07:19 +01:00
Norman Maurer
0504a442ae
Check for NPE and also optimze HashSet allocation
2013-03-10 21:06:59 +01:00
Norman Maurer
fcd6becad9
[ #1136 ] Fix possible IllegalBufferAccessException when remove itself from the pipeline
2013-03-08 21:55:46 +01:00
Norman Maurer
7b4c83b462
[ #1135 ] Fix endless loop which will get triggered when an exception is thrown during freeHandlerBuffersAfterRemoval
2013-03-08 21:41:59 +01:00
Norman Maurer
fd3f923b52
Allow to specify the used buffer type for ChannelInboundByteBufHandler and ChannelOutboundByteBufHandler by configuration. As default it tries to use a direct ByteBuf
2013-03-08 08:20:46 +01:00
Trustin Lee
a9a29bdf3f
Use I/O buffer whenever possible now that our direct buffers are as fast as heap buffers
2013-03-08 11:21:08 +09:00
Trustin Lee
16f4de7adb
Use the original stack trace when translating SocketTimeoutException to ConnectTimeoutException
2013-03-08 08:40:28 +09:00
Norman Maurer
61d6c48365
[ #1036 ] Add special ConnectTimeoutException which is thrown if a connection failed because of a timeout
2013-03-07 20:53:45 +01:00
Norman Maurer
9599bfd569
Fix class-cast exception which is a regression introduces in 256c931db2
2013-03-07 11:11:37 +01:00
Trustin Lee
526dafca75
Fix checkstyle
2013-03-07 16:13:44 +09:00
Norman Maurer
88cc8c1739
[ #1065 ] Provide Future/Promise without channel reference
2013-03-07 07:21:37 +01:00
Trustin Lee
148abe52f9
Reduce the amount of memory used for handler names
...
- Fixes #1123
2013-03-07 12:43:16 +09:00
Trustin Lee
1c1570ffc4
Make field access via ByteBuf.read/write*() faster by avoiding unnecessary boundary checks
...
- also disabled a time consuming test that is actually a regression test
2013-03-06 10:32:29 +09:00
Trustin Lee
6e5bb87219
Re-enable some critical tests
2013-03-05 18:42:34 +09:00
Trustin Lee
a8a7c4f576
Provide a way to implement an ChannelInbound/OutboundMessageHandler conveniently without extending an adapter class
...
- Add ChannelHandlerUtil and move the core logic of ChannelInbound/OutboundMessageHandler to ChannelHandlerUtil
- Add ChannelHandlerUtil.SingleInbound/OutboundMessageHandler and make ChannelInbound/OutboundMessageHandlerAdapter implement them. This is a backward incompatible change because it forces all handler methods to be public (was protected previously)
- Fixes : #1119
2013-03-05 17:27:53 +09:00
Norman Maurer
256c931db2
Move exceptionCaught(..) back to ChannelHandler. Related to [ #1118 ]
2013-03-05 07:34:34 +01:00
Trustin Lee
e4aa941bd4
Simplify ChannelInboundMessageHandlerAdapter.inboundBufferUpdated() implementation
2013-03-05 12:22:57 +09:00
Trustin Lee
0e3825899a
Move DefaultChannelPipeline.notifyHandlerException() to DefaultChannelHandlerContext / Always trigger exceptionCaught() at the handler that raised an exception
...
- Related: #1118
2013-03-05 12:13:14 +09:00
Norman Maurer
1603d9792d
Move methods from ChannelHandler to ChannelStateHandler like proposed in [ #1107 ]
2013-03-04 07:28:10 +01:00
Norman Maurer
3ac78b030a
Improve javadocs
2013-03-01 22:30:45 +01:00
Norman Maurer
03525f4b64
Fix javadocs
2013-03-01 21:42:08 +01:00
Norman Maurer
cb202da832
[ #1036 ] Use SocketTimeoutException when a connection timeout is detected to make it easier to detect timeout vs refused
2013-02-27 10:19:26 +01:00
Norman Maurer
dc4c4ab6b9
[ #1094 ] Fix possible StackOverFlowError when send FileRegions via the AioSocketChannel
2013-02-27 07:52:42 +01:00
Norman Maurer
71f25d13e2
[ #1095 ] Fix AioCompletionHandler stackoverflow detection to executed callback methods in all cases
2013-02-27 07:52:01 +01:00
Trustin Lee
49aa907bd0
[maven-release-plugin] prepare for next development iteration
2013-02-26 16:55:07 -08:00
Trustin Lee
5026c2f359
[maven-release-plugin] prepare release netty-4.0.0.Beta2
2013-02-26 16:54:53 -08:00
Trustin Lee
671f9d48d4
Use ConcurrentHashMapV8 wherever possible
...
- Fixes #1052
2013-02-26 15:54:51 -08:00
Trustin Lee
f67441354a
Move logging classes from internal to internal.logging
...
.. because internal is crowded
2013-02-26 14:54:25 -08:00
Trustin Lee
334b6c3129
Reduce the memory footprint of DefaultChannelPromise even more (part 2)
...
- Rewirte DefaultChannelFutureListeners - this saves another int field when there are more then one listener.
2013-02-26 14:43:12 -08:00
Trustin Lee
d8f5521210
Reduce the memory footprint of DefaultChannelPromise even more
...
- Merge waiters and fluchCheckpoint into a single field
- This limits the number of waiter threads to 2^24 - 1, which is still very large. Can you imagine an application with 16 million threads?
2013-02-26 13:52:49 -08:00
Trustin Lee
98192d7c01
Simplify DefaultChannelPromise
...
- Merge success0() and failure0() into set()
- Remove unnecessary local variable
2013-02-26 13:05:58 -08:00
Trustin Lee
709f2dfb33
Add comment about why we need to count the depth of the stack in AioCompletionHandler
2013-02-26 11:28:49 -08:00
Trustin Lee
0317baa10d
Fix regression in AioCompletionHandler that leads to StackOverflowError
2013-02-26 10:19:59 -08:00
Trustin Lee
434610b18c
Tell what the remote address was when ConnectException occurs.
...
- Fixes #1082
2013-02-22 13:45:17 -08:00
Norman Maurer
12b392b4cc
Revert "[ #1058 ] Add Channel/ChannelHandlerContext/ChannelPipeline.isWritable()"
...
This reverts commit 4e36fbca58
.
2013-02-22 14:42:32 +01:00
Norman Maurer
03b7b2d297
Revert "[ #1058 ] Fix incorrect logic to detect if ChannelHandlerContext is writable"
...
This reverts commit 3acb22c38c
.
2013-02-22 14:41:05 +01:00
Norman Maurer
fada776756
Refactor the aio transport to not depend on the AioChannelFinder and so not need for refelection
2013-02-22 06:53:33 +01:00
Trustin Lee
273948055a
Fix #1075 : DefaultChannelHandlerContext.fireChannelSuspended and fireInboundBufferUpdated do not work correctly if handlers with EventExecutor are added or removed from pipeline.
2013-02-21 17:16:05 -08:00
Trustin Lee
08e2914cef
Do not keep Runnables for the events that are triggered only once in most cases
2013-02-21 15:58:15 -08:00
Trustin Lee
dfbe4e48ae
Remove cruft
2013-02-21 15:53:50 -08:00
Trustin Lee
0f46d4b379
Revert 25c7a783a7
and fix #1064 differently
...
- Rename inbound/outboundBufferFreed to inbound/OutboundShutdown which makes more sense
- Move DefaultChannelHandlerContext.isInbound/OutboundBufferFreed() to DefaultChannelPipeline
- Fix a problem where invokeFreeInbound/OutboundBuffer() sets inbound/outboundShutdown too early (this was the direct cause of #1064 )
- Remove the volatile modifier - DCHC.prev/next are volatile and that's just enough
2013-02-21 15:19:42 -08:00
Norman Maurer
3acb22c38c
[ #1058 ] Fix incorrect logic to detect if ChannelHandlerContext is writable
2013-02-21 15:55:04 +01:00
Norman Maurer
25c7a783a7
Fix unneccessary use of EventLoop.execute(..) which gives some nice perf boost and also fix [ #1064 ] as we had a race
2013-02-21 15:53:04 +01:00
Norman Maurer
5bda3a25b0
add more debug info about discarded message
2013-02-19 19:08:04 +01:00
Norman Maurer
4e36fbca58
[ #1058 ] Add Channel/ChannelHandlerContext/ChannelPipeline.isWritable()
2013-02-17 21:13:03 +01:00
Trustin Lee
60ee9460a9
Outbound bridge is flushed only when its handler also implements ChannelInboundHandler
...
- Fixes #1056
2013-02-15 16:24:59 -08:00
Trustin Lee
189c2785c0
ByteBridge.flush() does not flush anything if the target buffer is not writable but expandable
...
- Fixes #1055
- fire inboundBufferUpdated() again if the bridge was not flushed completely.
2013-02-15 15:50:12 -08:00
Trustin Lee
dc43c2d8a9
ByteBridge.flush() does not flush anything if the target buffer is not writable but expandable
...
- Fixes #1055
2013-02-15 15:00:41 -08:00
Trustin Lee
d68a04a879
[maven-release-plugin] prepare for next development iteration
2013-02-14 12:56:24 -08:00
Trustin Lee
59e638f8f5
[maven-release-plugin] prepare release netty-4.0.0.Beta1
2013-02-14 12:56:15 -08:00
Trustin Lee
1011227b88
Remove apiviz tags - we are focusing on user guide instead and putting diagrams there
2013-02-14 12:09:16 -08:00
Trustin Lee
7b0bf2da7e
Use double-checked locking idiom + volatile optimization
2013-02-13 23:19:01 -08:00
Trustin Lee
4eff91df99
Fix a bug where DefaultChannelPromise.failure0() always returns false / Revert a bad commit
2013-02-13 22:53:10 -08:00
Norman Maurer
5370573400
Change ReferenceCounted.retain* to return itself and so allow method chaining
2013-02-14 07:39:44 +01:00
Trustin Lee
53c27ef5ae
More robust type parameter detection
...
- Also removed unnecessary constructors which were added due to incomplete type parameter detection logic
2013-02-13 19:02:55 -08:00
Trustin Lee
d0a3c2d95e
Reduce the memory footprint of DefaultChannelPromise
2013-02-13 16:38:20 -08:00
Trustin Lee
e2c948782b
Fix a problem where flush future is set more than once
2013-02-13 16:36:53 -08:00
Trustin Lee
6fe6456f8d
Fix indentation
2013-02-13 15:33:09 -08:00
Trustin Lee
7cefd10d9f
Fill/flush bridges only when necessary
2013-02-13 15:32:35 -08:00
Trustin Lee
87efff0bca
DefaultChannelHandlerContext.removed doesn't need to be volatile
2013-02-13 15:17:10 -08:00
Trustin Lee
dc8ae16e61
Make inByte/MsgBuf final
2013-02-13 15:16:40 -08:00
Trustin Lee
a3cb3651d0
Use promise.isDone() instead of additional flag / Remove printStackTrace
2013-02-13 14:44:59 -08:00
Norman Maurer
7cf7d7455d
[ #1048 ] Make sure the promise is not notified multiple times on failure
2013-02-12 20:46:39 +01:00
Norman Maurer
17e37fdfe6
[ #1047 ] Not process with flush on failure
2013-02-12 20:34:59 +01:00
Norman Maurer
30bcc72b44
[ #1038 ] Remove ChannelHandlerContext.replace*Buffer() methods
2013-02-11 14:16:45 +01:00
Trustin Lee
b4f4b95739
Move io.netty.logging to io.netty.internal / Move Signal out of internal because we use it in Channel*MessageAdapters
2013-02-11 20:08:18 +09:00
Roman Stoffel
5f89195247
Fixing generic <> in documentation to display properly
2013-02-11 19:54:32 +09:00
Trustin Lee
4aacf50758
Prettify APIviz diagrams / Remove an empty package
2013-02-11 18:33:15 +09:00
Norman Maurer
f98da73612
Allow for method chaining
2013-02-11 09:44:04 +01:00
Norman Maurer
707f910d2b
Make Channel*Invoker package private
2013-02-11 09:31:01 +01:00
Trustin Lee
bf0bfe9a69
Fix inspector warnings
2013-02-11 16:52:43 +09:00
Norman Maurer
a22725d9fa
Let ChannelPromiseAggregator take a vararg of ChannelPromises and rename method
2013-02-11 07:33:22 +01:00
Norman Maurer
df53d6d7c5
Tighten up visibility
2013-02-11 07:29:13 +01:00
Norman Maurer
9228c97546
Tighten up visibility
2013-02-11 07:27:05 +01:00
Norman Maurer
0e47fb50e2
Tighten up visibility
2013-02-11 07:26:10 +01:00
Norman Maurer
7e95be0295
Support method chaining in ChannelFlushPromiseNotifier
2013-02-11 07:22:12 +01:00
Norman Maurer
ba71e3dcd0
Don'T call ChannelPipeline.fireExceptionCaught(..) for outbound events
2013-02-11 07:19:40 +01:00
Trustin Lee
0e341c9d72
Fix covariant return types in ChannelConfig interfaces for method chaining
...
- Does it really worth doing this? I'm tempted to remove support for method chaining for ChannelConfig.
2013-02-11 15:08:51 +09:00
Trustin Lee
dea1fde604
Self-referential type parameter fix
2013-02-11 14:42:29 +09:00
Trustin Lee
a7b5d45bdf
A little bit of optimization that reduces interestOps() calls
2013-02-11 10:39:50 +09:00
Norman Maurer
565e10e0db
Only update interestedOps if needed
2013-02-10 20:42:40 +01:00
Norman Maurer
775856b3db
Use the same buffer type in ByteBridge as the context
2013-02-10 17:19:43 +01:00
Norman Maurer
e3b8f4dea8
Make sure all resources of a ByteBridge and MessageBridge are released
2013-02-10 17:12:37 +01:00
Norman Maurer
547d4c20b0
Fix javadocs
2013-02-10 14:40:17 +01:00
Norman Maurer
657f16bf2b
Add ChannelGroup.deregister()
2013-02-10 14:40:03 +01:00
Norman Maurer
33c94a98a3
Let FileRegion extend ReferenceCounted and add ChannelGroup.flush() , ChannelGroup.sendFile(..)
2013-02-10 14:25:53 +01:00
Trustin Lee
4f6d05365a
Fix a race condition in reference counter implementation / Reference count never goes below 0
2013-02-10 14:22:14 +09:00
Trustin Lee
bd0729ac45
Make ChannelGroup.write(..) retain the message
2013-02-10 14:02:43 +09:00
Trustin Lee
2f1a0b0593
Remove freeInbound/OutboundMessage(), replaced by ReferenceCounted.retain/release()
...
- Related: #1029
2013-02-10 13:31:31 +09:00
Trustin Lee
b9996908b1
Implement reference counting
...
- Related: #1029
- Replace Freeable with ReferenceCounted
- Add AbstractReferenceCounted
- Add AbstractReferenceCountedByteBuf
- Add AbstractDerivedByteBuf
- Add EmptyByteBuf
2013-02-10 13:10:09 +09:00
Trustin Lee
61bbb04852
Fix a bug in AbstractEmbeddedChannel where flush failure is not recorded
2013-02-10 00:46:30 +09:00
Trustin Lee
51daf2a6a2
Add ABORT signal to Channel*MessageHandlerAdapter
...
- Related: #1030
2013-02-09 20:11:16 +09:00
Trustin Lee
139b1b8382
Add begin/endFlush() and closeOnFailedFlush to ChannelOutboundMessageHandlerAdapter / Make ChannelInboundMessageHandlerAdapter stop processing on first exception to avoid excessive exceptionCaught() events against pipelined messages.
2013-02-09 17:31:20 +09:00
Trustin Lee
e424a2f4b3
Move flushTaskInProgress to AbstractUnsafe
...
.. because it's referenced only there. Also did tiny optimizations.
2013-02-09 01:27:54 +09:00
Trustin Lee
a4c66dc282
Reduce the number of unnecessary Selector.wakeup() / Fix a bug where channelReadSuspended() generates garbage
2013-02-09 01:05:33 +09:00
Trustin Lee
affd514b8c
Rename ByteBufUtil to BufUtil and move ChannelHandlerUtil.freeMessage() there / Remove ChannelHandlerUtil
2013-02-08 23:23:26 +09:00
Trustin Lee
0746199ca4
Remove unreachable code
2013-02-08 23:16:54 +09:00
Trustin Lee
44ea0a116f
Replace ChannelHandlerUtil.unfoldAndAdd() with MessageBuf.unfoldAndAdd() / Remove unused methods in ChannelHandlerUtil
2013-02-08 23:07:20 +09:00
Norman Maurer
a3b46ec9d7
Fix a bug where a closed channel was tried to register with the eventloop
2013-02-08 11:31:48 +01:00
Trustin Lee
ff5aec0c78
Replace TypeParameterFinder with TypeParameterMatcher
...
- We can avoid reflective matching using byte code generation.
- Better matching performance when message type is Object
2013-02-08 18:28:06 +09:00
Trustin Lee
b4eaedf712
Remove confusing ChannelState/OperationHandlerAdapter.inboundBufferUpdated/flush() implementation
2013-02-08 17:17:39 +09:00
Trustin Lee
76eb40a4d2
Make ChannelOutboundMessageHandlerAdapter similar to ChannelInboundMessageHandlerAdapter
2013-02-08 17:07:01 +09:00
Trustin Lee
71136390f1
Extract type parameter finder code to a utility class
2013-02-08 15:57:23 +09:00
Norman Maurer
1033bec4cd
AbstractBootstrap.validate() should return reference to itself
2013-02-08 07:52:35 +01:00
Trustin Lee
fa1b49de98
More robust automatic messageType detection for ChannelInboundMessageHandlerAdapter and MessageToMessageDecoder
2013-02-08 15:45:17 +09:00
Norman Maurer
38ee575839
Let ChannelGroupFuture.addListener(..) return itself to make consistent with ChannelFuture
2013-02-08 07:41:24 +01:00
Norman Maurer
539418ecac
Let ChannelPipeline.set* methods return itself to be more consistent with the reset
2013-02-08 07:24:55 +01:00
Norman Maurer
32e0b59761
Let ChannelPipeline implement Iterable
2013-02-08 07:10:46 +01:00
Trustin Lee
e5616c85c4
Automatic messageType detection for ChannelInboundMessageHandlerAdapter
2013-02-08 13:48:47 +09:00
Trustin Lee
df65b93032
Use Message<Object> instead of Message<I>
2013-02-08 13:05:27 +09:00
Trustin Lee
ac72c3512e
Ensure ChannelInboundMessageHandlerAdapter.endMessageReceived() is always called after handling the inbound message queue. / Call fireInboundBufferUpdated() automatically if the next inbound message buffer was changed.
2013-02-08 13:03:45 +09:00
Trustin Lee
9319e3ebd0
Fix SocketShutdownOutputByPeerTest failure
...
- With half-close enabled, the selector loop was spinning due to uncleared OP_READ flag.
- Added some delay to the test for more reliable failure
2013-02-08 01:50:44 +09:00
Trustin Lee
d8c0bf3be2
Add the 'nextBufferType' parameter to ByteArrayEncoder like did to StringEncoder / Consistent parameter order
2013-02-08 01:36:41 +09:00
Trustin Lee
b8c0751023
Fix a regression where writing a ByteBuf are discarded
2013-02-08 00:41:35 +09:00
Trustin Lee
30e80f8c5c
Fix a regression in ChannelInboundMessageHandlerAdapter
...
- Should forward the unsupported message to the next inbound buffer rather than the next outbound buffer.
2013-02-08 00:08:39 +09:00
Trustin Lee
ec51b359c9
Fix checkstyle again
2013-02-08 00:00:14 +09:00
Trustin Lee
9aa9d8a99b
Fix checkstyle
...
- Basically a workaround for IntelliJ's automatic import optimization
2013-02-07 23:58:21 +09:00
Trustin Lee
d4742bbe16
Clean up abstract ChannelHandler impls / Remove ChannelHandlerContext.hasNext*()
...
- Rename ChannelHandlerAdapter to ChannelDuplexHandler
- Add ChannelHandlerAdapter that implements only ChannelHandler
- Rename CombinedChannelHandler to CombinedChannelDuplexHandler and
improve runtime validation
- Remove ChannelInbound/OutboundHandlerAdapter which are not useful
- Make ChannelOutboundByteHandlerAdapter similar to
ChannelInboundByteHandlerAdapter
- Make the tail and head handler of DefaultChannelPipeline accept both
bytes and messages. ChannelHandlerContext.hasNext*() were removed
because they always return true now.
- Removed various unnecessary null checks.
- Correct method/field names:
inboundBufferSuspended -> channelReadSuspended
2013-02-07 23:47:45 +09:00
Norman Maurer
a13246a2b6
[ #1024 ] Limit the number of SelectionKey.interestedOps(..) calls for performance reasons
2013-02-07 15:34:38 +01:00
Norman Maurer
fd75615d7a
[ #870 ] Convert all modules into osgi bundles
2013-02-06 07:57:11 +01:00
Norman Maurer
46bedb8151
Add javadocs to make contract more clear
2013-02-05 20:29:38 +01:00
Norman Maurer
86b4cde82f
Make sure the inbound/outbound buffer of the ChannelHandlerContext is only modified within the EventLoop
2013-02-05 16:19:04 +01:00
Trustin Lee
2e44a1ba91
Fix test failures in SingleThreadEventLoopTest on Windows
...
- It seems like Windows sometimes sleeps less than specified.
- Related issue: #726
2013-02-05 16:27:37 +09:00
Norman Maurer
ade3cc1329
Move non socket specific stuff out of the socket package
2013-02-01 09:10:28 +01:00
Trustin Lee
2ec932798f
Replace .readable() and .writable() to .isReadable() and .isWritable()
2013-01-31 18:24:33 +01:00
Trustin Lee
42c65cca3a
Make MessageBuf bounded
...
- Move common methods from ByteBuf to Buf
- Rename ensureWritableBytes() to ensureWritable()
- Rename readable() to isReadable()
- Rename writable() to isWritable()
- Add isReadable(int) and isWritable(int)
- Add AbstractMessageBuf
- Rewrite DefaultMessageBuf and QueueBackedMessageBuf
- based on Josh Bloch's public domain ArrayDeque impl
2013-01-31 18:11:06 +01:00
Norman Maurer
ec013bf2d3
[ #983 ] Force the user to implement an actual ChannelInboundHandler or ChannelOutboundHandler
...
For this ChannelInboundHandler* and ChannelOutboundHandler* was made package private
2013-01-31 15:50:27 +01:00
Trustin Lee
39357f3835
Enable TCP_NODELAY and SCTP_NODELAY by default
...
- Fixes #939
- Add PlatformDependent.canEnableTcpNoDelayByDefault()
- Currently returns false on Android. Will change if necessary later.
2013-01-31 12:17:09 +09:00
Trustin Lee
152c969eab
Make Bootstrap and ServerBootstrap thread-safe
...
- Additional fix for: #970
- Use LinkedHashMap again to save memory consumption
- ServerBootstrap now makes a copy of child parameters so that modifying ServerBootstrap after bind() does not affect the already-bound servers. This also makes child channel initialization potentially faster due to reduced garbage iterator.
2013-01-31 11:34:28 +09:00
Norman Maurer
eeab6767db
Tighten up generics on ServerBootstrap again as it was fixed in UDT
2013-01-30 21:38:15 +01:00
Trustin Lee
33c9f3f1e5
Relax ServerBootstrap type constraint to support UDT properly
2013-01-30 22:04:20 +09:00
Trustin Lee
05d16cd361
Made Bootstrap and ServerBootstrap copy constructors private as suggested
2013-01-30 21:55:10 +09:00
Trustin Lee
b1b0319bbe
Fix build errors and warnings
2013-01-30 21:47:34 +09:00
Norman Maurer
1bb003d9ae
[ #995 ] Replace AtomicReference usage with AtomicReferenceFieldUpdater
...
This will safe as an example 2gb mem when have 10 DefaultHandlerContext instances per connection and the connection count is 1000000.
Also kind of related to [#920 ]
2013-01-30 13:45:39 +01:00
Trustin Lee
23438de66f
Move AbstractBootstrap.ChannelFactory out of AbstractBootstrap and hide AbstractBootstrap from a user
...
- Fixes #998
- Also generified ChannelFactory
2013-01-30 21:40:49 +09:00
Trustin Lee
86135a4080
Make ServerBootstrap final
...
- Related: #997
2013-01-30 21:14:23 +09:00
Trustin Lee
7c50c1e2e6
Make Bootstrap and ServerBootstrap implement Cloneable and rename duplicate() to clone()
...
- Fixes #997
- Replace duplicate() with clone()
- Add copy constructor for simplicity
- Can now clone invalid/incomplete bootstrap
- Upgrade to netty-build-14 to disable SuperClone checkstyle module
- Finalize class hierarchy so no subclasses are introduced
2013-01-30 21:12:42 +09:00
Trustin Lee
64e6c4021d
Use the clearer parameter names that indicate the address is for Internet connections
2013-01-30 20:14:59 +09:00
Trustin Lee
788d7e9b8b
Remove Bootstrap operations that require a promise and add various ad-hoc bind() and connect() operations
...
- Update examples to use the newly added bind() and connect()
operations.
2013-01-30 20:11:00 +09:00
Norman Maurer
a54217053f
[ #988 ] Fix typo
2013-01-28 11:26:53 +01:00
Norman Maurer
d7bfd44e10
[ #982 ] [ #977 ] [ #858 ] Allow to transfer the content a ChannelHandlers inbound/outbound buffer on removal/replacement
...
This changes the behavior of the ChannelPipeline.remove(..) and ChannelPipeline.replace(..) methods in that way
that after invocation it is not possible anymore to access any data in the inbound or outbound buffer. This is
because it empty it now to prevent side-effects. If a user want to preserve the content and forward it to the
next handler in the pipeline it is adviced to use one of the new methods which where introduced.
- ChannelPipeline.removeAndForward(..)
- ChannelPipeline.replaceAndForward(..)
2013-01-28 10:25:38 +01:00
Norman Maurer
a27d1cc365
[ #986 ] DefaultChannelHandlerContext.fireUserEventTriggered(...) uses correct ChannelHandlerContext now
2013-01-26 16:47:00 +01:00
Norman Maurer
cc278d45c2
Disable test as this let fail the build 80% times on osx and slow linux servers. Need to investigate
2013-01-26 16:17:12 +01:00
Norman Maurer
b9aaf9a167
[ #977 ] Stop processing messages/bytes in a loop when the handler was removed from the ChannelPipeline
2013-01-23 07:35:44 +01:00
Norman Maurer
3f72add89a
[ #976 ] Fix exception which will be raised by ChannelInboundHandler.discardInboundReadBytes() and ChannelOutboundHandler.discardOutboundReadBytes() if the handler remove it self from the pipeline
2013-01-23 07:27:00 +01:00
Norman Maurer
a25f7fa2e5
Revert "[ #972 ] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed"
...
This reverts commit 4ac3bace0f
.
2013-01-23 06:45:44 +01:00
Norman Maurer
4ac3bace0f
[ #972 ] Correctly mark the ChannelPipeline once a ChannelHandler was removed and because of this a buffer was freed
2013-01-22 21:18:13 +01:00
Brian Roach
54af70f067
Bootstrap thread safety
...
Changed options and attrs from LinkedHashMap to ConcurrentHashMap to
avoid a possible ConcurrentModificationException if a thread was
adding/removing options/attrs while another was calling Bootstrap.init()
or Bootstrap.duplicate()
2013-01-22 07:06:02 +01:00
Norman Maurer
4192222b38
Rname StreamOioByteChannel to OioByteStreamChannel
2013-01-21 12:10:07 +01:00
Norman Maurer
7316a3c65c
[ #965 ] Allow to adjust the SO_TIMEOUT on the fly
2013-01-21 11:48:05 +01:00
Norman Maurer
082b5f0dff
[ #962 ] Read data as soon as it is present in OIO and not wait till it match Buffer.writableBytes()
...
- Also add a new abstract class called StreamOioByteChannel which can be used by OIO channel implementation which are Stream based as a starting point.
2013-01-21 10:14:21 +01:00
Norman Maurer
57e504a7e6
Add javadocs to the *ChannelConfig interfaces to make clear which ChannelOptions implementations are expect to support
2013-01-20 08:10:15 +01:00
Norman Maurer
76d7829d38
[ #960 ] Fix calculation of writerIndex() which was incorrect and so result in truncated DatagramPackets when using NIO
2013-01-19 17:22:28 +01:00
Norman Maurer
1295f6d331
Fix formatting
2013-01-19 16:52:12 +01:00
Norman Maurer
d8f0e3fdf7
Add missing udp option
2013-01-19 16:51:00 +01:00
Norman Maurer
4dd462d0b5
[ #907 ] Stop flush if one outboundbuffer was freed and do the same for inboundBufferUpdated if an inboundbuffer was freed
2013-01-18 07:08:11 +01:00
Trustin Lee
24acfe7008
Remove io.netty.monitor as discussed in #922
2013-01-18 11:08:57 +09:00
Trustin Lee
2c7be32393
Tiny optimization
2013-01-18 10:49:53 +09:00
Norman Maurer
16f729cd95
[ #907 ] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated() was called once the channel was closed
2013-01-17 20:41:08 +01:00
Norman Maurer
677886f470
[ #907 ] Prevent IllegalBufferAccessException which could be triggered if inboundBufferUpdated(), flush(..), write(..) was triggered after the channel was closed
2013-01-17 15:12:32 +01:00
Trustin Lee
4472fe9795
Remove 'get' prefix
2013-01-17 15:06:46 +09:00
Trustin Lee
f568aa42f0
Hide the constructors of ChannelOption to force using dedicated option type
2013-01-17 14:14:41 +09:00
Norman Maurer
f136eafd5e
[ #943 ] Fix CanceledKeyException which can happen on frequently deregister/register while using the NIO Transport
2013-01-16 15:27:27 +01:00
Norman Maurer
895bce6cd5
[ #917 ] Move transport depending ChannelOption to the specific transport to make it consistent
2013-01-16 08:04:09 +01:00
Trustin Lee
506474f569
Overhaul pipeline implementation for clarity and memory efficiency
...
This pull request cleans up our pipeline implementation by moving most
inter-context traversal code to DefaultChannelHandlerContext.
Previously, outbound traversal was done in DefaultChannelPipeline while
inbound traversal was done in DefaultChannelHandlerContext.
Also, to address the memory inefficiency issue raised in #920 , all
runnables are lazily instantiated.
2013-01-16 00:38:14 +09:00
Trustin Lee
573a723dc2
Fix a bug where ChannelPIpeline.remove/replace() fails when its channel is not registered yet
2013-01-14 21:50:08 +09:00
Trustin Lee
e263769a55
Fix a bug where the buffers are freed too early when a handler is removed or replaced
2013-01-14 21:43:45 +09:00
Trustin Lee
a03bc6ea1d
Fix a bug where freeInbound/OutboundBuffer() is not called when a handler is removed from a pipeline.
2013-01-14 20:54:12 +09:00
Norman Maurer
eb91a6d4e6
[ #924 ] [ #914 ] Fix high CPU usage which was caused because the OP_CONNECT flag was not cleared after the connect was complete
2013-01-11 19:42:21 +01:00
Trustin Lee
64ae8b6a37
Replace and merge DetectionUtil and DirectByteBufUtil into PlatformDependent and PlatformDependent0
...
PlatformDependent delegates the operations requires sun.misc.* to PlatformDependent0 to avoid runtime errors due to missing sun.misc.* classes.
2013-01-11 14:03:27 +09:00
Trustin Lee
8975406b86
Ensure the outbound buffer is not freed on write completion
...
- Fixes #919
2013-01-10 21:05:51 +09:00
Trustin Lee
665d022e82
Use a heap buffer from the allocator because it doesn't seem to cause OOME anymore
2013-01-10 16:23:40 +09:00
Trustin Lee
eb337ff5a7
Fix various inspection warnings
2013-01-10 15:23:58 +09:00
Trustin Lee
3c9d912355
Use InetSocketAddress wherever possible / Tighten the return type of Channel.parent()
2013-01-10 14:17:54 +09:00
Trustin Lee
793a571465
Fix a runtime type cast exception when calling RxtxChannel.local/remoteAddress()
2013-01-10 14:01:17 +09:00
Trustin Lee
137f29ba65
Do not read if a channel is inactive
2013-01-09 21:28:31 +09:00
Trustin Lee
46e364e7b7
Remove unnecessary parameters
2013-01-09 20:36:16 +09:00
Trustin Lee
b9352ded13
Fix a bug where prev/next context is not always set
2013-01-09 20:34:22 +09:00
Trustin Lee
8586d43b23
Fix DefaultChannelPipeline.toString() / Remove unnecessary conditions
2013-01-09 19:16:09 +09:00
Trustin Lee
b6fcf3acc4
Simplify DefaultChannelPipeline
2013-01-09 19:13:43 +09:00
Trustin Lee
dd6b7969b7
Give a handler more control over how its buffers' read bytes are discarded.
...
This pull request adds two new handler methods: discardInboundReadBytes(ctx) and discardOutboundReadBytes(ctx) to ChannelInboundByteHandler and ChannelOutboundByteHandler respectively. They are called between every inboundBufferUpdated() and flush() respectively. Their default implementation is to call discardSomeReadBytes() on their buffers and a user can override this behavior easily. For example, ReplayingDecoder.discardInboundReadBytes() looks like the following:
@Override
public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
ByteBuf in = ctx.inboundByteBuffer();
final int oldReaderIndex = in.readerIndex();
super.discardInboundReadBytes(ctx);
final int newReaderIndex = in.readerIndex();
checkpoint -= oldReaderIndex - newReaderIndex;
}
If a handler, which has its own buffer index variable, extends ReplayingDecoder or ByteToMessageDecoder, the handler can also override discardInboundReadBytes() and adjust its index variable accordingly.
2013-01-09 13:34:09 +09:00
Trustin Lee
7277536ca6
Remove unnecessary finally block
2013-01-09 13:30:25 +09:00
Norman Maurer
26595471fb
Call Freeable.free() if a Freeable message reaches the end of the ChannelPipeline to guard against resource leakage
2013-01-07 12:34:18 +01:00
Norman Maurer
5526153459
[ #882 ] Add a PartialFlushException which will allow to notify the user that the flush/write was only partial succesful
2013-01-05 20:30:48 +01:00
Courtney Robinson
3a52cc410a
Add some of the metrics mentioned in #718
...
use single static initialization of available metrics monitor registries
* This changes the original implementation to work in a similar way to
how slf4j selects and loads an implementation.
* Uses a single static instance so intialization is done only once.
* Doesn't throw IllegalStateException if multiple implementations are
found on the classpath. It instead selects and uses the first
implementation returned by iterator()
* Class left as an iterable to keep the API the same
add yammer metrics to examples to allow them to publish metrics
publish the number of threads used in an EventLoopGroup see issue #718
* seems like the better place to put this because it sets the default
thread count if the MultithreadEventLoopGroup uses super(0,...)
* It also happens to be the common parent class amongst all the
MultiThreadedEventLoopGroup implementations
* Count is reported for
io.netty.channel.{*,.local,.socket.aio,.socket.nio}
fix cosmetic issues pointed out in pull request and updated notice.txt
see https://github.com/netty/netty/pull/780
count # of channels registered in single threaded event loop
measure how many times Selector.select return before SELECT_TIME
2013-01-04 11:27:49 +01:00
Norman Maurer
2f6e17f681
Make sure we catch UnsupportedOperationException for derived buffers
2013-01-03 22:49:54 +01:00
Norman Maurer
ccb5409f58
[ #884 ] Split SCTP transport into extra module
2013-01-03 22:19:06 +01:00
Norman Maurer
37a3f2e3b8
[ #887 ] [ #866 ] [ #883 ] Add unified interface for Message oriented protocols and also use direct buffers for them
2013-01-03 18:15:53 +01:00
Trustin Lee
0abfaf20e4
Revert 5161ca733c
2013-01-03 17:05:18 +09:00
Trustin Lee
923dde7a5f
Do not auto-start read operation
2013-01-03 16:01:41 +09:00
Trustin Lee
103edc4467
Make ChannelConfig.setAutoRead() triggers Channel.read() if autoRead was previously false
...
- also rename JDK socket and channel variables so that they are less ambiguous
2013-01-01 16:49:21 +09:00
Norman Maurer
5161ca733c
Move utility method to abstract base class and correctly handle expand of buffer also for OIO
2012-12-31 22:09:27 +01:00
Trustin Lee
89a16fe01e
Fix a bug in NIO transport where inboundBufferSuspended() is triggered even if the channel is closed.
...
- No non-static wildcard import
2013-01-01 00:35:44 +09:00
Trustin Lee
93fd73fbbf
Fix a bug in AioSocketChannel where inboundBufferSuspended() is triggered even if the channel is closed.
2013-01-01 00:27:30 +09:00
Norman Maurer
8cf9f52919
Add new ChanelFuureListener impl that mimic the old behavior of Netty 3 and so allow to also call fireException for outbound operations
2012-12-31 16:17:08 +01:00
Trustin Lee
1e9652b47a
Fix a bug in AioSocketChannel where recursive doBeginRead() is allowed unexpectedly
2013-01-01 00:08:58 +09:00
Norman Maurer
e0a6dc0ac3
Remove ChannelFutureProgressListener
2012-12-31 23:27:37 +09:00
Norman Maurer
4e77bacdf7
[ #873 ] [ #868 ] Split ChannelFuture into ChannelFuture and ChannelPromise
2012-12-31 23:27:16 +09:00
Trustin Lee
0909878581
Read only when requested (read-on-demand)
...
This pull request introduces a new operation called read() that replaces the existing inbound traffic control method. EventLoop now performs socket reads only when the read() operation has been issued. Once the requested read() operation is actually performed, EventLoop triggers an inboundBufferSuspended event that tells the handlers that the requested read() operation has been performed and the inbound traffic has been suspended again. A handler can decide to continue reading or not.
Unlike other outbound operations, read() does not use ChannelFuture at all to avoid GC cost. If there's a good reason to create a new future per read at the GC cost, I'll change this.
This pull request consequently removes the readable property in ChannelHandlerContext, which means how the traffic control works changed significantly.
This pull request also adds a new configuration property ChannelOption.AUTO_READ whose default value is true. If true, Netty will call ctx.read() for you. If you need a close control over when read() is called, you can set it to false.
Another interesting fact is that non-terminal handlers do not really need to call read() at all. Only the last inbound handler will have to call it, and that's just enough. Actually, you don't even need to call it at the last handler in most cases because of the ChannelOption.AUTO_READ mentioned above.
There's no serious backward compatibility issue. If the compiler complains your handler does not implement the read() method, add the following:
public void read(ChannelHandlerContext ctx) throws Exception {
ctx.read();
}
Note that this pull request certainly makes bounded inbound buffer support very easy, but itself does not add the bounded inbound buffer support.
2012-12-31 23:26:00 +09:00
Norman Maurer
b49b3d9c56
[ #879 ] Notify correct ChannelFuture for queued FileRegions
2012-12-31 11:35:25 +01:00
Norman Maurer
c80b1bb66e
[ #872 ] AbstractNioByteChannel and AbstractNioMessageChannel should be public
2012-12-30 12:48:32 +01:00
Norman Maurer
0fb0037eab
Rename IpAddresses to NetUtil
2012-12-29 18:25:32 +01:00
Norman Maurer
5d13c7d27b
Merge IPUtil and NetworkConstants into IpAddresses and also make naming of methods consistent
2012-12-29 18:17:33 +01:00
Norman Maurer
e2b240799c
[ #857 ] Check if the SelectionKey is valid before access readyOps()
2012-12-29 18:07:02 +01:00
Norman Maurer
88838413c7
Javadocs and cleanup intellij warnings
2012-12-27 23:02:13 +01:00
Norman Maurer
a20aba87ab
Remove get prefix from Sctp methods to be more inline with the rest
2012-12-27 22:53:42 +01:00
Norman Maurer
6db7250ed9
Javadocs added for SCTP stuff
2012-12-27 22:46:46 +01:00
Norman Maurer
5a4a52a817
[ #857 ] Correctly handle CancelledKeyException
2012-12-27 22:24:07 +01:00
Norman Maurer
852f546b5b
[ #846 ] Tighten up visibility
2012-12-25 18:54:55 +01:00
Norman Maurer
a9fdb682be
Add javadocs and some small cleanups
2012-12-23 20:58:49 +01:00
Norman Maurer
71b089cb3b
Add javadocs and cleanup
2012-12-23 19:24:20 +01:00
Norman Maurer
ae859c2de9
Fix checkstyle
2012-12-23 19:24:05 +01:00
Norman Maurer
e0d42df77b
ServerBootstrap needs to have a localAddress defined
2012-12-23 16:05:43 +01:00
Norman Maurer
6ef1729d06
Fix javadocs for ChannelPipeline
2012-12-23 15:54:30 +01:00
Norman Maurer
7d79587ade
Make package private
2012-12-23 15:54:14 +01:00
Norman Maurer
e05b071b41
Javadocs update
2012-12-22 19:27:09 +01:00
Norman Maurer
fc4b205bc4
More javadocs
2012-12-22 15:53:01 +01:00
Trustin Lee
9098d069b0
Make FailedChannelFuture and SucceededChannelFuture final
2012-12-22 15:10:38 +09:00
Norman Maurer
b004066f37
Javadoc fixes and remove some uncessary casts + checks
2012-12-21 17:59:37 +01:00
Norman Maurer
a819d26f5c
Remove ChannelHandlerLifeCycleException and just use ChannelPipelineException as replacement
2012-12-21 17:10:36 +01:00
Norman Maurer
ef555d268c
Add more javadocs and replace some abstract methods with noops as we often implemented them as noops
2012-12-21 17:06:24 +01:00
Norman Maurer
3e31af68e4
More javadocs cleanup
2012-12-21 11:03:35 +01:00
Norman Maurer
e4ed551490
Move shared methods to the AbstractEmbeddedChannel class and add javadocs
2012-12-21 10:41:27 +01:00
Norman Maurer
42a77eda9b
And again javadocs cleanup
2012-12-21 07:35:42 +01:00
Norman Maurer
62bf98af8c
More javadoc fixes
2012-12-21 07:13:31 +01:00
Norman Maurer
7a9d9d6a88
Fix checkstyle
2012-12-20 19:11:17 +01:00
Norman Maurer
5d6d849acd
Mark final, add javadocs, add checks
2012-12-20 16:13:26 +01:00
Norman Maurer
d2060ee3f1
Add more javadocs
2012-12-20 15:45:49 +01:00
Norman Maurer
43d13064d1
[ #837 ] CombinedChannelHandler must pass sendFile(...) to the wrapped ChannelOutboundHandler
2012-12-20 12:25:13 +01:00
Norman Maurer
94dc09c33d
Tighten up visibility as the user should use Channel.new*Future
2012-12-20 10:45:12 +01:00
Norman Maurer
35c01660da
Merge branch 'master' of github.com:netty/netty
2012-12-19 09:27:18 +01:00
Norman Maurer
fdeff3855d
Move ChannelInputShutdownEvent to socket package as this is where it belongs to. Also added some javadocs
2012-12-19 09:27:01 +01:00
Trustin Lee
0e017db89a
Return the new buffer's capacity is same with the requested capacity
...
- Rename capacity variables to reqCapacity or normCapacity to distinguish if its the request capacity or the normalized capacity
- Do not reallocate on ByteBuf.capacity(int) if reallocation is unnecessary; just update the index range.
- Revert the workaround in DefaultChannelHandlerContext
2012-12-19 16:50:05 +09:00
Norman Maurer
b6e83dff4f
Add javadocs and also some parameter checks in DefaultFileRegion
2012-12-19 08:24:32 +01:00
Jestan Nirojan
44142efe55
Fixed OioSctpChannel event loop issue #632 by using 3 different selectors
2012-12-19 06:54:06 +01:00
Trustin Lee
3fc3401c08
Remove bad Javadoc in SCTP classes.
2012-12-19 11:58:54 +09:00
Norman Maurer
f6735f8cc9
Add javadocs to AIO and also fix a few warnings
2012-12-18 15:27:52 +01:00
Norman Maurer
7b0ec599d6
Fix config
2012-12-18 11:38:38 +01:00
Norman Maurer
8d89e48177
Add javadocs in the oio package and also fix some intellij warnings
2012-12-18 11:24:25 +01:00
Norman Maurer
6d93c3fb25
more javadocs
2012-12-18 07:55:39 +01:00
Norman Maurer
b7b17209ea
Next round of javadocs cleanup and fixes. Also limit the visibility of FailedChannelFuture
2012-12-18 07:23:42 +01:00
Trustin Lee
310a87a51d
Fix #814 - Prevent IllegalBufferAccessException on write() and flush()
...
- Also fixed a incorrect port of SpdySessionHandler
- Previously, it closed the connection too early when sending a GOAWAY frame
- After this fix, SpdySessionHandlerTest now passes again without the previous fix
2012-12-18 04:53:37 +09:00
Norman Maurer
5a467b69bf
DatagramPacket should be final
2012-12-17 20:37:10 +01:00
Trustin Lee
949435d105
Fix checkstyle
2012-12-18 03:08:01 +09:00
Trustin Lee
e59ac8e79b
Do not call inbound event methods directly
...
- Fixes #831
This commit ensures the following events are never triggered as a direct
invocation if they are triggered via ChannelPipeline.fire*():
- channelInactive
- channelUnregistered
- exceptionCaught
This commit also fixes the following issues surfaced by this fix:
- Embedded channel implementations run scheduled tasks too early
- SpdySessionHandlerTest tries to generate inbound data even after the
channel is closed.
- AioSocketChannel enters into an infinite loop on I/O error.
2012-12-18 03:04:26 +09:00
Norman Maurer
39250873ae
Add some javadocs
2012-12-17 16:01:58 +01:00
Trustin Lee
8b82ff5ce0
Fix checkstyle
2012-12-17 18:28:31 +09:00
Trustin Lee
def12a171c
Rename ChannelBuf to Buf and ChannelBufType to BufType
...
- Fixes #825
2012-12-17 17:43:45 +09:00
Trustin Lee
03e68482bb
Remove ChannelBuf/ByteBuf.Unsafe
...
- Fixes #826
Unsafe.isFreed(), free(), suspend/resumeIntermediaryAllocations() are not that dangerous. internalNioBuffer() and internalNioBuffers() are dangerous but it seems like nobody is using it even inside Netty. Removing those two methods also removes the necessity to keep Unsafe interface at all.
2012-12-17 17:41:21 +09:00
Norman Maurer
ba3c795fdf
Adjust ChannelPipeline to support method-chaining in a consistent way
2012-12-14 17:06:31 +01:00
Norman Maurer
caa698f235
[ #819 ] Allow for easy method-chaining in ChannelConfig and its sub-types
...
This commit also introduce a new interface which is called AioSocketChannelConfig to expose AIO only config options with the right visibility.
Also it change the ChannelConfig.setAllocator(..) to return the ChannelConfig to be more consistent with the other methods.
2012-12-14 16:59:23 +01:00
Norman Maurer
6eb7de04e7
Allow to access localAddress and remoteAddress even if the channel is not registered yet
2012-12-14 15:19:03 +01:00
Norman Maurer
42f6a27235
Allow modify the config even before the channel is registered to the eventLoop
2012-12-14 15:10:10 +01:00
Trustin Lee
d8c569a71b
Make ChannelFutureNotifier accept multiple ChannelFutures
2012-12-14 20:09:40 +09:00
Trustin Lee
eb23c9d27c
Add missing 'operation(args, future)' for 'operation(args)'
...
- Fixes #818
- Fix inspector warnings
2012-12-14 19:42:58 +09:00
Norman Maurer
96dc3f983f
Refactor AIO Transport to allow to use Bootstrap without the ugly hack
2012-12-14 09:51:36 +01:00
Trustin Lee
02a6e85feb
Add methods that add/remove multiple ChannelFutureListeners to ChannelFuture
...
- Fixes #811
2012-12-14 12:45:43 +09:00
Trustin Lee
1f72e53af3
Remove redundant copyright headers added by IntelliJ
2012-12-14 12:23:24 +09:00
Trustin Lee
5a4a59406b
Merge ByteBuf.hasNioBuffer() and hasNioBuffers()
...
- Fixes #797
2012-12-14 12:20:33 +09:00