Revision: 15403
Author: baranowb
Date: Fri Nov 19 04:26:35 2010
Log: Fixes issue 1727
http://code.google.com/p/mobicents/source/detail?r=15403

Modified:
/trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/BaseEndpointImpl.java /trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/EndpointFactoryImpl.java
 /trunk/servers/media/core/server-standalone/src/main/config/ann-beans.xml
 /trunk/servers/media/core/server-standalone/src/main/config/cnf-beans.xml
 /trunk/servers/media/core/server-standalone/src/main/config/ivr-beans.xml
/trunk/servers/media/core/server-standalone/src/main/config/packetrelay-beans.xml

=======================================
--- /trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/BaseEndpointImpl.java Tue Jul 6 21:37:21 2010 +++ /trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/BaseEndpointImpl.java Fri Nov 19 04:26:35 2010
@@ -66,11 +66,13 @@
     // protected transient HashMap<String, Connection> connections = new
     // HashMap();
     //private int maxConnections = 10;
-    private static final int _CONNECTION_TAB_SIZE = 10;
+    //private static final int _CONNECTION_TAB_SIZE = 10;
+
     // collection of prestarted local connections
+ private int connectionPoolSize = 0; //def is 0. connectionTableSize might be better for impl, but "pool" sounds better from user POV private LocalConnectionImpl[] localConnections; // collection of prestarted network connections private RtpConnectionImpl[] networkConnections; // collection of active connections
-    private Connection[] connections;
+ private Connection[] connections; // collection of activly used connections
     private int count;

     protected ReentrantLock stateLock = new ReentrantLock();
@@ -79,8 +81,16 @@
     public BaseEndpointImpl(String localName) {
         this.localName = localName;
     }
-
-    public String getLocalName() {
+
+    public int getConnectionPoolSize() {
+               return connectionPoolSize;
+       }
+
+       public void setConnectionPoolSize(int connectionTableSize) {
+               this.connectionPoolSize = connectionTableSize;
+       }
+
+       public String getLocalName() {
         return localName;
     }

@@ -131,9 +141,10 @@


     public void start() throws ResourceUnavailableException {
-        networkConnections = new RtpConnectionImpl[_CONNECTION_TAB_SIZE];
-        localConnections = new LocalConnectionImpl[_CONNECTION_TAB_SIZE];
-        connections = new ConnectionImpl[_CONNECTION_TAB_SIZE];
+       //baranowb: why all 3 have the same size.
+        networkConnections = new RtpConnectionImpl[connectionPoolSize];
+        localConnections = new LocalConnectionImpl[connectionPoolSize];
+        connections = new ConnectionImpl[connectionPoolSize];

         // let's create several connections
         for (int i = 0; i < connections.length; i++) {
=======================================
--- /trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/EndpointFactoryImpl.java Thu Jul 1 23:33:24 2010 +++ /trunk/servers/media/core/server-impl/src/main/java/org/mobicents/media/server/EndpointFactoryImpl.java Fri Nov 19 04:26:35 2010
@@ -32,12 +32,10 @@
 import org.mobicents.media.Format;
 import org.mobicents.media.MediaSink;
 import org.mobicents.media.MediaSource;
-import org.mobicents.media.Server;
 import org.mobicents.media.server.impl.AbstractSink;
 import org.mobicents.media.server.impl.AbstractSource;
 import org.mobicents.media.server.impl.naming.NameParser;
 import org.mobicents.media.server.impl.naming.NameToken;
-import org.mobicents.media.server.impl.rtp.RtpFactory;
 import org.mobicents.media.server.spi.Endpoint;
 import org.mobicents.media.server.spi.EndpointFactory;
 import org.mobicents.media.server.spi.MediaType;
@@ -62,6 +60,7 @@
     private ComponentFactory groupFactory;

     protected ConnectionFactory connectionFactory;
+    protected int connectionPoolSize = 1; //so by def it will atleast work.
     protected RtpManager rtpFactory;

     private ArrayList<MediaType> mediaTypes = new ArrayList();
@@ -89,6 +88,14 @@
         return mediaTypes;
     }

+    public int getConnectionPoolSize() {
+               return connectionPoolSize;
+       }
+
+       public void setConnectionPoolSize(int connectionTableSize) {
+               this.connectionPoolSize = connectionTableSize;
+       }
+
public Collection<Endpoint> install() throws ResourceUnavailableException {

         ArrayList<Endpoint> list = new ArrayList();
@@ -119,7 +126,7 @@

             enp.setConnectionFactory(connectionFactory);
             enp.setRtpManager(rtpFactory);
-
+            enp.setConnectionPoolSize(connectionPoolSize);
             list.add(enp);
         }
         return list;
=======================================
--- /trunk/servers/media/core/server-standalone/src/main/config/ann-beans.xml Fri Jun 25 05:29:35 2010 +++ /trunk/servers/media/core/server-standalone/src/main/config/ann-beans.xml Fri Nov 19 04:26:35 2010
@@ -7,6 +7,7 @@
<bean name="Announcement-Access-Point" class="org.mobicents.media.server.EndpointFactoryImpl">
                <property name="localName">/mobicents/media/aap/[1..10] 
</property>
<property name="connectionFactory"><inject bean="default-connection" /></property>
+               <!-- <property name="connectionPoolSize">1</property> -->
        </bean>

 </deployment>
=======================================
--- /trunk/servers/media/core/server-standalone/src/main/config/cnf-beans.xml Fri Jun 25 05:29:35 2010 +++ /trunk/servers/media/core/server-standalone/src/main/config/cnf-beans.xml Fri Nov 19 04:26:35 2010
@@ -13,8 +13,9 @@
         <!-- Conference local bridge  -->
<bean name="CnfEndpoint" class="org.mobicents.media.server.EndpointFactoryImpl">
                <property name="localName">/mobicents/media/cnf/[1..10] 
</property>
- <property name="groupFactory"><inject bean="cnf.bridge" /></property> + <property name="groupFactory"><inject bean="cnf.bridge" /></property> <property name="connectionFactory"><inject bean="default-connection" /></property>
+               <property name="connectionPoolSize">10</property>
        </bean>

 </deployment>
=======================================
--- /trunk/servers/media/core/server-standalone/src/main/config/ivr-beans.xml Fri Jun 25 05:29:35 2010 +++ /trunk/servers/media/core/server-standalone/src/main/config/ivr-beans.xml Fri Nov 19 04:26:35 2010
@@ -17,6 +17,7 @@
                     </map>
                </property -->
<property name="connectionFactory"><inject bean="default-connection" /></property>
+               <property name="connectionPoolSize">1</property>
     </bean>

 </deployment>
=======================================
--- /trunk/servers/media/core/server-standalone/src/main/config/packetrelay-beans.xml Fri Jun 25 05:29:35 2010 +++ /trunk/servers/media/core/server-standalone/src/main/config/packetrelay-beans.xml Fri Nov 19 04:26:35 2010
@@ -19,6 +19,7 @@
                <property name="groupFactory">
                        <inject bean="PacketRelayBridgeFactory" />
                </property>
+               <property name="connectionPoolSize">2</property>
        </bean>


Reply via email to