Skip to content
Permalink
Branch: 4.1
Commits on Aug 22, 2019
  1. Update links to the latest HTTP/2 specifications (#9493)

    idelpivnitskiy authored and normanmaurer committed Aug 22, 2019
    Motivation:
    
    Some of the links in javadoc point to the obsolete drafts of HTTP/2
    specifications. We should point them to the latest RFC 7540 or 7541.
    
    Modifications:
    
    Update links from `draft-ietf-httpbis-*` to the `rfc7540` and `rfc7541`.
    
    Result:
    
    Correct links in javadoc.
  2. Use `AppendableCharSequence.charAtUnsafe(int)` in `HttpObjectDecoder` (

    idelpivnitskiy authored and normanmaurer committed Aug 22, 2019
    …#9492)
    
    Motivation:
    
    `HttpObjectDecoder` pre-checks that it doesn't request characters
    outside of the `AppendableCharSequence`'s length. `0` is always allowed
    because the minimal length of `AppendableCharSequence` is `1`. We can
    legally skip index check by using
    `AppendableCharSequence.charAtUnsafe(int)` in all existing cases in
    `HttpObjectDecoder`.
    
    Modifications:
    
    - Use `AppendableCharSequence.charAtUnsafe(int)` instead of
    `AppendableCharSequence.charAt(int)` in `HttpObjectDecoder`.
    
    Result:
    
    No unnecessary index checks in `HttpObjectDecoder`.
Commits on May 31, 2019
  1. Make UnpooledUnsafeHeapByteBuf class public (#9184)

    idelpivnitskiy authored and normanmaurer committed May 31, 2019
    Motivation:
    
    1. Users will be able to use an optimized version of
    `UnpooledHeapByteBuf` and override behavior of methods if required.
    2. Consistency with `UnpooledDirectByteBuf`, `UnpooledHeapByteBuf`, and
    `UnpooledUnsafeDirectByteBuf`.
    
    Modifications:
    
    - Add `public` access modifier to `UnpooledUnsafeHeapByteBuf` class and
    ctor;
    
    Result:
    
    Public access for optimized version of `UnpooledHeapByteBuf`.
Commits on Oct 23, 2017
  1. Update links for actual Protobuf repo and documentation

    idelpivnitskiy authored and normanmaurer committed Oct 22, 2017
    Motivation:
    
    Use actual links to new locations of Protobuf repo and documentation to
    avoid problems when redirect will not work.
    
    Modification:
    
    Links in comments and all/pom.xml
    
    Result:
    
    Correct links to Protobuf resources
Commits on Oct 22, 2017
  1. Make Comparators Serializable

    idelpivnitskiy authored and normanmaurer committed Oct 14, 2017
    Motivation:
    
    Objects of java.util.TreeMap or java.util.TreeSet will become
    non-Serializable if instantiated with Comparators, which are not also
     Serializable. This can result in unexpected and difficult-to-diagnose
     bugs.
    
    Modifications:
    
    Implements Serializable for all classes, which implements Comparator.
    
    Result:
    
    Proper Comparators which will not force collections to
    non-Serializable mode.
Commits on Oct 21, 2017
  1. Make methods 'static' where it possible

    idelpivnitskiy authored and normanmaurer committed Oct 14, 2017
    Motivation:
    
    Even if it's a super micro-optimization (most JVM could optimize such
     cases in runtime), in theory (and according to some perf tests) it
     may help a bit. It also makes a code more clear and allows you to
     access such methods in the test scope directly, without instance of
     the class.
    
    Modifications:
    
    Add 'static' modifier for all methods, where it possible. Mostly in
    test scope.
    
    Result:
    
    Cleaner code with proper 'static' modifiers.
  2. Add missed 'serialVersionUID' field for Serializable classes

    idelpivnitskiy authored and normanmaurer committed Oct 14, 2017
    Motivation:
    
    Without a 'serialVersionUID' field, any change to a class will make
    previously serialized versions unreadable.
    
    Modifications:
    
    Add missed 'serialVersionUID' field for all Serializable
    classes.
    
    Result:
    
    Proper deserialization of previously serialized objects.
Commits on May 11, 2015
  1. Update compression dependencies

    idelpivnitskiy authored and normanmaurer committed May 11, 2015
    Motivation:
    
    New versions of compression libraries, which improve their performance and fix some bugs.
    
    Modifications:
    
    Updated versions of jzlib, compress-lzf, lz4 and commons-compres libraries.
    
    Result:
    
    Better stability and performance of compression codecs.
Commits on Apr 10, 2015
  1. Refactor tests for compression codecs

    idelpivnitskiy authored and normanmaurer committed Mar 18, 2015
    Motivation:
    
    Too many duplicated code of tests for different compression codecs.
    
    Modifications:
    
    - Added abstract classes AbstractCompressionTest, AbstractDecoderTest and AbstractEncoderTest which contains common variables and tests for any compression codec.
    - Removed common tests which are implemented in AbstractDecoderTest and AbstractEncoderTest from current tests for compression codecs.
    - Implemented abstract methods of AbstractDecoderTest and AbstractEncoderTest in current tests for compression codecs.
    - Added additional checks for current tests.
    - Renamed abstract class IntegrationTest to AbstractIntegrationTest.
    - Used Theories to run tests with head and direct buffers.
    - Removed code duplicates.
    
    Result:
    
    Removed duplicated code of tests for compression codecs and simplified an addition of tests for new compression codecs.
Commits on Mar 17, 2015
  1. Update jUnit version to 4.12

    idelpivnitskiy authored and normanmaurer committed Mar 16, 2015
    Motivation:
    
    Too many new features in the new release of jUnit.
    https://github.com/junit-team/junit/blob/master/doc/ReleaseNotes4.12.md
    
    Modifications:
    
    - Changed version of jUnit from 4.11 to 4.12 in the parent pom.
    
    Result:
    
    Allows using new testing features.
Commits on Nov 20, 2014
  1. Small performance improvements

    idelpivnitskiy authored and Scottmitch committed Nov 8, 2014
    Motivation:
    
    Found performance issues via FindBugs and PMD.
    
    Modifications:
    
    - Removed unnecessary boxing/unboxing operations in DefaultTextHeaders.convertToInt(CharSequence) and DefaultTextHeaders.convertToLong(CharSequence). A boxed primitive is created from a string, just to extract the unboxed primitive value.
    - Added a static modifier for DefaultHttp2Connection.ParentChangedEvent class. This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.
    - Added a static compiled Pattern to avoid compile it each time it is used when we need to replace some part of authority.
    - Improved using of StringBuilders.
    
    Result:
    
    Performance improvements.
Commits on Nov 12, 2014
  1. Rewrite HttpObjectDecoder to make use of proper state machine

    idelpivnitskiy authored and normanmaurer committed Nov 4, 2014
    Motivation:
    
    HttpObjectDecoder extended ReplayDecoder which is slightly slower then ByteToMessageDecoder.
    
    Modifications:
    
    - Changed super class of HttpObjectDecoder from ReplayDecoder to ByteToMessageDecoder.
    - Rewrote decode() method of HttpObjectDecoder to use proper state machine.
    - Changed private methods HeaderParser.parse(ByteBuf), readHeaders(ByteBuf) and readTrailingHeaders(ByteBuf), skipControlCharacters(ByteBuf) to consider available bytes.
    - Set HeaderParser and LineParser as static inner classes.
    - Replaced not safe actualReadableBytes() with buffer.readableBytes().
    
    Result:
    
    Improved performance of HttpObjectDecoder by approximately 177%.
Commits on Oct 20, 2014
  1. Refactor LzfDecoder to use proper state machine

    idelpivnitskiy authored and normanmaurer committed Oct 19, 2014
    Motivation:
    
    Make it much more readable code.
    
    Modifications:
    
    - Added states of decompression.
    - Refactored decode(...) method to use this states.
    
    Result:
    
    Much more readable decoder which looks like other compression decoders.
Commits on Sep 19, 2014
  1. Fixed typo in LzmaFrameEncoder constructor

    idelpivnitskiy authored and normanmaurer committed Sep 15, 2014
    Motivation:
    
    A discovered typo in LzmaFrameEncoder constructor when we check `lc + lp` for better compatibility.
    
    Modifications:
    
    Changed `lc + pb` to `lc + lp`.
    
    Result:
    
    Correct check of `lc + lp` value.
Commits on Sep 15, 2014
  1. Implemented LZMA frame encoder

    idelpivnitskiy authored and Norman Maurer committed Sep 15, 2014
    Motivation:
    
    LZMA compression algorithm has a very good compression ratio.
    
    Modifications:
    
    - Added `lzma-java` library which implements LZMA algorithm.
    - Implemented LzmaFrameEncoder which extends MessageToByteEncoder and provides compression of outgoing messages.
    - Added tests to verify the LzmaFrameEncoder and how it can compress data for the next uncompression using the original library.
    
    Result:
    
    LZMA encoder which can compress data using LZMA algorithm.
Commits on Aug 14, 2014
  1. Implemented LZ4 compression codec

    idelpivnitskiy authored and trustin committed Aug 5, 2014
    Motivation:
    
    LZ4 compression codec provides sending and receiving data encoded by very fast LZ4 algorithm.
    
    Modifications:
    
    - Added `lz4` library which implements LZ4 algorithm.
    - Implemented Lz4FramedEncoder which extends MessageToByteEncoder and provides compression of outgoing messages.
    - Added tests to verify the Lz4FramedEncoder and how it can compress data for the next uncompression using the original library.
    - Implemented Lz4FramedDecoder which extends ByteToMessageDecoder and provides uncompression of incoming messages.
    - Added tests to verify the Lz4FramedDecoder and how it can uncompress data after compression using the original library.
    - Added integration tests for Lz4FramedEncoder/Decoder.
    
    Result:
    
    Full LZ4 compression codec which can compress/uncompress data using LZ4 algorithm.
Commits on Aug 12, 2014
  1. Implemented FastLZ compression codec

    idelpivnitskiy authored and trustin committed Aug 11, 2014
    Motivation:
    
    FastLZ compression codec provides sending and receiving data encoded by fast FastLZ algorithm using block mode.
    
    Modifications:
    
    - Added part of `jfastlz` library which implements FastLZ algorithm. See FastLz class.
    - Implemented FastLzFramedEncoder which extends MessageToByteEncoder and provides compression of outgoing messages.
    - Implemented FastLzFramedDecoder which extends ByteToMessageDecoder and provides uncompression of incoming messages.
    - Added integration tests for `FastLzFramedEncoder/Decoder`.
    
    Result:
    
    Full FastLZ compression codec which can compress/uncompress data using FastLZ algorithm.
Commits on Aug 5, 2014
  1. Consider writerIndex when LzfDecoder writes into a new heap buffer

    idelpivnitskiy authored and Norman Maurer committed Aug 5, 2014
    Motivation:
    
    Now LzfDecoder do not consider writerIndex when it writes into array of a new heap buffer (when it decodes a compressed chuck of data)
Commits on Aug 4, 2014
  1. Improve Bzip2BitReader/Writer

    idelpivnitskiy authored and Norman Maurer committed Jul 25, 2014
    Motivation:
    
    Before this changes Bzip2BitReader and Bzip2BitWriter accessed to ByteBuf byte by byte. So tests for Bzip2 compression codec takes a lot of time if we ran them with paranoid level of resource leak detection. For more information see comments to #2681 and #2689.
    
    Modifications:
    
    - Increased size of bit buffers from 8 to 64 bits.
    - Improved reading and writing operations.
    - Save link to incoming ByteBuf inside Bzip2BitReader.
    - Added methods to check possible readable bits and bytes in Bzip2BitReader.
    - Updated Bzip2 classes to use new API of Bzip2BitReader.
    - Added new constants to Bzip2Constants.
    
    Result:
    
    Increased size of bit buffers and improved performance of Bzip2 compression codec (for general work by 13% and for tests with paranoid level of resource leak detection by 55%).
Commits on Jul 23, 2014
  1. Refactor Bzip2 tests

    idelpivnitskiy authored and Norman Maurer committed Jul 23, 2014
    Motivation:
    
    Complicated code of Bzip2 tests with some unnecessary actions.
    
    Modifications:
    
    - Reduce size of BYTES_LARGE array of random test data for Bzip2  tests.
    - Removed unnecessary creations of EmbeddedChannel instances in Bzip2 tests.
    - Simplified tests in Bzip2DecoderTest which expect exception.
    - Removed unnecessary testStreamInitialization() from Bzip2EncoderTest.
    
    Result:
    
    Reduced time to test the 'codec' package by 7 percent, simplified code of Bzip2 tests.
  2. Refactor integration tests of compression codecs

    idelpivnitskiy authored and Norman Maurer committed Jul 23, 2014
    Motivation:
    
    Duplicated code of integration tests for different compression codecs.
    
    Modifications:
    
    - Added abstract class IntegrationTest which contains common tests for any compression codec.
    - Removed common tests from Bzip2IntegrationTest and LzfIntegrationTest.
    - Implemented abstract methods of IntegrationTest in Bzip2IntegrationTest, LzfIntegrationTest and SnappyIntegrationTest.
    
    Result:
    
    Removed duplicated code of integration tests for compression codecs and simplified an addition of integration tests for new compression codecs.
Commits on Jul 22, 2014
  1. Simplify Bzip2 tests

    idelpivnitskiy authored and Norman Maurer committed Jul 22, 2014
    Motivation:
    
    Sometimes we have a 'build time out' error because tests for bzip2 codec take a long time.
    
    Modifications:
    
    Removed cycles from Bzip2EncoderTest.testCompression(byte[]) and Bzip2DecoderTest.testDecompression(byte[]).
    
    Result:
    
    Reduced time to test the 'codec' package by 30 percent.
Commits on Jul 20, 2014
  1. Fix NPE problems

    idelpivnitskiy authored and Norman Maurer committed Jul 19, 2014
    Motivation:
    
    Now Netty has a few problems with null values.
    
    Modifications:
    
    - Check HAProxyProxiedProtocol in HAProxyMessage constructor and throw NPE if it is null.
    If HAProxyProxiedProtocol is null we will set AddressFamily as null. So we will get NPE inside checkAddress(String, AddressFamily) and it won't be easy to understand why addrFamily is null.
    - Check File in DiskFileUpload.toString().
    If File is null we will get NPE when calling toString() method.
    - Check Result<String> in MqttDecoder.decodeConnectionPayload(...).
    If !mqttConnectVariableHeader.isWillFlag() || !mqttConnectVariableHeader.hasUserName() || !mqttConnectVariableHeader.hasPassword() we will get NPE when we will try to create new instance of MqttConnectPayload.
    - Check Unsafe before calling unsafe.getClass() in PlatformDependent0 static block.
    - Removed unnecessary null check in WebSocket08FrameEncoder.encode(...).
    Because msg.content() can not return null.
    - Removed unnecessary null check in DefaultStompFrame(StompCommand) constructor.
    Because we have this check in the super class.
    - Removed unnecessary null checks in ConcurrentHashMapV8.removeTreeNode(TreeNode<K,V>).
    - Removed unnecessary null check in OioDatagramChannel.doReadMessages(List<Object>).
    Because tmpPacket.getSocketAddress() always returns new SocketAddress instance.
    - Removed unnecessary null check in OioServerSocketChannel.doReadMessages(List<Object>).
    Because socket.accept() always returns new Socket instance.
    - Pass Unpooled.buffer(0) instead of null inside CloseWebSocketFrame(boolean, int) constructor.
    If we will pass null we will get NPE in super class constructor.
    - Added throw new IllegalStateException in GlobalEventExecutor.awaitInactivity(long, TimeUnit) if it will be called before GlobalEventExecutor.execute(Runnable).
    Because now we will get NPE. IllegalStateException will be better in this case.
    - Fixed null check in OpenSslServerContext.setTicketKeys(byte[]).
    Now we throw new NPE if byte[] is not null.
    
    Result:
    
    Added new null checks when it is necessary, removed unnecessary null checks and fixed some NPE problems.
  2. Small fixes and improvements

    idelpivnitskiy authored and Norman Maurer committed Jul 19, 2014
    Motivation:
    
    Fix some typos in Netty.
    
    Modifications:
    
    - Fix potentially dangerous use of non-short-circuit logic in Recycler.transfer(Stack<?>).
    - Removed double 'the the' in javadoc of EmbeddedChannel.
    - Write to log an exception message if we can not get SOMAXCONN in the NetUtil's static block.
  3. Fixes for compression codecs

    idelpivnitskiy authored and Norman Maurer committed Jul 19, 2014
    Motivation:
    
    Fixed founded mistakes in compression codecs.
    
    Modifications:
    
    - Changed return type of ZlibUtil.inflaterException() from CompressionException to DecompressionException
    - Updated @throws in javadoc of JZlibDecoder to throw DecompressionException instead of CompressionException
    - Fixed JdkZlibDecoder to throw DecompressionException instead of CompressionException
    - Removed unnecessary empty lines in JdkZlibEncoder and JZlibEncoder
    - Removed public modifier from Snappy class
    - Added MAX_UNCOMPRESSED_DATA_SIZE constant in SnappyFramedDecoder
    - Used in.readableBytes() instead of (in.writerIndex() - in.readerIndex()) in SnappyFramedDecoder
    - Added private modifier for enum ChunkType in SnappyFramedDecoder
    - Fixed potential bug (sum overflow) in Bzip2HuffmanAllocator.first(). For more info, see http://googleresearch.blogspot.ru/2006/06/extra-extra-read-all-about-it-nearly.html
    
    Result:
    
    Fixed sum overflow in Bzip2HuffmanAllocator, improved exceptions in ZlibDecoder implementations, hid Snappy class
  4. Small performance improvements

    idelpivnitskiy authored and Norman Maurer committed Jul 19, 2014
    Modifications:
    
    - Added a static modifier for CompositeByteBuf.Component.
    This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.
    - Removed unnecessary boxing/unboxing operations in HttpResponseDecoder, RtspResponseDecoder, PerMessageDeflateClientExtensionHandshaker and PerMessageDeflateServerExtensionHandshaker
    A boxed primitive is created from a String, just to extract the unboxed primitive value.
    - Removed unnecessary 3 times calculations in DiskAttribute.addContent(...).
    - Removed unnecessary checks if file exists before call mkdirs() in NativeLibraryLoader and PlatformDependent.
    Because the method mkdirs() has this check inside.
    - Removed unnecessary `instanceof AsciiString` check in StompSubframeAggregator.contentLength(StompHeadersSubframe) and StompSubframeDecoder.getContentLength(StompHeaders, long).
    Because StompHeaders.get(CharSequence) always returns java.lang.String.
  5. Close ObjectInputStream in ObjectDecoder.decode(...)

    idelpivnitskiy authored and Norman Maurer committed Jul 19, 2014
    Motivation:
    
    We create a new CompactObjectInputStream with ByteBufInputStream in ObjectDecoder.decode(...) method and don't close this InputStreams before return statement.
    
    Modifications:
    
    Save link to the ObjectInputStream and close it before return statement.
    
    Result:
    
    Close InputStreams and clean up unused resources. It will be better for GC.
Commits on Jul 17, 2014
  1. Implemented a Bzip2Encoder

    idelpivnitskiy authored and Norman Maurer committed Jul 17, 2014
    Motivation:
    
    Bzip2Encoder provides sending data compressed in bzip2 format.
    
    Modifications:
    
    Added classes:
    - Bzip2Encoder
    - Bzip2BitWriter
    - Bzip2BlockCompressor
    - Bzip2DivSufSort
    - Bzip2HuffmanAllocator
    - Bzip2HuffmanStageEncoder
    - Bzip2MTFAndRLE2StageEncoder
    - Bzip2EncoderTest
    
    Modified classes:
    - Bzip2Constants (splited BLOCK_HEADER_MAGIC and END_OF_STREAM_MAGIC)
    - Bzip2Decoder (use splited magic numbers)
    
    Added integration tests for Bzip2Encoder/Decoder
    
    Result:
    
    Implemented new encoder which can compress outgoing data in bzip2 format.
  2. Implemented LZF compression codec

    idelpivnitskiy authored and Norman Maurer committed Jul 14, 2014
    Motivation:
    
    LZF compression codec provides sending and receiving data encoded by very fast LZF algorithm.
    
    Modifications:
    
    - Added Compress-LZF library which implements LZF algorithm
    - Implemented LzfEncoder which extends MessageToByteEncoder and provides compression of outgoing messages
    - Added tests to verify the LzfEncoder and how it can compress data for the next uncompression using the original library
    - Implemented LzfDecoder which extends ByteToMessageDecoder and provides uncompression of incoming messages
    - Added tests to verify the LzfDecoder and how it can uncompress data after compression using the original library
    - Added integration tests for LzfEncoder/Decoder
    
    Result:
    
    Full LZF compression codec which can compress/uncompress data using LZF algorithm.
Commits on Jul 9, 2014
  1. Moved bit-level read operations from Bzip2Decoder to the new Bzip2Bit…

    idelpivnitskiy authored and Norman Maurer committed Jul 6, 2014
    …Reader
    
    Motivation:
    
    Collect all bit-level read operations in one class is better. And now it's easy to use not only in Bzip2Decoder. For example, in Bzip2HuffmanStageDecoder.
    
    Modifications:
    
    Created a new class - Bzip2BitReader which provides bit-level reads.
    Removed bit-level read operations from Bzip2Decoder.
    Improved javadoc.
    
    Result:
    
    Bzip2BitReader allows the reading of single bit booleans, bit strings of arbitrary length (up to 24 bits), and bit aligned 32-bit integers.
Commits on Jun 24, 2014
  1. Implement a Bzip2Decoder

    idelpivnitskiy authored and trustin committed Jun 16, 2014
    Motivation:
    
    Bzip2Decoder provides receiving data compressed in bzip2 format.
    
    Modifications:
    
    Added classes:
    - Bzip2Decoder
    - Bzip2Constants
    - Bzip2BlockDecompressor
    - Bzip2HuffmanStageDecoder
    - Bzip2MoveToFrontTable
    - Bzip2Rand
    - Crc32
    - Bzip2DecoderTest
    
    Result:
    
    Implemented and tested new decoder which can uncompress incoming data in bzip2 format.
Commits on Mar 23, 2014
  1. Allow specifying `SelectorProvider` when constructing an NIO channel #…

    idelpivnitskiy authored and Norman Maurer committed Mar 23, 2014
    …2311
    
    Motivation:
    
    At the moment we use the system-wide default selector provider for this invocation of the Java virtual machine when constructing a new NIO channel, which makes using an alternative SelectorProvider practically useless.
    This change allows user specify his/her preferred SelectorProvider.
    
    Modifications:
    
    Add SelectorProvider as a param for current `private static *Channel newSocket` method of NioSocketChannel, NioServerSocketChannel and NioDatagramChannel.
    Change default constructors of NioSocketChannel, NioServerSocketChannel and NioDatagramChannel to use DEFAULT_SELECTOR_PROVIDER when calling newSocket(SelectorProvider).
    Add new constructors for NioSocketChannel, NioServerSocketChannel and NioDatagramChannel which allow user specify his/her preferred SelectorProvider.
    
    Result:
    
    Now users can specify his/her preferred SelectorProvider when constructing an NIO channel.
You can’t perform that action at this time.