Netty

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Add logLevel property to enable different log levels for the examples.

Motivation:

When running the examples using the provided run-examples.sh script the

log level is 'info' level. It can be handy to be able to configure a

different level, for example 'debug', while learning and trying out the

the examples.

Modifications:

Added a dependency to logback-classic to the examples pom.xml, and also

added a logback configuration file. The log level can be configured by

setting the 'logLevel' system property, and if that property is not set

the default will be 'info' level.

The run-examples.sh was updated to show an example of using the system

property to set the log level to 'debug'

Result:

It is now possible to turn on debug logging by settnig a system property

on the command line.

    • -0
    • +11
    /example/src/main/resources/logback.xml
Add logLevel property to enable different log levels for the examples.

Motivation:

When running the examples using the provided run-examples.sh script the

log level is 'info' level. It can be handy to be able to configure a

different level, for example 'debug', while learning and trying out the

the examples.

Modifications:

Added a dependency to logback-classic to the examples pom.xml, and also

added a logback configuration file. The log level can be configured by

setting the 'logLevel' system property, and if that property is not set

the default will be 'info' level.

The run-examples.sh was updated to show an example of using the system

property to set the log level to 'debug'

Result:

It is now possible to turn on debug logging by settnig a system property

on the command line.

    • -0
    • +11
    /example/src/main/resources/logback.xml
Small performance improvements

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.

  1. … 35 more files in changeset.
Small performance improvements

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.

  1. … 16 more files in changeset.
Small performance improvements

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.

  1. … 32 more files in changeset.
Allow to enable/disable protocols on the OpenSslEngine

Motivation:

To be compatible with SSLEngine we need to support enable / disable procols on the OpenSslEngine

Modifications:

Implement OpenSslEngine.getSupportedProtocols() , getEnabledProtocols() and setEnabledProtocols(...)

Result:

Better compability with SSLEngine

Allow to enable/disable protocols on the OpenSslEngine

Motivation:

To be compatible with SSLEngine we need to support enable / disable procols on the OpenSslEngine

Modifications:

Implement OpenSslEngine.getSupportedProtocols() , getEnabledProtocols() and setEnabledProtocols(...)

Result:

Better compability with SSLEngine

Allow to enable/disable protocols on the OpenSslEngine

Motivation:

To be compatible with SSLEngine we need to support enable / disable procols on the OpenSslEngine

Modifications:

Implement OpenSslEngine.getSupportedProtocols() , getEnabledProtocols() and setEnabledProtocols(...)

Result:

Better compability with SSLEngine

Benchmark for HttpRequestDecoder

Benchmark for HttpRequestDecoder

Benchmark for HttpRequestDecoder

Make SslProvider.JDK the default provider for http2 examples using ALPN.

Motivation:

When running the http2 example no SslProvider is specified when calling

SslContext.newServerContext. This may lead to the provider being

determined depending on the availabilty of OpenSsl. But as far as I can

tell the OpenSslServerContext does not support APLN, which is the

protocol configured in the example.

This produces the following error when running the example:

Exception in thread "main" java.lang.UnsupportedOperationException:

OpenSSL provider does not support ALPN protocol

io.netty.handler.ssl.OpenSslServerContext.toNegotiator(OpenSslServerContext.java:391)

io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:117)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:238)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:184)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:124)

io.netty.example.http2.server.Http2Server.main(Http2Server.java:51)

Modifications:

Force SslProvider.JDK when creating the SslContext since the

example is using APLN.

Result:

There is no longer an error if OpenSsl is supported on the platform in

use.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Minor corrections to Http2 example javadocs.

Motivation:

There are a few very minor issues in the Http2 examples javadoc and

since I don't think that these javadocs are published this is very much

optional to include.

Modifications:

Updated the @see according to [1] to avoid warning when generating

javadocs.

Result:

No warning when generating javadocs.

[1] http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@see

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

HTTP/2 Data Compressor

Motivation:

The HTTP/2 codec currently does not provide an interface to compress data. There is an analogous case to this in the HTTP codec and it is expected to be used commonly enough that it will be beneficial to have the feature in the http2-codec.

Modifications:

- Add a class which extends DefaultHttp2ConnectionEncoder and provides hooks to an EmbeddedChannel

- Add a compressor element to the Http2Stream interface

- Update unit tests to utilize the new feature

Result:

HTTP/2 codec supports data compression.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Rewrite HttpObjectDecoder to make use of proper state machine

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%.

Rewrite HttpObjectDecoder to make use of proper state machine

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%.

Rewrite HttpObjectDecoder to make use of proper state machine

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%.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

Explicit allow to enable / disable session cache

Motivation:

It is sometimes useful to enable / disable the session cache.

Modifications:

* Add OpenSslSessionContext.setSessionCacheEnabled(...) and isSessionCacheEnabled()

Result:

It is now possible to enable / disable cache on the fly