Commit Graph

425 Commits

Author SHA1 Message Date
Trustin Lee
065b6cf785 Fixed various buffer leaks in FixedCompositeByteBufTest 2013-12-07 11:36:18 +09:00
Norman Maurer
643ce2f8c0 Fix all leaks reported during tests
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:47:30 +09:00
Trustin Lee
187a5976cc Fix false-positive leaks
- All derived buffers and swapped buffers of a leak-aware buffer must be wrapped again with the leak-aware buffer
2013-12-06 21:32:47 +09:00
Trustin Lee
0f3451c227 Add ReferenceCountUtil.releaseLater() to make writing tests easy with ReferenceCounteds 2013-12-06 15:12:46 +09:00
Trustin Lee
ea3143a1ee Checkstyle 2013-12-06 13:53:42 +09:00
Trustin Lee
d21568b962 Also record retain() and release() 2013-12-06 13:44:59 +09:00
Trustin Lee
6431be8954 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:49:21 +09:00
Norman Maurer
f9a77b3c83 Add FixedCompositeByteBuf which can be used to write an array of ByteBuf in an efficient way.
This implementation does not produce as much GC pressure as CompositeByteBuf and so is prefered,
for writing an array of ByteBufs. Be aware that FixedCompositeByteBuf is readonly.

