Commit Graph

1296 Commits

Author SHA1 Message Date
Norman Maurer
a402b80ad0 Remove condition in ChannelHandlerAdapter.isSharable() by caching the result of the annotation lookup.
Motivation:
Remove the synchronization bottleneck and so speed up things

Modifications:
Introduce a ThreadLocal cache that holds mappings between classes of ChannelHandlerAdapater implementations and the result of checking if the @Sharable annotation is present.
This way we only will need to do the real check one time and server the other calls via the cache. A ThreadLocal and WeakHashMap combo is used to implement the cache
as this way we can minimize the conditions while still be sure we not leak class instances in containers.

Result:
Less conditions during adding ChannelHandlerAdapter to the ChannelPipeline
2014-03-12 13:43:39 +01:00
Jakob Buchgraber
aad4082d0f Corrected inconsistencies in the Javadoc. 2014-03-04 06:25:30 +01:00
Jakob Buchgraber
7d04136734 Added asserts to make sure ChannelHandlers are removed from the pipeline 2014-03-03 06:43:19 +01:00
Norman Maurer
6efac6179e [#1259] Add optimized queue for SCMP pattern and use it in NIO and native transport
This queue also produces less GC then CLQ when make use of OneTimeTask
2014-02-27 13:56:15 +01:00
Norman Maurer
01cd5929da Fix check to clear READ_OP and EPOLLIN. Part of [#2254] 2014-02-22 20:06:21 +01:00
Norman Maurer
52535a12f8 [#2254] Correctly handle Channel.read() and ChannelHandlerContext.read()
This includes also when it is called from channelRead(...) and channelReadComplete(...) methods.
2014-02-22 18:54:03 +01:00
Norman Maurer
60b830ba89 Directly use memory addresses for gathering writes to reduce gc pressure. Part of [#2239]
This also does factor out some logic of ChannelOutboundBuffer. Mainly we not need nioBuffers() for many
transports and also not need to copy from heap to direct buffer. So this functionality was moved to
NioSocketChannelOutboundBuffer. Also introduce a EpollChannelOutboundBuffer which makes use of
memory addresses for all the writes to reduce GC pressure
2014-02-21 14:16:37 +01:00
Norman Maurer
bea810707c [#2254] Fix regression in handling autoRead and Channel.read()
This regression was introduced by e0b39159657c9eb711047bc32367537c4870d467
2014-02-21 09:46:28 +01:00
Norman Maurer
b49490e239 Move marking ChannelPromise for writes uncancellable to addFlush for keep things simple 2014-02-17 16:15:49 +01:00
Trustin Lee
d5e897bba2 Determine the default allocator from system property
- Add ByteBufAllocator.DEFAULT
- The default allocator is now 'pooled'
2014-02-14 13:04:48 -08:00
Norman Maurer
657af70576 Prettify exception message 2014-02-13 06:47:40 +01:00
Norman Maurer
0ad029bf96 Allow to set IoRatio to 100% 2014-02-12 19:30:57 +01:00
Norman Maurer
4dc337a717 Correctly respect isAutoRead() and make it consistent across OIO/NIO 2014-02-11 20:46:58 +01:00
Norman Maurer
a96eb96646 Allow to cancel non-flushed writes 2014-02-11 20:00:56 +01:00
Trustin Lee
6c094237e5 Do not warn if failed to mark a void promise as success
- it's always supposed to fail.
2014-02-10 15:04:03 -08:00
Trustin Lee
fee1d9e75c Make most outbound operations cancellable / More robust promise update
- Inspired by #2214 by @normanmaurer
- Call setUncancellable() before performing an outbound operation
- Add safeSetSuccess/Failure() and use them wherever
2014-02-10 14:52:24 -08:00
Trustin Lee
a34d5baad2 Make most outbound operations are cancellable
- Inspired by #2214
- It actually reduces the chance of trying to marking a cancelled promise as success again, which raises an IllegalStateException.
2014-02-10 14:05:29 -08:00
Norman Maurer
bd20f80ca0 [#2215] DefaultChannelHandlerContext tasks needs to be volatile to ensure every thread only see full initialized instances 2014-02-08 10:35:54 +01:00
Norman Maurer
7a1a30f0ad Provide an optimized AtomicIntegerFieldUpdater, AtomicLongFieldUpdater and AtomicReferenceFieldUpdater 2014-02-06 21:07:31 +01:00
Norman Maurer
1d8a200849 Not wakeup the EventLoop for writes as they will not cause a flush anyway 2014-02-01 15:00:14 +01:00
Norman Maurer
f7f808c7e0 Better exception message to tell the user why it is not supported 2014-01-30 07:00:53 +01:00
Norman Maurer
96f94cfcb1 [#2164] Only reregister SelectionKeys that are still valid 2014-01-29 07:19:41 +01:00
Trustin Lee
0f1b1be0aa Enable a user specify an arbitrary information with ReferenceCounted.touch()
- Related: #2163
- Add ResourceLeakHint to allow a user to provide a meaningful information about the leak when touching it
- DefaultChannelHandlerContext now implements ResourceLeakHint to tell where the message is going.
- Cleaner resource leak report by excluding noisy stack trace elements
2014-01-29 11:44:59 +09:00
Trustin Lee
65ebecb85f Touch a ReferenceCounted while it traverses across a pipeline 2014-01-28 20:10:19 +09:00
Trustin Lee
b887e35ac2 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-01-28 20:06:55 +09:00
Trustin Lee
7d501db7f8 Fix API documentation on the usage of AttributeKey 2014-01-28 13:57:08 +09:00
Norman Maurer
cac449a5e4 Add testcase to try to reproduce #2144 2014-01-23 07:10:08 +01:00
Trustin Lee
13f508154a Merge the attribute map of ChannelHandlerContext into Channel
- Fixes #2136
2014-01-20 15:16:12 +09:00
William Kemper
cab2a03760 fix grouping for isActive - socket.isBound is almost always true and should not override 'isOpen' 2014-01-17 07:23:03 +01:00
Trustin Lee
b165134044 Better exception message 2014-01-13 23:30:32 +09:00
Trustin Lee
17c0722862 Add missing validation which results in NPE later 2014-01-13 23:29:41 +09:00
Trustin Lee
9c1b9492d5 Fix a bug where DefaultChannelPipelineTest.testFireChannelRegistered() triggers channelRegistered() twice 2014-01-13 23:27:56 +09:00
Trustin Lee
999b51b026 Get the PID properly on Android
- Related: #2109
2014-01-13 22:28:28 +09:00
Trustin Lee
6df3bb5a79 Fix a problem where DefaultChannelId prevents Netty 5 from running on Android
- Fixes #2109
- Use reflection to find the current PID
2014-01-13 17:33:55 +09:00
Norman Maurer
9276fbaea0 [#2104] Make sure we only act on the SelectionKey if it is valid 2014-01-09 18:28:33 +01:00
Trustin Lee
2af1419056 Fix a potential NPE due to the race between a connection attempt and its cancellation
- should fix #2086
2014-01-09 19:25:08 +09:00
Norman Maurer
0b8e732c6c [#2086] Fix race which could produce NPE in AbstractNioUnsafe.finishConnect 2014-01-09 08:22:56 +01:00
milenkovicm
06823e3aff ChannelOutboundBuffer returns total pending write size
total pending write size may be used to optimize write batching
2014-01-07 06:57:20 +01:00
Veebs
194ba39bc0 Fix typo 2014-01-03 11:15:30 +01:00
Michael Nitschinger
299ce22938 Fix typo in EmbeddedSocketAddress. 2014-01-02 15:34:15 +01:00
Trustin Lee
f3a842ecca [maven-release-plugin] prepare for next development iteration 2013-12-22 22:06:15 +09:00
Trustin Lee
888dfba76f [maven-release-plugin] prepare release netty-5.0.0.Alpha1 2013-12-22 22:06:06 +09:00
Trustin Lee
0d437baef0 Increase the default maxMessagesPerRead of AbstractNioByteChannel to 16
- Related: #2079
2013-12-21 20:08:15 +09:00
Trustin Lee
3ca3efac52 Fix a bug where adaptive recvbuf size prediction doesn't work correctly when maxMessagesPerRead is > 1 2013-12-21 19:56:36 +09:00
Trustin Lee
4e05c52c2e More graceful registration failure
- Fixes #2060
- Ensure to return a future/promise implementation that does not fail with 'not registered to an event loop' error for registration operations
- If there is no usable event loop available, GlobalEventExecutor.INSTANCE is used as a fallback.
- Add VoidChannel, which is used when an instantiation of a channel fails.
2013-12-21 18:47:03 +09:00
Norman Maurer
e1c47632e8 [#2079] Stop reading once the NIO byte Channel was complete drained 2013-12-21 10:39:29 +01:00
Trustin Lee
04ec2e1330 Add Recycler.Handle.recycle() so that it's possible to recycle an object without an explicit reference to Recycler 2013-12-19 01:10:52 +09:00
Trustin Lee
3e8a1ed611 Fix a race condition where flush() can be triggered before write()
.. when a handler overrides write() but not flush().
2013-12-17 09:51:41 +09:00
Trustin Lee
94d6e44bba Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
.. so that there's no need to explicitly down-cast.

Fixes #2067
2013-12-16 22:22:47 +09:00
Trustin Lee
4302c016d2 Rename flushAndWrite() to writeAndFlush()
- Related: #2066
2013-12-16 14:58:14 +09:00