<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi there,<br>
    <br>
    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.<br>
    <br>
    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:<br>
    <br>
    org.jboss.netty.util.internal.SharedResourceMisuseDetector<br>
    WARNING: You are creating too many MemoryAwareThreadPoolExecutor
    instances.&nbsp; MemoryAwareThreadPoolExecutor is a shared resource that
    must be reused across the application, so that only a few instances
    are created.<br>
    <br>
    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".<br>
    <br>
    From
    <a class="moz-txt-link-freetext"
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html:">http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html:</a><br>
    --------------<br>
    <font face="Courier New, Courier, monospace">public class
      DatabaseGatewayPipelineFactory implements <a
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipelineFactory.html"
        title="interface in org.jboss.netty.channel"><code>ChannelPipelineFactory</code></a>
      {<br>
      <br>
      <b>private final <a
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html"
          title="class in org.jboss.netty.handler.execution"><code>ExecutionHandler</code></a>
        executionHandler;</b><br>
      <br>
      public DatabaseGatewayPipelineFactory(<a
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/handler/execution/ExecutionHandler.html"
        title="class in org.jboss.netty.handler.execution"><code>ExecutionHandler</code></a>
      executionHandler) {<br>
      &nbsp; this.executionHandler = executionHandler;<br>
      }<br>
      <br>
      public <a
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/ChannelPipeline.html"
        title="interface in org.jboss.netty.channel"><code>ChannelPipeline</code></a>
      getPipeline() {<br>
      &nbsp; return <a
href="http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/Channels.html"
        title="class in org.jboss.netty.channel"><code>Channels</code></a>.pipeline(<br>
      &nbsp;&nbsp;&nbsp; new DatabaseGatewayProtocolEncoder(),<br>
      &nbsp;&nbsp;&nbsp; new DatabaseGatewayProtocolDecoder(),<br>
      <b>&nbsp;&nbsp;&nbsp; executionHandler, // Must be shared</b><br>
      &nbsp;&nbsp;&nbsp; new DatabaseQueryingHandler());<br>
      &nbsp; }<br>
      }</font> <br>
    -------------<br>
    <br>
    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?<br>
    <br>
    Thanks and keep up the good work,<br>
    <br>
    Adam Kelloway
  </body>
</html>