Index: src/main/org/jboss/ejb/InstancePool.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/InstancePool.java,v
retrieving revision 1.13
diff -u -3 -p -r1.13 InstancePool.java
--- src/main/org/jboss/ejb/InstancePool.java	27 Aug 2003 04:32:00 -0000	1.13
+++ src/main/org/jboss/ejb/InstancePool.java	26 Feb 2005 15:34:49 -0000
@@ -57,5 +57,12 @@ public interface InstancePool
     */
    public int getMaxSize();
 
+   /**
+    * Set the maximum size of the pool.
+    *
+    * @param size The new size of the pool.
+    */
+   public void setMaxSize(int size);
+
 }
 
Index: src/main/org/jboss/ejb/plugins/AbstractInstancePool.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/AbstractInstancePool.java,v
retrieving revision 1.34
diff -u -3 -p -r1.34 AbstractInstancePool.java
--- src/main/org/jboss/ejb/plugins/AbstractInstancePool.java	10 Sep 2003 14:43:55 -0000	1.34
+++ src/main/org/jboss/ejb/plugins/AbstractInstancePool.java	26 Feb 2005 15:34:50 -0000
@@ -48,6 +48,8 @@ public abstract class AbstractInstancePo
     instance will block until an instance is freed.
     */
    private FIFOSemaphore strictMaxSize;
+   /** Should strict size be used ? */
+   private boolean strictSize;
    /** The time in milliseconds to wait for the strictMaxSize semaphore.
     */
    private long strictTimeout = Long.MAX_VALUE;
@@ -108,6 +110,19 @@ public abstract class AbstractInstancePo
    }
 
    /**
+    * @jmx:managed-attribute
+    * @param size The new pool size
+    */
+   public void setMaxSize(int size)
+   {
+      synchronized (pool)
+      {
+         freeAll();
+         setup(size, strictSize, strictTimeout);
+      }
+   }
+
+   /**
     *   Get an instance without identity.
     *   Can be used by finders,create-methods, and activation
     *
@@ -229,10 +244,14 @@ public abstract class AbstractInstancePo
     */
    public void importXml(Element element) throws DeploymentException
    {
+      int ms = 30;
+      boolean ss = false;
+      long t = Long.MAX_VALUE;
+
       String maximumSize = MetaData.getElementContent(MetaData.getUniqueChild(element, "MaximumSize"));
       try
       {
-         this.maxSize = Integer.parseInt(maximumSize);
+         ms = Integer.parseInt(maximumSize);
       }
       catch (NumberFormatException e)
       {
@@ -241,20 +260,21 @@ public abstract class AbstractInstancePo
 
       // Get whether the pool will block when MaximumSize instances are active
       String strictValue = MetaData.getElementContent(MetaData.getOptionalChild(element, "strictMaximumSize"));
-      Boolean strictFlag = Boolean.valueOf(strictValue);
-      if( strictFlag == Boolean.TRUE )
-         this.strictMaxSize = new FIFOSemaphore(this.maxSize);
+      ss = Boolean.valueOf(strictValue).booleanValue();
+
       String delay = MetaData.getElementContent(MetaData.getOptionalChild(element, "strictTimeout"));
       try
       {
          if( delay != null )
-            this.strictTimeout = Long.parseLong(delay);
+            t = Long.parseLong(delay);
       }
       catch (NumberFormatException e)
       {
          throw new DeploymentException("Invalid strictTimeout value for instance pool configuration");
       }
-   }
+ 
+      setup(ms, ss, t);
+  }
 
    // Package protected ---------------------------------------------
 
@@ -271,6 +291,24 @@ public abstract class AbstractInstancePo
    // Private -------------------------------------------------------
 
    /**
+    * Setup the instance pool
+    */
+   private void setup(int maxSize, boolean strictSize, long timeout)
+   {
+      this.maxSize = maxSize;
+      this.strictSize = strictSize;
+      if (strictSize)
+      {
+         this.strictMaxSize = new FIFOSemaphore(maxSize);
+      }
+      else
+      {
+         this.strictMaxSize = null;
+      }
+      this.strictTimeout = timeout;
+   }
+
+   /**
     * At undeployment we want to free completely the pool.
     */
    private void freeAll()
Index: src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java,v
retrieving revision 1.23
diff -u -3 -p -r1.23 SingletonStatelessSessionInstancePool.java
--- src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java	27 Aug 2003 04:32:04 -0000	1.23
+++ src/main/org/jboss/ejb/plugins/SingletonStatelessSessionInstancePool.java	26 Feb 2005 15:34:50 -0000
@@ -166,6 +166,10 @@ public class SingletonStatelessSessionIn
       return 1;
    }
 
+   public void setMaxSize(int size)
+   {
+   }
+
    // Z implementation ----------------------------------------------
 
     // XmlLoadable implementation
