added overloaded method to the DefaultChannelPipeline in order to avoid unnecessary allocation

Motivation :

Avoid unnecessary array allocation when using the function with varargs in the DefaultChannelPipeline class.

Modifications :

Added addLast and addFirst overloaded methods with 1 handler instead of varargs.

Result :

No array allocation when using simple construction like pipeline.addLast(new Handler());
This commit is contained in:
Dmitriy Dumanskiy 2017-12-16 15:36:15 +02:00 committed by Norman Maurer
parent 55ef09f191
commit f9888acfdd

View File

@ -354,6 +354,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
ctx.next = newCtx;
}
public final ChannelPipeline addFirst(ChannelHandler handler) {
return addFirst(null, handler);
}
@Override
public final ChannelPipeline addFirst(ChannelHandler... handlers) {
return addFirst(null, handlers);
@ -383,6 +387,10 @@ public class DefaultChannelPipeline implements ChannelPipeline {
return this;
}
public final ChannelPipeline addLast(ChannelHandler handler) {
return addLast(null, handler);
}
@Override
public final ChannelPipeline addLast(ChannelHandler... handlers) {
return addLast(null, handlers);