[Freeswitch-users] org.freeswitch.esl.client warns of resource misuse

Adam Kelloway adam.kelloway at newpace.ca
Tue May 3 22:15:05 MSD 2011


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| 
<http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipelineFactory.html> 
{

*private final |ExecutionHandler| 
<http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html> 
executionHandler;*

public DatabaseGatewayPipelineFactory(|ExecutionHandler| 
<http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html> 
executionHandler) {
   this.executionHandler = executionHandler;
}

public |ChannelPipeline| 
<http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipeline.html> 
getPipeline() {
   return |Channels| 
<http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/Channels.html>.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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110503/685b80c0/attachment.html 


More information about the FreeSWITCH-users mailing list