Hi there,
This is directed at those involved in the development of the
org.freeswitch.esl.client library. Apologies if this has already
been mentioned, I couldn't find any references to it.
In evaluating this library, I noticed that
AbstractOutboundPipelineFactory implementation of
ChannelPipelineFactory.getPipeline() creates a new ExecutionHandler
each time it is called, which results in a increasing number of
thread pools being used that eventually triggers the following
warning:
org.jboss.netty.util.internal.SharedResourceMisuseDetector
WARNING: You are creating too many MemoryAwareThreadPoolExecutor
instances. MemoryAwareThreadPoolExecutor is a shared resource that
must be reused across the application, so that only a few instances
are created.
Looking at the documentation for ExecutionHandler, I noticed that
the example implementation provides a dedicated ExecutionHandler
instance, which is passed to all pipelines returned in
getPipeline(). Note the comment in the example that states it "Must
be shared".
From
http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html:
--------------
public class
DatabaseGatewayPipelineFactory implements ChannelPipelineFactory
{
private final ExecutionHandler
executionHandler;
public DatabaseGatewayPipelineFactory(ExecutionHandler
executionHandler) {
this.executionHandler = executionHandler;
}
public ChannelPipeline
getPipeline() {
return Channels.pipeline(
new DatabaseGatewayProtocolEncoder(),
new DatabaseGatewayProtocolDecoder(),
executionHandler, // Must be shared
new DatabaseQueryingHandler());
}
}
-------------
Is there any particular reason why AbstractOutboundPipelineFactory
does not provide a dedicated ExecutionHandler that may be shared by
all pipelines, or is this simply an oversight?
Thanks and keep up the good work,
Adam Kelloway