When using this in a project that make heavy use of CompositeByteBuf for writes we was able to cut
down allocation to a half.
2013-12-03 08:09:24 +01:00
Norman Maurer
a4e4479407 Fix checkstyle 2013-12-02 08:24:15 +01:00
Norman Maurer
d66bffe271 [#2021] No need to synchronize for unpooled chunks 2013-12-02 08:02:32 +01:00
Trustin Lee
110745b0eb Remove the distinction of inbound handlers and outbound handlers
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
  because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c 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:00:14 +09:00
Trustin Lee
2235873537 Resurrect Channel.id() with global uniqueness
- Fixes #1810
- Add a new interface ChannelId and its default implementation which generates globally unique channel ID.
- Replace AbstractChannel.hashCode with ChannelId.hashCode() and ChannelId.shortValue()
- Add variants of ByteBuf.hexDump() which accept byte[] instead of ByteBuf.
2013-11-18 15:30:12 +09:00
Trustin Lee
6ba1a85c4b Remove unnecessary parenthesis 2013-11-15 23:08:25 +09:00
Norman Maurer
d11d3a6b50 Also allow to override how direct ByteBuffers are freed 2013-11-12 12:44:11 +01:00
Norman Maurer
9b7d286652 Allow to override how wrapped direct ByteBuffer are allocated to make it easier to extend 2013-11-12 12:44:00 +01:00
Norman Maurer
329bbfcd87 [#1976] Fix IndexOutOfBoundsException when calling CompositeByteBuf.discardReadComponents() 2013-11-09 20:13:43 +01:00
Alex Petrov
519c632b2e Improve docstrings for and of 2013-11-08 12:23:43 +01:00
Trustin Lee
9125977692 Simpler toString() for ByteBufAllocators 2013-11-08 17:53:57 +09:00
Norman Maurer
c26d43757e [#1800] [#1802] Correctly expand capacity of ByteBuf while preserve content 2013-11-04 15:18:48 +01:00
Trustin Lee
26415b8f4c 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:42:33 +09:00
Trustin Lee
6b0025430e Bump the version to 5.0.0.Alpha1 2013-11-04 19:14:40 +09:00
Norman Maurer
9e882c793b [#1943] Unpooled.copiedBuffer(ByteBuf pooled) should always return unpooled ByteBuf 2013-10-22 20:20:04 +02:00
Norman Maurer
9b625d611f [#1925] Only expose sub-region of ByteBuf on nioBuffer(...) 2013-10-16 11:51:56 +02:00
Norman Maurer
522dbf8543 [#1906] Use a ByteBuf allocator from the ByteBufAllocator when encode Strings 2013-10-09 21:19:36 +02:00
Norman Maurer
d91717446b Remove redundant index check 2013-10-08 07:21:15 +02:00
Bill Gallagher
805a9dff8e disable debugging output during test 2013-10-04 06:58:52 +02:00
Norman Maurer
1ecd1e01a5 [#1880] Use ByteBufAllocator when read bytes into new chunks 2013-10-01 09:27:02 +02:00
Norman Maurer
512908f993 [#1875] Correctly check the readerIndex when try to read a byte from AbstractByteBuf 2013-09-30 14:49:03 +02:00
Norman Maurer
c2101d3c56 Cache underlying ByteBuffers and count in ChannelOutboundBuffer.Entry to reduce object creation and so GC pressure
Beside this it also helps to reduce CPU usage as nioBufferCount() is quite expensive when used on CompositeByteBuf which are
nested and contains a lot of components
2013-09-26 21:01:40 +02:00
Norman Maurer
fc805a0787 CompositeByteBuf.isDirect() should return true if its only backed by direct buffers 2013-09-26 20:50:59 +02:00
Norman Maurer
213d195909 [#1865] Only use internalNioBuffer when one of the read* or write* methods are used. This is neccessary to prevent races as those can happen when a slice or duplicate is shared between different Channels
that are not assigned to the same EventLoop. In general get* operations should always be safe to be used from different Threads.

This aslo include unit tests that show the issue
2013-09-25 17:18:47 +02:00
Norman Maurer
1c7e107bef [#1851] EmptyByteBuf.isWritable(..) and isReadable(...) should not throw IndexOutOfBoundsException 2013-09-21 20:40:08 +02:00
Norman Maurer
a855f19ad6 [#1853] Optimize gathering writes for CompositeByteBuf that are only backed by one ByteBuffer 2013-09-19 07:29:21 +02:00
Norman Maurer
0e1dcb91ff [#1852] Fix bug in UnpooledDirectByteBuf.nioBuffer(...) implementation 2013-09-18 20:48:40 +02:00
Greg Soltis
335f3807a5 Fix nioBuffer implementation for CompositeByteBuf 2013-09-16 06:57:32 +02:00
Norman Maurer
3b44c602db [#1821] Fix IndexOutOfBoundsException which was thrown if the last component was removed but other components was left 2013-09-10 18:38:52 +02:00
Norman Maurer
a52bbd20f4 Make sure only direct ByteBuffer are passed to the underlying jdk Channel.
This is needed because of otherwise the JDK itself will do an extra ByteBuffer copy with it's own pool implementation. Even worth it will be done
multiple times if the ByteBuffer is always only partial written. With this change the copy is done inside of netty using it's own allocator and
only be done one time in all cases.
2013-09-02 20:17:34 +02:00
Norman Maurer
6f79291d5b [#1797] No use internalNioBuffer() in derived buffers as it is not meant for concurrent access 2013-09-02 14:17:19 +02:00
Norman Maurer
60b06df84f Add tests to try to track down some buffer issues 2013-09-02 14:17:16 +02:00
Norman Maurer
54d788f435 Remove legancy code which we not need anymore as we use gathering writes anyway everywhere 2013-09-01 11:00:20 +02:00
Norman Maurer
aed8c15326 [#1797] Throw IllegalArgumentException if AbstractByteBuf.skipBytes(...) is used with a negative value 2013-08-29 11:16:11 +02:00
Norman Maurer
09a748abdb Bump up version to 4.1.0.Alpha1-SNAPSHOT 2013-08-26 15:18:18 +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
20894bc99e Fix a bug in internalNioBuffer() implementations of derived buffers
- A user can create multiple duplicates of a buffer and access their internal NIO buffers. (e.g. write multiple duplicates to multiple channels assigned to different event loop.)  Because the derived buffers' internalNioBuffer() simply delegates the call to the original buffer, all derived buffers and the original buffer's internalNioBuffer() will return the same buffer, which will lead to a race condition.
- Fixes #1739
2013-08-20 14:28:50 +09:00
bgallagher
9f88552f12 remove some dead code 2013-08-10 20:46:48 +02: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
194b64cff1 [#1708] Correctly set the writerIndex in ReadOnlyByteBufferBuf if it is constructed with a buffer which has non zero position 2013-08-08 06:54:32 +02:00
Norman Maurer
ea1dca8105 [#1704] Make sure SwappedByteBuf.readSlice(..) returns ByteBuf with correct ByteOrder 2013-08-06 12:22:22 +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
8a673db92b [#1644] Fixed IndexOutOfBoundException when calling copy() on a empty CompositeByteBuf 2013-07-24 07:35:51 +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
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
Norman Maurer
35802207e1 Fix compile error 2013-07-23 06:42:41 +02:00
kerr
ada07cb9e0 Fix types in javadocs 2013-07-22 19:14:36 +02:00
Norman Maurer
f478fcd3b0 [#1628] Fix bug in ReadOnlyByteByteBufferBuf where get operations threw ReadOnlyBufferException 2013-07-22 07:12:05 +02:00
Norman Maurer
feb8d101bd [#1626] Use static fields for default values 2013-07-22 06:47:29 +02:00
Shawn Silverman
674f4bce51 netty-1597: Rewrite ByteBufInputStream.readLine() to avoid IndexOutOfBoundsException and to behave more correctly for lines ending in '\r'. 2013-07-20 08:05:54 +02: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
f0a3f849f7 Fix a bug in AbstractByteBuf.writeZero() where the capacity is not auto-expanded 2013-07-18 09:55:02 +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
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
df5daadd0f Remove unused import 2013-07-15 10:09:17 +02:00
Norman Maurer
7254a5c2c6 Just some tiny javadocs optimizations 2013-07-14 16:02:03 +02:00
Trustin Lee
65c2a6ed46 Make ByteBuf an abstract class rather than an interface
- 5% improvement in throughput (HelloWorldServer example)
- Made CompositeByteBuf a concrete class (renamed from DefaultCompositeByteBuf) because there's no multiple inheritance in Java

Fixes #1536
2013-07-08 14:59:52 +09:00
Norman Maurer
086ae3536c [#1533] Introduce ByteBufHolder.duplicate() and make use of it in DefaultChannelGroup.write(...) 2013-07-06 21:17:51 +02:00
Norman Maurer
7dda4b9ce4 [#1532] Remove @deprecated ByteBufIndexFinder and all methods that take it as argument 2013-07-06 20:14:53 +02:00
Trustin Lee
dfc05a6ed7 Fix documentation error in ByteBuf
- Fixes #1531
- Thanks to @daschl
2013-07-05 17:03:34 +09:00
Trustin Lee
0b9235f072 Simplify ByteBufProcessor and MessageListProcessor and Add internal component accessors to CompositeByteBuf
- Fixes #1528

It's not really easy to provide a general-purpose abstraction for fast-yet-safe iteration. Instead of making forEachByte() less optimal, let's make it do what it does really well, and allow a user to implement potentially unsafe-yet-fast loop using unsafe operations.
2013-07-05 14:00:46 +09:00
Norman Maurer
7ec12d327f Remove deprecated ByteBufUtil.release(..) and ByteBufUtil.retain(..) methods and its usage. Also fix a problem where an object would have been released two times.
* The problem with the release(..) calls here was that it would have called release on an unsupported message and then throw an exception. This exception will trigger ChannelOutboundBuffer.fail(..), which will also try to release the message again.
* Also use the same exception type for unsupported messages as in other channel impls.
2013-07-03 10:00:13 +02: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
5d88c423df [#1500] Remove @deprecated methods 2013-07-01 08:53:02 +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
0dcf352f4c Vastly simplified ByteBufProcessor and MessageListProcessor
- Related: #1378
- They now accept only one argument.
- A user who wants to use a buffer for more complex use cases, he or she can always access the buffer directly via memoryAddress() and array()
2013-06-28 20:29:00 +09:00
Trustin Lee
52691488ee Update Javadoc of ByteBufProcessor and MessageListProcessor
- in response to @shacharo's suggestion
2013-06-27 19:01:01 +09:00
Trustin Lee
ac39cad5ff Split ByteBuf.forEachByte() into forEachByte() and forEachByteDesc()
- Related: #1378
- As suggested by @liqweed
2013-06-27 18:48:09 +09:00
Trustin Lee
9804741fb3 Fix test failure in SlicedByteBuf / Add tests for built-in ByteBufProcessor impls
- Related: #1378
2013-06-27 17:49:46 +09:00
Trustin Lee
98531313de Optimize derived buffers' forEachByte(...) implementation
- Related: #1378
2013-06-27 17:36:22 +09:00
Trustin Lee
b5bb36c087 Use (fromIndex, toIndex) instead of (index, length) for ByteBuf.forEachByte(...)
- Related: #1378
2013-06-27 17:30:19 +09:00
Trustin Lee
792edf631c Deprecate ByteBufIndexFinder
- Prefer ByteBufProcessor
- Related: #1378
2013-06-27 14:26:58 +09:00