Hi Adam, On 4 May 2011 04:15, Adam Kelloway <adam.kelloway@newpace.ca> wrote:
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/Execut...: -------------- 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?
Very good question. Off the top of my head I would say this is an oversight. Which version of esl-client and netty are you seeing this with ? Should be straight forward to sort this out. I have a few pending changes to commit into the esl-client, and will try to get to it asap. Thanks for the post. Also, I should find somewhere to log bugs (and patches :-), not sure if the official JIRA system is available. regards davidv
Thanks and keep up the good work,
Adam Kelloway
-- david varnes e: david.varnes@gmail.com