Commit Graph

505 Commits

Author SHA1 Message Date
Norman Maurer
f23d68b42f [#2187] Always do a volatile read on the refCnt 2014-02-07 09:23:16 +01:00
Trustin Lee
103a08e6c6 Reduce code duplication in DefaultPromise 2014-02-06 22:30:10 -08:00
Trustin Lee
309ee68c21 Fix a race condition in DefaultPromise
.. which occurs when a user adds a listener from different threads after the promise is done and the notifications for the listeners, that were added before the promise is done, is in progress.  For instance:

   Thread-1: p.addListener(listenerA);
   Thread-1: p.setSuccess(null);
   Thread-2: p.addListener(listenerB);
   Thread-2: p.executor.execute(taskNotifyListenerB);
   Thread-1: p.executor.execute(taskNotifyListenerA);

taskNotifyListenerB should not really notify listenerB until taskNotifyListenerA is finished.

To fix this issue:

- Change the semantic of (listeners == null) to determine if the early
  listeners [1] were notified
- If a late listener is added before the early listeners are notified,
  the notification of the late listener is deferred until the early
  listeners are notified (i.e. until listeners == null)
- The late listeners with deferred notifications are stored in a lazily
  instantiated queue to preserve ordering, and then are notified once
  the early listeners are notified.

[1] the listeners that were added before the promise is done
[2] the listeners that were added after the promise is done
2014-02-06 22:05:24 -08:00
Trustin Lee
c4c71e6d28 Fix the potential copyright issue in SocksCommonUtils
- Add StringUtil.toHexString() methods which are based on LoggingHandler's lookup table implementation, and use it wherever possible
2014-02-06 15:00:06 -08:00
Norman Maurer
9bee78f91c Provide an optimized AtomicIntegerFieldUpdater, AtomicLongFieldUpdater and AtomicReferenceFieldUpdater 2014-02-06 20:08:45 +01:00
Valentin Kovalenko
40f4b5c9db Restore of interrupt status after catch of InterruptedException was added 2014-02-03 06:58:15 +01:00
Norman Maurer
64c3f58279 Not wakeup the EventLoop for writes as they will not cause a flush anyway 2014-02-01 13:45:27 +01:00
Trustin Lee
9f7a9077d6 Remove code duplication 2014-01-29 12:13:11 +09:00
MiddleBen
6e8ba291cf Simplify the acquisition of Cleaner 2014-01-29 11:55:06 +09:00
Trustin Lee
0bf5ca22cb Cleaner resource leak report by excluding noisy stack trace elements 2014-01-29 11:53:23 +09:00
Norman Maurer
d67184b488 [maven-release-plugin] prepare for next development iteration 2014-01-21 08:18:32 +01:00
Norman Maurer
287515210d [maven-release-plugin] prepare release netty-4.0.15.Final 2014-01-21 08:18:26 +01:00
Trustin Lee
b1392050f7 Disable Javassist completely on Android
- Related: #2127
- Inspector warnings
2014-01-21 14:25:54 +09:00
Veebs
5cb9ab0fc0 Correct JavaDoc 2014-01-13 17:40:55 +09:00
Trustin Lee
e83d2e0b4e [maven-release-plugin] prepare for next development iteration 2013-12-22 21:57:48 +09:00
Trustin Lee
cdb700c7a4 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:57:40 +09:00
Trustin Lee
0b7aedb13b [maven-release-plugin] rollback the release of netty-4.0.14.Final 2013-12-22 21:53:24 +09:00
Trustin Lee
4bf6ec7171 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:52:56 +09:00
Trustin Lee
9c1a49c58e [maven-release-plugin] rollback the release of netty-4.0.14.Final 2013-12-22 21:47:35 +09:00
Trustin Lee
008a049bf4 [maven-release-plugin] prepare for next development iteration 2013-12-22 21:43:55 +09:00
Trustin Lee
f6cb9088c6 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:43:45 +09:00
Trustin Lee
d7d4ea8c6d Remove unnecessary check in DefaultPromise.await0()
- Fixes #2032
- Fix inspection warnings
2013-12-16 15:16:08 +09:00
Trustin Lee
a79dfe74b7 Prevent NPE from StringUtil.simpleName(..) 2013-12-16 13:54:51 +09:00
Norman Maurer
bddfc38c64 [#2053] Do not allow < 1 on AppendableCharSequence init. 2013-12-11 10:18:26 +01:00
Trustin Lee
40001a7a5b Add missing synchronization 2013-12-06 22:35:14 +09:00
Trustin Lee
e506581eb1 Add ReferenceCountUtil.releaseLater() to make writing tests easy with ReferenceCounteds 2013-12-06 15:13:00 +09:00
Norman Maurer
04a2249814 [#2041] Make PlatformDependent.isRoot0() work on solaris 2013-12-05 15:43:05 +01:00
Trustin Lee
4f6a591e91 Do not log the deprecated system property when it's not specified by a user 2013-12-05 01:39:48 +09:00
Trustin Lee
e88172495a Ensure backward compatibility
.. by resurrecting the removed methods and system properties.
2013-12-05 01:02:38 +09:00
Trustin Lee
65b522a2a7 Better buffer leak reporting
- Remove the reference to ResourceLeak from the buffer implementations
  and use wrappers instead:
  - SimpleLeakAwareByteBuf and AdvancedLeakAwareByteBuf
  - It is now allocator's responsibility to create a leak-aware buffer.
  - Added AbstractByteBufAllocator.toLeakAwareBuffer() for easier
    implementation
- Add WrappedByteBuf to reduce duplication between *LeakAwareByteBuf and
  UnreleasableByteBuf
- Raise the level of leak reports to ERROR - because it will break the
  app eventually
- Replace enabled/disabled property with the leak detection level
  - Only print stack trace when level is ADVANCED or above to avoid user
    confusion
- Add the 'leak' build profile, which enables highly detailed leak
  reporting during the build
- Remove ResourceLeakException which is unsed anymore
2013-12-05 00:51:39 +09:00
Norman Maurer
05c10fae05 Replace usage of StringBuilder by AppendableCharSequence for performance reasons 2013-12-03 12:04:07 +01:00
Norman Maurer
17f5865e38 [maven-release-plugin] prepare for next development iteration 2013-11-29 19:31:01 +01:00
Norman Maurer
ead617fdcc [maven-release-plugin] prepare release netty-4.0.14.Beta1 2013-11-29 19:30:55 +01:00
Norman Maurer
6cf2748dbb [maven-release-plugin] prepare for next development iteration 2013-11-28 15:04:51 +01:00
Norman Maurer
5fe7596f49 [maven-release-plugin] prepare release netty-4.0.13.Final 2013-11-28 15:04:46 +01:00
Trustin Lee
407f0a36f5 Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging.  This is
  more robust because some strict build tools fail to retrieve the
  artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
  provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
  during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:01:46 +09:00
Norman Maurer
5386882c54 [#2003] Generate a io.netty.util.Version class which holds the version 2013-11-24 13:40:47 +01:00
Norman Maurer
a159d3ebac [#1994] DefaultPromise.cancel() should reuse CancellationException for performance reasons 2013-11-19 17:57:25 +01:00
Norman Maurer
db78581bbb [maven-release-plugin] prepare for next development iteration 2013-11-07 18:11:45 +01:00
Norman Maurer
2386777af8 [maven-release-plugin] prepare release netty-4.0.12.Final 2013-11-07 18:11:38 +01:00
Trustin Lee
54db9ec725 Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2013-11-04 19:46:15 +09:00
Trustin Lee
0d1567da0b Fix an API bug in the JavassistTypeParameterMatcherGenerator where some of its methods are not static
- Related issue: #1402
2013-11-04 18:57:02 +09:00
Norman Maurer
16d32ed33a [#1959] Proposed fix to correctly handle timeouts that overflow the ticks in the wheel 2013-10-31 06:27:17 +01:00
Trustin Lee
af1ac4ca0c Checkstyle 2013-10-25 21:04:10 +09:00
Trustin Lee
1c2352e6a0 Replace constructor calls on UniqueName and its subtypes with valueOf() wherever possible 2013-10-25 20:58:53 +09:00
Trustin Lee
8986245b47 Deprecate UniqueName and its subtypes' constructors / Add valueOf() for easier future migration. 2013-10-25 20:53:47 +09:00
Norman Maurer
ceab146b54 [maven-release-plugin] prepare for next development iteration 2013-10-21 07:43:42 +02:00
Norman Maurer
27a89d6032 [maven-release-plugin] prepare release netty-4.0.11.Final 2013-10-21 07:41:49 +02:00
Trustin Lee
e307979a0d Fix the problem where HashedWheelTimer puts a timeout into an incorrect place
- the stopIndex of a timeout is calculated based on the start time of the worker thread and the current tick count for greater accuracy
2013-10-07 17:46:19 +09:00
Norman Maurer
d7da19f745 [maven-release-plugin] prepare for next development iteration 2013-10-02 15:48:52 +02:00
Norman Maurer
d35768ae11 [maven-release-plugin] prepare release netty-4.0.10.Final 2013-10-02 15:48:45 +02:00
Norman Maurer
3739ee90cf [#1885] Correctly close leak detected also on non started HashedWheelTimer 2013-10-02 06:45:12 +02:00
Norman Maurer
ffab456aca Bump up version to reflect correct one 2013-09-09 11:20:12 +02:00
Norman Maurer
363531caf9 [maven-release-plugin] rollback the release of netty-4.0.9.Final 2013-09-06 09:18:34 +02:00
Norman Maurer
9d53573ee8 [maven-release-plugin] prepare for next development iteration 2013-09-06 09:17:15 +02:00
Norman Maurer
3aa77f54f7 [#1792] PlatformDependent.freeDirectBuffer(..) now respect hasUnsafe() 2013-08-28 07:23:37 +02:00
Norman Maurer
2e39b25cd4 [maven-release-plugin] prepare for next development iteration 2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866 [maven-release-plugin] prepare release netty-4.0.8.Final 2013-08-26 12:00:54 +02:00
Trustin Lee
8142aae765 Improve the randomness of ThreadLocalRandom for all platform
- Fixes #1765
Java 6 did a poor job of generating seedUniquifier unlike 7, so I implemented platform-independent seedUniquifier generator with configurability
2013-08-24 12:25:50 +09:00
Norman Maurer
1d3560e389 [maven-release-plugin] prepare for next development iteration 2013-08-08 13:53:28 +02:00
Norman Maurer
8e97e6c461 [maven-release-plugin] prepare release netty-4.0.7.Final 2013-08-08 13:53:19 +02:00
Norman Maurer
b456adf404 [#1709] Correctly detect that Unsafe.copyMemory is missing 2013-08-08 11:57:05 +02:00
Norman Maurer
3f2000fa3a [maven-release-plugin] prepare for next development iteration 2013-08-01 10:59:55 +02:00
Norman Maurer
3f70d5caa4 [maven-release-plugin] prepare release netty-4.0.6.Final 2013-08-01 10:59:46 +02:00
Norman Maurer
e3410680de [maven-release-plugin] prepare for next development iteration 2013-07-31 20:08:14 +02:00
Norman Maurer
0e124583d6 [maven-release-plugin] prepare release netty-4.0.5.Final 2013-07-31 20:08:05 +02:00
Norman Maurer
2b3ac3d446 Factor out the PendingWrite class and put it in internal package. Make use of it in SslHandler and ChunkedWriteHandler to reduce GC-pressure 2013-07-25 12:36:24 +02:00
Norman Maurer
0bc7d3f5d1 [maven-release-plugin] prepare for next development iteration 2013-07-23 10:04:23 +02:00
Norman Maurer
ca00182797 [maven-release-plugin] prepare release netty-4.0.4.Final 2013-07-23 10:04:14 +02:00
Norman Maurer
f4e128b807 [#1612] No need for volatile as it is not needed to be precise 2013-07-23 07:11:11 +02:00
Trustin Lee
764741c5ce Change the contract of ResourceLeakDetector.open() so that unsampled resources are recycled
- This also fixes the problem introduced while trying to implement #1612 (Allow to disable resource leak detection).
2013-07-23 14:06:58 +09:00
Trustin Lee
ec370e1d97 Remove an unnecessary empty line 2013-07-23 13:30:27 +09:00
Trustin Lee
70e7bcc963 Remove ResourceLeakDetector.ENABLED / Replace ResourceLeakDetector.is/setDisabled() with is/setEnabled()
- Related: #1612
2013-07-23 13:28:05 +09:00
Norman Maurer
2bbad8e4e5 [#1612] Allow to disable resource leak detection via API 2013-07-22 20:55:49 +02:00
kerr
ada07cb9e0 Fix types in javadocs 2013-07-22 19:14:36 +02:00
Jeff Pinner
6c9c151d66 minor documentation cleanup 2013-07-20 08:01:14 +02:00
Norman Maurer
a4d0341ea1 [#1614] Fix bug in SingleThreadEventExecutor which prevent scheduled tasks to get executed
The problem was that with OioSocketChannel there was always a read Task in the taskQueue and with the old logic it never tried to execute scheduled tasks if there was at least one task in the taskQueue.
2013-07-19 12:30:40 +02:00
Trustin Lee
762adfcb69 Update HttpStaticFileServer example / Fix bugs related with progress notification
- Fix a bug in DefaultProgressivePromise.tryProgress() where the notification is dropped
 - Fix a bug in AbstractChannel.calculateMessageSize() where FileRegion is not counted
 - HttpStaticFileServer example now uses zero copy file transfer if possible.
2013-07-19 13:21:32 +09:00
Trustin Lee
f96a8e5951 Implement ProgressivePromise notification in NIO byte channels and ChunkedWriteHandler
- Refine the contract of GenericProgressiveFutureListener.
- Negative 'total' now means 'unknown', which is useful for ChunkedWriteHandler.
2013-07-19 12:53:23 +09:00
Trustin Lee
ac6c3b85f2 Simplify 2013-07-18 14:49:58 +09:00
Trustin Lee
28b8573b2a Fix a potential race condition where the worker thread of GlobalEventExecutor terminates with a pending task
- Potential fix for the hanging SpdyFrameDecoderTest
2013-07-18 14:49:22 +09:00
Trustin Lee
57d591d188 Fix checkstyle 2013-07-18 14:05:41 +09:00
Trustin Lee
0f2542ded5 Fix StackOverflowError raised by DefaultPromise.notifyListeners() when ImmediateEventExecutor was used
- Fixed #1602
2013-07-18 14:03:48 +09:00
Trustin Lee
b130ee6a6c [maven-release-plugin] prepare for next development iteration 2013-07-18 11:17:42 +09:00
Trustin Lee
10d395e829 [maven-release-plugin] prepare release netty-4.0.3.Final 2013-07-18 11:17:31 +09:00
Trustin Lee
ef17a9c5d4 Grammar - Fixes #1598 2013-07-18 10:49:37 +09:00
Norman Maurer
fc7c950b08 [maven-release-plugin] prepare for next development iteration 2013-07-17 15:58:36 +02:00
Norman Maurer
bbbf72359e [maven-release-plugin] prepare release netty-4.0.2.Final 2013-07-17 15:58:28 +02:00
Trustin Lee
e53738f38c Less confusing leak warning message 2013-07-17 21:29:03 +09:00
Trustin Lee
57eb531eb8 [maven-release-plugin] prepare for next development iteration 2013-07-16 17:16:10 +09:00
Trustin Lee
76cefcc421 [maven-release-plugin] prepare release netty-4.0.1.Final 2013-07-16 17:15:54 +09:00
Norman Maurer
5297eba280 [maven-release-plugin] prepare for next development iteration 2013-07-15 15:48:15 +02:00
Norman Maurer
c5d8af446a [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 15:48:05 +02:00
Trustin Lee
246a3ecdcb [maven-release-plugin] prepare for next development iteration 2013-07-15 20:58:33 +09:00
Trustin Lee
e8fd209115 [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 20:58:21 +09:00
Norman Maurer
9b9f621690 Make DefaultFutureListeners package private 2013-07-15 09:33:33 +02:00
Norman Maurer
7254a5c2c6 Just some tiny javadocs optimizations 2013-07-14 16:02:03 +02:00
Norman Maurer
3a4c7c9c93 Also dissallow null elements on set 2013-07-12 08:25:19 +02:00
Norman Maurer
98c6a5810a Just tiny optimization to avoid object creation 2013-07-12 08:23:01 +02:00
Norman Maurer
c38db2afe3 Dissallow adding null elements into RecyclableArrayList 2013-07-12 08:01:31 +02:00
Norman Maurer
da5c6add14 Rename CodecOutput to RecyclableArrayList and move it to internal package.
* Also reuse it in SslHandler
2013-07-10 07:50:26 +02:00
Norman Maurer
9c1b31d20a [#1535] Remove Channel.id() and so fix the possible leakage of the previous used Channel id map
The user can still use Channel.hashCode() for logging. It's just not 100% unique but should be good enough for most cases
2013-07-08 14:07:18 +02:00
Trustin Lee
1fa087ecbf Fix checkstyle 2013-07-07 12:29:33 +09:00
Trustin Lee
ff97d1db29 Fix checkstyle 2013-07-07 12:29:11 +09:00
Trustin Lee
70df5a6f63 Add ThreadLocalRandom back because it's used by ForkJoinPool now. 2013-07-07 12:26:48 +09:00
Trustin Lee
378626b31f Port ConcurrentHashMapV8 again to get the recent upstream fixes 2013-07-07 12:22:59 +09:00
Norman Maurer
ec5e793a2f [maven-release-plugin] prepare for next development iteration 2013-07-02 11:41:18 +02:00
Norman Maurer
ca73eaef0d [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 11:41:09 +02:00
Norman Maurer
830c559405 [maven-release-plugin] rollback the release of netty-4.0.0.CR9 2013-07-02 11:34:29 +02:00
Norman Maurer
66a16b133c [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 10:45:12 +02:00
Trustin Lee
7e3a01cc51 [maven-release-plugin] prepare for next development iteration 2013-07-02 10:26:48 +09:00
Trustin Lee
149db34c19 [maven-release-plugin] prepare release netty-4.0.0.CR8 2013-07-02 10:26:32 +09:00
Trustin Lee
4b11aff08f Less confusing log messages for system properties
- Fixes #1502
2013-07-02 09:23:29 +09:00
Norman Maurer
43da224978 Only log about not avaible JavaAssist in debug level 2013-07-01 11:46:34 +02:00
Trustin Lee
613547b0b9 [maven-release-plugin] prepare for next development iteration 2013-06-28 22:15:33 +09:00
Trustin Lee
a6abd2feb2 [maven-release-plugin] prepare release netty-4.0.0.CR7 2013-06-28 22:15:20 +09:00
Trustin Lee
a6795d7780 [maven-release-plugin] prepare for next development iteration 2013-06-25 11:07:15 +09:00
Trustin Lee
2221446425 [maven-release-plugin] prepare release netty-4.0.0.CR6 2013-06-25 11:07:15 +09:00
Trustin Lee
63403884f7 Make sure PlatformDependent.isRoot0() works fine in Android
.. by swallowing ErrnoException raised by process.destroy().

Fixes #1472
2013-06-25 11:07:13 +09:00
Trustin Lee
32aa661604 Make sure PlatformDependent.maxDirectMemory() works on Android
- Fixes #1451
2013-06-25 11:07:13 +09:00
Trustin Lee
952e7bbec7 Remove cruft 2013-06-25 11:07:13 +09:00
Trustin Lee
6f86f38ae9 Fix IllegalStateException triggered by a successful connection attempt
- Fixes #1467
- Provide more information about the tasks and promises on exception for easier debugging
2013-06-25 11:07:13 +09:00
Norman Maurer
6a9f965f9b Introduce new utility class calles ReferenceCountUtil and move utility methods from ByteBufUtil to it.
The ones in ByteBufUtil were marked as @deprecated
2013-06-14 07:07:33 +02:00
Trustin Lee
a5871dfd86 [maven-release-plugin] prepare for next development iteration 2013-06-14 12:55:15 +09:00
Trustin Lee
f5377cc8d7 [maven-release-plugin] prepare release netty-4.0.0.CR5 2013-06-14 12:55:05 +09:00
Trustin Lee
0da48e7e7f Determine the default number of heap/direct arenas of PooledByteBufAllocator conservatively
- Fixes #1445
- Add PlatformDependent.maxDirectMemory()
- Ensure the default number or arenas is decreased if the max memory of the VM is not large enough.
2013-06-14 12:14:45 +09:00
Trustin Lee
e5ca6518ba [maven-release-plugin] prepare for next development iteration 2013-06-13 17:02:32 +09:00
Trustin Lee
381063e09c [maven-release-plugin] prepare release netty-4.0.0.CR4 2013-06-13 17:02:19 +09:00
Trustin Lee
ca1a37a3b3 Log correct system property name 2013-06-13 14:21:56 +09:00
Trustin Lee
32bf3054e1 Prefer direct buffer by default
- Because it's faster in most cases thanks to unsafe
2013-06-13 14:21:26 +09:00
Trustin Lee
6d1cd0d0cd ReferenceCountException -> IllegalReferenceCountException 2013-06-13 14:00:15 +09:00
Trustin Lee
175526b6bd Move ReferenceCounted and AbstractReferenceCounted to io.netty.util
- Fixes #1441
- Also move and rename IllegalBufferAccessException to ReferenceCountException
- Prettier reference count exception messages
2013-06-13 13:14:21 +09:00
Trustin Lee
2320a13a4e Better use NoOpTypeParameterMatcher as a class path source
.. because we tries to load it really
2013-06-12 08:24:36 +09:00
Trustin Lee
be695636d2 Make JavassistTypeParameterMatcherGenerator.generate() public 2013-06-12 08:17:17 +09:00
Trustin Lee
3fc6e02f8b Allow appending classpath to the ClassPool of JavassistTypeParameterMatcherGenerator
- Fixes: #1402
- Make JavassistTypeParameterMatcherGenerator public
- Add appendClassPath()
2013-06-12 08:09:11 +09:00
Trustin Lee
79e236dfc2 Make EventExecutor.shutdownGracefully() return Future
- Also added EventExecutor.terminationFuture()
- Also fixed type signature problem with Future.add/removeListener()
- Related issue: #1389
2013-06-12 08:00:54 +09:00
Trustin Lee
fd0084ecfa Remove the constructors that uses ImmediateEventExecutor from DefaultChannelGroup
.. which is incorrect in my opinion.

+ minor cleanup
2013-06-12 06:50:38 +09:00
Trustin Lee
1749210985 Add GlobalEventExecutor
- Related issue: #1389
- Also extracted SingleThreadEventExecutor.ScheduledFutureTask into a top level class for a reuse
2013-06-12 06:40:01 +09:00
Trustin Lee
786501d972 Remove unused thread local and its getter 2013-06-12 05:03:55 +09:00
Trustin Lee
c3034c8964 Implement the cancellation of connection attmpe for NIO and OIO transport
- Related issue: #1432
- Also added test cases to validate the implementation
2013-06-11 18:46:39 +09:00
Trustin Lee
41af9a1eb3 Implement cancellation properly for Promise/Future
- Related issue: #1432
- Add Future.isCancellable()
- Add Promise.setUncancellable() which is meant to be used for the party that runs the task uncancellable once started
- Implement Future.isCancelled() and Promise.cancel(boolean) properly
2013-06-11 17:46:21 +09:00
Trustin Lee
7234a00f0d Add ResourceLeakDetector.ENABLED
.. to provide a way to check if resource leak detection was enabled programmatically.
2013-06-10 19:13:06 +09:00
Trustin Lee
9449efb9b2 Optimize Recycler.Stack
- No need to use a deque at all
- Increase the initial capacity so that there's no practical chance of capacity expansion
2013-06-10 16:38:57 +09:00
Wolfgang Profer
d9af92f354 [#1430] Fixed byte order problem on little endian platforms that support Unsafe but not unaligned memory access. 2013-06-10 09:24:22 +02:00
Trustin Lee
14158070bf Revamp the core API to reduce memory footprint and consumption
The API changes made so far turned out to increase the memory footprint
and consumption while our intention was actually decreasing them.

Memory consumption issue:

When there are many connections which does not exchange data frequently,
the old Netty 4 API spent a lot more memory than 3 because it always
allocates per-handler buffer for each connection unless otherwise
explicitly stated by a user.  In a usual real world load, a client
doesn't always send requests without pausing, so the idea of having a
buffer whose life cycle if bound to the life cycle of a connection
didn't work as expected.

Memory footprint issue:

The old Netty 4 API decreased overall memory footprint by a great deal
in many cases.  It was mainly because the old Netty 4 API did not
allocate a new buffer and event object for each read.  Instead, it
created a new buffer for each handler in a pipeline.  This works pretty
well as long as the number of handlers in a pipeline is only a few.
However, for a highly modular application with many handlers which
handles connections which lasts for relatively short period, it actually
makes the memory footprint issue much worse.

Changes:

All in all, this is about retaining all the good changes we made in 4 so
far such as better thread model and going back to the way how we dealt
with message events in 3.

To fix the memory consumption/footprint issue mentioned above, we made a
hard decision to break the backward compatibility again with the
following changes:

- Remove MessageBuf
- Merge Buf into ByteBuf
- Merge ChannelInboundByte/MessageHandler and ChannelStateHandler into ChannelInboundHandler
  - Similar changes were made to the adapter classes
- Merge ChannelOutboundByte/MessageHandler and ChannelOperationHandler into ChannelOutboundHandler
  - Similar changes were made to the adapter classes
- Introduce MessageList which is similar to `MessageEvent` in Netty 3
- Replace inboundBufferUpdated(ctx) with messageReceived(ctx, MessageList)
- Replace flush(ctx, promise) with write(ctx, MessageList, promise)
- Remove ByteToByteEncoder/Decoder/Codec
  - Replaced by MessageToByteEncoder<ByteBuf>, ByteToMessageDecoder<ByteBuf>, and ByteMessageCodec<ByteBuf>
- Merge EmbeddedByteChannel and EmbeddedMessageChannel into EmbeddedChannel
- Add SimpleChannelInboundHandler which is sometimes more useful than
  ChannelInboundHandlerAdapter
- Bring back Channel.isWritable() from Netty 3
- Add ChannelInboundHandler.channelWritabilityChanges() event
- Add RecvByteBufAllocator configuration property
  - Similar to ReceiveBufferSizePredictor in Netty 3
  - Some existing configuration properties such as
    DatagramChannelConfig.receivePacketSize is gone now.
- Remove suspend/resumeIntermediaryDeallocation() in ByteBuf

This change would have been impossible without @normanmaurer's help. He
fixed, ported, and improved many parts of the changes.
2013-06-10 16:10:39 +09:00
Norman Maurer
81e3c1719a [maven-release-plugin] prepare for next development iteration 2013-05-18 09:59:13 +02:00
Norman Maurer
99caefdf39 [maven-release-plugin] prepare release netty-4.0.0.CR3 2013-05-18 09:57:11 +02:00
Norman Maurer
abb4e20d0b [#1369] Move ImmediateEventExecutor to common and let it access via a static
* Also fix a bug there to return a correct implementation of ProgressivPRomi
  ImmediateEventExecutor
2013-05-17 21:35:01 +02:00
Norman Maurer
a8830aee42 [#1369] Move ImmediateEventExecutor to common and let it access via a static public field
* Also fix a bug there to return a correct implementation of ProgressivPRomise to work with the
 ImmediateEventExecutor
2013-05-17 21:19:59 +02:00
Trustin Lee
c406647bb2 Use short for DefaultPromise.waiters for less memory consumption 2013-05-09 08:51:01 +09:00