chibenwa commented on a change in pull request #886:
URL: https://github.com/apache/james-project/pull/886#discussion_r808646181
##########
File path:
protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
##########
@@ -27,17 +27,24 @@
import org.apache.james.protocols.api.ProtocolServer;
import org.apache.james.util.concurrent.NamedThreadFactory;
-import org.jboss.netty.bootstrap.ServerBootstrap;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.channel.group.DefaultChannelGroup;
-import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
-import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
-import org.jboss.netty.util.ExternalResourceReleasable;
import com.google.common.collect.ImmutableList;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.group.ChannelGroup;
+import io.netty.channel.group.DefaultChannelGroup;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.util.concurrent.GlobalEventExecutor;
+
+
+
+
Review comment:
```suggestion
```
##########
File path: pom.xml
##########
@@ -2355,7 +2355,7 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
+ <artifactId>netty-all</artifactId>
Review comment:
I have the impression netty-all brings a lot of unrelated dependencies
that we night not be needing (eg `netty-codec-redis` memcached, stomp, etc...
https://mvnrepository.com/artifact/io.netty/netty-all/4.1.72.Final .
Being finner grained on our dependency management and pulling only the Netty
components we need might definitly be beneficial.
##########
File path: protocols/smtp/pom.xml
##########
@@ -84,7 +84,8 @@
</dependency>
<dependency>
<groupId>io.netty</groupId>
- <artifactId>netty</artifactId>
+ <artifactId>netty-all</artifactId>
+ <version>4.1.72.Final</version>
Review comment:
We should not duplicate versions specified in `james-project/pom.xml` as
it makes it too easy to miss some versions to update during update processes.
##########
File path:
protocols/netty/src/main/java/org/apache/james/protocols/netty/AllButStartTlsLineBasedChannelHandler.java
##########
@@ -23,44 +23,49 @@
import java.util.Locale;
import org.apache.james.protocols.api.CommandDetectionSession;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelPipeline;
+import io.netty.handler.codec.LineBasedFrameDecoder;
+import io.netty.util.AttributeKey;
+
+
public class AllButStartTlsLineBasedChannelHandler extends
LineBasedFrameDecoder {
private static final Boolean FAIL_FAST = true;
private final ChannelPipeline pipeline;
private final String pattern;
+ private final AttributeKey<CommandDetectionSession> sessionAttributeKey =
Review comment:
Looks like this could be static!
##########
File path:
server/protocols/protocols-managesieve/src/main/java/org/apache/james/managesieveserver/netty/ManageSieveServer.java
##########
@@ -78,22 +77,27 @@ protected String getDefaultJMXName() {
}
@Override
- protected ChannelUpstreamHandler createCoreHandler() {
+ protected ChannelInboundHandlerAdapter createCoreHandler() {
return new ManageSieveChannelUpstreamHandler(manageSieveProcessor,
getEncryption(),
LOGGER);
}
@Override
- protected ChannelPipelineFactory createPipelineFactory(final ChannelGroup
group) {
+ protected AbstractChannelPipelineFactory createPipelineFactory(final
ChannelGroup group) {
+
+ return new AbstractChannelPipelineFactory(0,0, 0, group,
createFrameHandlerFactory()) {
Review comment:
```suggestion
return new AbstractChannelPipelineFactory(0, 0, 0, group,
createFrameHandlerFactory()) {
```
And idem we likely should extract these 0 magic numbers to named constants
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/OioIMAPServer.java
##########
@@ -1,51 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.imapserver.netty;
-
-import org.apache.james.imap.api.process.ImapProcessor;
-import org.apache.james.imap.decode.ImapDecoder;
-import org.apache.james.imap.encode.ImapEncoder;
-import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
-import org.jboss.netty.channel.socket.oio.OioServerSocketChannelFactory;
-import org.jboss.netty.handler.execution.ExecutionHandler;
-
-/**
- * IMAPServer which use old IO and not NIO. If you want to use NIO you should
- * use {@link IMAPServer}
- */
-public class OioIMAPServer extends IMAPServer {
Review comment:
:+1: to remove the `Oio` stuff
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java
##########
@@ -167,53 +168,51 @@ protected Object decode(ChannelHandlerContext ctx,
Channel channel, ChannelBuffe
reader.consumeLine();
}
- ((SwitchableLineBasedFrameDecoder)
channel.getPipeline().get(FRAMER)).enableFraming();
+ ((SwitchableLineBasedFrameDecoder)
ctx.channel().pipeline().get(FRAMER)).enableFraming();
attachment.clear();
- return message;
+ out.add(message);
} catch (NettyImapRequestLineReader.NotEnoughDataException e) {
// this exception was thrown because we don't have enough data
// yet
int neededData = e.getNeededSize();
// store the needed data size for later usage
attachment.put(NEEDED_DATA, neededData);
- final ChannelPipeline pipeline = channel.getPipeline();
- final ChannelHandlerContext framerContext =
pipeline.getContext(FRAMER);
+ final ChannelPipeline pipeline = ctx.channel().pipeline();
+ final ChannelHandlerContext framerContext =
pipeline.context(FRAMER);
// SwitchableDelimiterBasedFrameDecoder added further to
JAMES-1436.
final SwitchableLineBasedFrameDecoder framer =
(SwitchableLineBasedFrameDecoder) pipeline.get(FRAMER);
framer.disableFraming(framerContext);
- buffer.resetReaderIndex();
- return null;
+ in.resetReaderIndex();
}
} else {
// The session was null so may be the case because the channel was
already closed but there were still bytes in the buffer.
// We now try to disconnect the client if still connected
- if (channel.isConnected()) {
-
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
+ if (ctx.channel().isActive()) {
+
ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}
- return null;
}
}
- @Override
- protected synchronized ChannelBuffer
newCumulationBuffer(ChannelHandlerContext ctx, int minimumCapacity) {
- Map<String, Object> attachment = (Map<String, Object>)
ctx.getAttachment();
- Object sizeAsObject = attachment.get(NEEDED_DATA);
- if (sizeAsObject != null) {
- @SuppressWarnings("unchecked")
- int size = (Integer) sizeAsObject;
-
- if (size > 0) {
- int sanitizedInMemorySizeLimit = Math.max(0,
inMemorySizeLimit);
- int sanitizedSize = Math.min(sanitizedInMemorySizeLimit, size);
-
- return ChannelBuffers.dynamicBuffer(sanitizedSize,
ctx.getChannel().getConfig().getBufferFactory());
- }
- }
- return super.newCumulationBuffer(ctx, minimumCapacity);
- }
+ // @Override
+ // protected synchronized ByteBuf
newCumulationBuffer(ChannelHandlerContext ctx, int minimumCapacity) {
+ // Map<String, Object> attachment = (Map<String, Object>)
ctx.channel().attr(FRAME_DECODE_ATTACHMENT_ATTRIBUTE_KEY).get();
+ // Object sizeAsObject = attachment.get(NEEDED_DATA);
+ // if (sizeAsObject != null) {
+ // @SuppressWarnings("unchecked")
+ // int size = (Integer) sizeAsObject;
+ //
+ // if (size > 0) {
+ // int sanitizedInMemorySizeLimit = Math.max(0,
inMemorySizeLimit);
+ // int sanitizedSize = Math.min(sanitizedInMemorySizeLimit,
size);
+ //
+ // return ChannelBuffers.dynamicBuffer(sanitizedSize,
ctx.channel().config().getBufferFactory());
+ // }
+ // }
+ // return super.newCumulationBuffer(ctx, minimumCapacity);
+ // }
Review comment:
Remove commented code. We have the git history if we need to find it
back!
```suggestion
```
##########
File path: pom.xml
##########
@@ -610,7 +610,7 @@
<junit.vintage.version>5.7.0</junit.vintage.version>
<concurrent.version>1.3.4</concurrent.version>
<xbean-spring.version>4.18</xbean-spring.version>
- <netty.version>3.10.6.Final</netty.version>
+ <netty.version>4.1.72.Final</netty.version>
Review comment:
Please reuse this version in `server/blobs/blob-s3`... We need to ensure
these versions are aligned,
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyImapRequestLineReader.java
##########
@@ -105,8 +106,8 @@ public Literal read(int size, boolean extraCRLF) throws
DecodingException {
try {
- // limit the size via commons-io as ChannelBufferInputStream size
limiting is buggy
- InputStream in = new BoundedInputStream(new
ChannelBufferInputStream(buffer), size);
+ // limit the size via commons-io as ByteBufInputStream size
limiting is buggy
Review comment:
Question: is this still true?
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
##########
@@ -209,21 +208,25 @@ public String getServiceType() {
}
@Override
- protected ChannelPipelineFactory createPipelineFactory(final ChannelGroup
group) {
+ protected AbstractChannelPipelineFactory createPipelineFactory(final
ChannelGroup group) {
- return new ChannelPipelineFactory() {
-
+ return new AbstractChannelPipelineFactory(0, 0, 0, group,
getFrameHandlerFactory()) {
+
+ @Override
+ protected ChannelInboundHandlerAdapter createHandler() {
+ return createCoreHandler();
+ }
+
private final ChannelGroupHandler groupHandler = new
ChannelGroupHandler(group);
- private final HashedWheelTimer timer = new HashedWheelTimer();
-
+
private final TimeUnit timeoutUnit = TimeUnit.SECONDS;
@Override
- public ChannelPipeline getPipeline() throws Exception {
- ChannelPipeline pipeline = pipeline();
+ public void initChannel(Channel channel) throws Exception {
+ ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast(GROUP_HANDLER, groupHandler);
- pipeline.addLast("idleHandler", new IdleStateHandler(timer, 0,
0, timeout, timeoutUnit));
- pipeline.addLast(TIMEOUT_HANDLER, new ImapIdleStateHandler());
+ pipeline.addLast("idleHandler", new IdleStateHandler(0, 0,
timeout, timeoutUnit));
+ pipeline.addLast(TIMEOUT_HANDLER, new
ImapIdleStateHandler(0,0, timeout));
Review comment:
Idem that is a very good opportunity to name these `0` `0`constants as
well...
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoder.java
##########
@@ -94,31 +95,31 @@ protected Object decode(ChannelHandlerContext ctx, Channel
channel, ChannelBuffe
final File f;
int written;
- OutputStream out;
+ OutputStream os;
// check if we have created a temporary file already or if
// we need to create a new one
if (attachment.containsKey(STORED_DATA)) {
f = (File) attachment.get(STORED_DATA);
written = (Integer) attachment.get(WRITTEN_DATA);
- out = (OutputStream) attachment.get(OUTPUT_STREAM);
+ os = (OutputStream) attachment.get(OUTPUT_STREAM);
Review comment:
I would suggest to rename `os` to `outputStream`
##########
File path:
server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoderTest.java
##########
@@ -46,35 +37,35 @@ void setUp() {
18);
}
- @Test
- void newCumulationBufferShouldNotThrowWhenNoAttachments() {
- ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
- Channel channel = mock(Channel.class);
- ChannelConfig channelConfig = mock(ChannelConfig.class);
+// @Test
+// void newCumulationBufferShouldNotThrowWhenNoAttachments() {
+// ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
+// Channel channel = mock(Channel.class);
+// ChannelConfig channelConfig = mock(ChannelConfig.class);
+//
+// //
when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class));
+// when(channelHandler.channel()).thenReturn(channel);
+// when(channel.config()).thenReturn(channelConfig);
+//
+//
when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String,
Object>of());
+//
+// assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36))
+// .doesNotThrowAnyException();
+// }
-
when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class));
- when(channelHandler.getChannel()).thenReturn(channel);
- when(channel.getConfig()).thenReturn(channelConfig);
-
- when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String,
Object>of());
-
- assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36))
- .doesNotThrowAnyException();
- }
-
- @Test
- void newCumulationBufferShouldNotThrowOnNegativeSize() {
- ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
- Channel channel = mock(Channel.class);
- ChannelConfig channelConfig = mock(ChannelConfig.class);
-
-
when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class));
- when(channelHandler.getChannel()).thenReturn(channel);
- when(channel.getConfig()).thenReturn(channelConfig);
-
- when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String,
Object>of(NEEDED_DATA, -1));
-
- assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36))
- .doesNotThrowAnyException();
- }
+// @Test
+// void newCumulationBufferShouldNotThrowOnNegativeSize() {
+// ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
+// Channel channel = mock(Channel.class);
+// ChannelConfig channelConfig = mock(ChannelConfig.class);
+//
+//
when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class));
+// when(channelHandler.getChannel()).thenReturn(channel);
+// when(channel.getConfig()).thenReturn(channelConfig);
+//
+//
when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String,
Object>of(NEEDED_DATA, -1));
+//
+// assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36))
+// .doesNotThrowAnyException();
+// }
Review comment:
```suggestion
```
##########
File path:
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
##########
@@ -209,21 +208,25 @@ public String getServiceType() {
}
@Override
- protected ChannelPipelineFactory createPipelineFactory(final ChannelGroup
group) {
+ protected AbstractChannelPipelineFactory createPipelineFactory(final
ChannelGroup group) {
- return new ChannelPipelineFactory() {
-
+ return new AbstractChannelPipelineFactory(0, 0, 0, group,
getFrameHandlerFactory()) {
Review comment:
Please introduce names constants for the magic numbers `0` `0` `0` to
give them understandable names...
##########
File path:
protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractAsyncServer.java
##########
@@ -85,54 +94,67 @@ public synchronized void bind() throws Exception {
throw new RuntimeException("Please specify at least on
socketaddress to which the server should get bound!");
}
- bootstrap = new ServerBootstrap(createSocketChannelFactory());
- ChannelPipelineFactory factory = createPipelineFactory(channels);
-
+ bootstrap = new ServerBootstrap();
+ bootstrap.channel(NioServerSocketChannel.class);
+
+ bossGroup = new NioEventLoopGroup();
+ workerGroup = new NioEventLoopGroup();
+
+ bootstrap.group(bossGroup, workerGroup);
+
+ ChannelInitializer<SocketChannel> factory =
createPipelineFactory(channels);
+
// Configure the pipeline factory.
- bootstrap.setPipelineFactory(factory);
- configureBootstrap(bootstrap);
+ bootstrap.childHandler(factory);
for (InetSocketAddress address : addresses) {
- channels.add(bootstrap.bind(address));
+ Channel channel = bootstrap.bind(address).sync().channel();
+ channels.add(channel);
}
- started = true;
+ configureBootstrap(bootstrap);
+
+ started = true;
}
/**
* Configure the bootstrap before it get bound
*/
protected void configureBootstrap(ServerBootstrap bootstrap) {
// Bind and start to accept incoming connections.
- bootstrap.setOption("backlog", backlog);
- bootstrap.setOption("reuseAddress", true);
- bootstrap.setOption("child.tcpNoDelay", true);
- }
-
- protected ServerSocketChannelFactory createSocketChannelFactory() {
- return new NioServerSocketChannelFactory(createBossExecutor(),
createWorkerExecutor(), ioWorker);
+ bootstrap.option(ChannelOption.SO_BACKLOG, backlog);
+ bootstrap.option(ChannelOption.SO_REUSEADDR, true);
+ bootstrap.option(ChannelOption.TCP_NODELAY, true);
}
-
@Override
public synchronized void unbind() {
if (started == false) {
return;
}
- ChannelPipelineFactory factory = bootstrap.getPipelineFactory();
- if (factory instanceof ExternalResourceReleasable) {
- ((ExternalResourceReleasable) factory).releaseExternalResources();
+
+ if (bossGroup != null) {
+ bossGroup.shutdownGracefully();
}
- channels.close().awaitUninterruptibly();
- bootstrap.releaseExternalResources();
+
+ if (workerGroup != null) {
+ workerGroup.shutdownGracefully();
+ }
+
+ // ChannelPipelineFactory factory =
bootstrap.getPipelineFactory();
+ // if (factory instanceof ExternalResourceReleasable) {
+ // ((ExternalResourceReleasable)
factory).releaseExternalResources();
+ // }
+ // channels.close().awaitUninterruptibly();
+ // bootstrap.releaseExternalResources();
Review comment:
```suggestion
```
Remove commented code
##########
File path:
server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/ImapRequestFrameDecoderTest.java
##########
@@ -46,35 +37,35 @@ void setUp() {
18);
}
- @Test
- void newCumulationBufferShouldNotThrowWhenNoAttachments() {
- ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
- Channel channel = mock(Channel.class);
- ChannelConfig channelConfig = mock(ChannelConfig.class);
+// @Test
+// void newCumulationBufferShouldNotThrowWhenNoAttachments() {
+// ChannelHandlerContext channelHandler =
mock(ChannelHandlerContext.class);
+// Channel channel = mock(Channel.class);
+// ChannelConfig channelConfig = mock(ChannelConfig.class);
+//
+// //
when(channelConfig.getBufferFactory()).thenReturn(mock(ChannelBufferFactory.class));
+// when(channelHandler.channel()).thenReturn(channel);
+// when(channel.config()).thenReturn(channelConfig);
+//
+//
when(channelHandler.getAttachment()).thenReturn(ImmutableMap.<String,
Object>of());
+//
+// assertThatCode(() -> testee.newCumulationBuffer(channelHandler, 36))
+// .doesNotThrowAnyException();
+// }
Review comment:
```suggestion
```
##########
File path:
server/task/task-memory/src/test/java/org/apache/james/task/SerialTaskManagerWorkerTest.java
##########
@@ -113,19 +113,19 @@ void aRunningTaskShouldHaveAFiniteNumberOfInformation() {
verify(listener, atMost(4)).updated(eq(taskWithId.getId()), notNull());
}
- @Test
- void aRunningTaskShouldEmitAtMostOneInformationPerPeriod() {
- TaskWithId taskWithId = new TaskWithId(TaskId.generateTaskId(), new
MemoryReferenceWithCounterTask((counter) ->
- Mono.fromCallable(counter::incrementAndGet)
- .delayElement(Duration.ofMillis(1))
- .repeat(200)
- .then(Mono.just(Task.Result.COMPLETED))
- .block()));
-
- worker.executeTask(taskWithId).block();
-
- verify(listener, atMost(3)).updated(eq(taskWithId.getId()), notNull());
- }
+// @Test
+// void aRunningTaskShouldEmitAtMostOneInformationPerPeriod() {
+// TaskWithId taskWithId = new TaskWithId(TaskId.generateTaskId(), new
MemoryReferenceWithCounterTask((counter) ->
+// Mono.fromCallable(counter::incrementAndGet)
+// .delayElement(Duration.ofMillis(1))
+// .repeat(200)
+// .then(Mono.just(Task.Result.COMPLETED))
+// .block()));
+//
+// worker.executeTask(taskWithId).block();
+//
+// verify(listener, atMost(3)).updated(eq(taskWithId.getId()),
notNull());
+// }
Review comment:
Unrelated to the topic please keep it.
##########
File path:
server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/JMXEnabledOrderedMemoryAwareThreadPoolExecutor.java
##########
@@ -1,140 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one *
- * or more contributor license agreements. See the NOTICE file *
- * distributed with this work for additional information *
- * regarding copyright ownership. The ASF licenses this file *
- * to you under the Apache License, Version 2.0 (the *
- * "License"); you may not use this file except in compliance *
- * with the License. You may obtain a copy of the License at *
- * *
- * http://www.apache.org/licenses/LICENSE-2.0 *
- * *
- * Unless required by applicable law or agreed to in writing, *
- * software distributed under the License is distributed on an *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
- * KIND, either express or implied. See the License for the *
- * specific language governing permissions and limitations *
- * under the License. *
- ****************************************************************/
-package org.apache.james.protocols.lib.netty;
-
-import java.lang.management.ManagementFactory;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.apache.james.util.concurrent.NamedThreadFactory;
-import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
-
-/**
- * {@link OrderedMemoryAwareThreadPoolExecutor} subclass which expose
statistics via JMX
- */
-public class JMXEnabledOrderedMemoryAwareThreadPoolExecutor extends
OrderedMemoryAwareThreadPoolExecutor implements
JMXEnabledOrderedMemoryAwareThreadPoolExecutorMBean {
Review comment:
:+1: for the removal of the JMX protocol metrics too
Maybe we could document how to access similar Netty metrics?
##########
File path:
protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractChannelPipelineFactory.java
##########
@@ -18,47 +18,41 @@
****************************************************************/
package org.apache.james.protocols.netty;
-import static org.jboss.netty.channel.Channels.pipeline;
-
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.ChannelPipelineFactory;
-import org.jboss.netty.channel.ChannelUpstreamHandler;
-import org.jboss.netty.channel.group.ChannelGroup;
-import org.jboss.netty.handler.execution.ExecutionHandler;
-import org.jboss.netty.handler.stream.ChunkedWriteHandler;
-import org.jboss.netty.util.HashedWheelTimer;
+import io.netty.channel.ChannelHandler;
+import io.netty.channel.ChannelInboundHandlerAdapter;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
+import io.netty.channel.group.ChannelGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.handler.stream.ChunkedWriteHandler;
/**
- * Abstract base class for {@link ChannelPipelineFactory} implementations
+ * Abstract base class for {@link ChannelInitializer} implementations
*/
-public abstract class AbstractChannelPipelineFactory implements
ChannelPipelineFactory {
[email protected]
+public abstract class AbstractChannelPipelineFactory<C extends SocketChannel>
extends ChannelInitializer<C> {
public static final int MAX_LINE_LENGTH = 8192;
protected final ConnectionLimitUpstreamHandler connectionLimitHandler;
protected final ConnectionPerIpLimitUpstreamHandler
connectionPerIpLimitHandler;
- private final HashedWheelTimer timer;
Review comment:
Sorry to ask but why can we get rid of the `HashedWheelTimer` ?
Edit: got the answer, `IdleStateHandler` no longer need nor accept a timer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]