geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: rev 55945 - in geronimo/trunk/modules/connector/src: java/org/apache/geronimo/connector/outbound java/org/apache/geronimo/connector/outbound/connectionmanagerconfig test/org/apache/geronimo/connector/outbound
Date Fri, 29 Oct 2004 06:02:24 GMT
Author: djencks
Date: Thu Oct 28 23:02:22 2004
New Revision: 55945

Added:
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/PoolingAttributes.java
Modified:
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoPool.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PartitionedPool.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PoolingSupport.java
   geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/SinglePool.java
   geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
Log:
Expose some read-only pooling info on the connection manager

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/AbstractConnectionManager.java
Thu Oct 28 23:02:22 2004
@@ -25,37 +25,18 @@
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.gbean.WaitingException;
 import org.apache.geronimo.transaction.manager.NamedXAResource;
 
 /**
  * @version $Rev$ $Date$
  */
-public abstract class AbstractConnectionManager implements ConnectionManagerFactory, GBeanLifecycle,
ConnectionManager, LazyAssociatableConnectionManager {
+public abstract class AbstractConnectionManager implements ConnectionManagerFactory, ConnectionManager,
LazyAssociatableConnectionManager, PoolingAttributes {
 
-    private ConnectionInterceptor stack;
+    protected final Interceptors interceptors;
 
-    private ConnectionInterceptor recoveryStack;
 
-
-    public AbstractConnectionManager() {
-    }
-
-    public void doStart() throws WaitingException, Exception {
-        ConnectionInterceptor[] stacks = setUpConnectionManager();
-        assert stacks.length == 2;
-        stack = stacks[0];
-        recoveryStack = stacks[1];
-    }
-
-    protected abstract ConnectionInterceptor[] setUpConnectionManager() throws IllegalStateException;
-
-    public void doStop() {
-        stack = null;
-    }
-
-    public void doFail() {
+    public AbstractConnectionManager(Interceptors interceptors) {
+        this.interceptors = interceptors;
     }
 
     public Object createConnectionFactory(ManagedConnectionFactory mcf) throws ResourceException
{
@@ -71,7 +52,7 @@
             throws ResourceException {
         ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, connectionRequestInfo);
         ConnectionInfo ci = new ConnectionInfo(mci);
-        stack.getConnection(ci);
+        getStack().getConnection(ci);
         return ci.getConnectionHandle();
     }
 
@@ -87,11 +68,11 @@
         ManagedConnectionInfo mci = new ManagedConnectionInfo(managedConnectionFactory, connectionRequestInfo);
         ConnectionInfo ci = new ConnectionInfo(mci);
         ci.setConnectionHandle(connection);
-        stack.getConnection(ci);
+        getStack().getConnection(ci);
     }
 
     ConnectionInterceptor getConnectionInterceptor() {
-        return stack;
+        return getStack();
     }
 
 
@@ -103,10 +84,46 @@
             return null;
         }
         ConnectionInfo recoveryConnectionInfo = new ConnectionInfo(mci);
-        recoveryStack.getConnection(recoveryConnectionInfo);
-        return new ConnectionManagerFactory.ReturnableXAResource(namedXAResource, recoveryStack,
recoveryConnectionInfo);
+        getRecoveryStack().getConnection(recoveryConnectionInfo);
+        return new ConnectionManagerFactory.ReturnableXAResource(namedXAResource, getRecoveryStack(),
recoveryConnectionInfo);
+    }
+
+    //statistics
+
+    public int getPartitionCount() {
+        return getPooling().getPartitionCount();
+    }
+
+    public int getPartitionMaxSize() {
+        return getPooling().getPartitionMaxSize();
     }
 
+    public int getIdleConnectionCount() {
+        return getPooling().getIdleConnectionCount();
+    }
+
+    public int getConnectionCount() {
+        return getPooling().getConnectionCount();
+    }
+
+
+    private ConnectionInterceptor getStack() {
+        return interceptors.getStack();
+    }
+
+    private ConnectionInterceptor getRecoveryStack() {
+        return interceptors.getRecoveryStack();
+    }
+
+    private PoolingAttributes getPooling() {
+        return interceptors.getPoolingAttributes();
+    }
+
+    public interface Interceptors {
+        ConnectionInterceptor getStack();
+        ConnectionInterceptor getRecoveryStack();
+        PoolingAttributes getPoolingAttributes();
+    }
 
     protected static final GBeanInfo GBEAN_INFO;
 
@@ -115,6 +132,7 @@
         GBeanInfoFactory infoFactory = new GBeanInfoFactory(AbstractConnectionManager.class);
 
         infoFactory.addInterface(ConnectionManagerFactory.class);
+        infoFactory.addInterface(PoolingAttributes.class);
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/GenericConnectionManager.java
Thu Oct 28 23:02:22 2004
@@ -34,22 +34,9 @@
  */
 public class GenericConnectionManager extends AbstractConnectionManager {
 
-    private String objectName;
-
-    //connection manager configuration choices
-    private TransactionSupport transactionSupport;
-    private PoolingSupport pooling;
-    //dependencies
-
-    private final RealmBridge realmBridge;
-    private final ConnectionTracker connectionTracker;
-    private final TransactionContextManager transactionContextManager;
-
     //default constructor for use as endpoint
     public GenericConnectionManager() {
-        this.realmBridge = null;
-        this.connectionTracker = null;
-        this.transactionContextManager = null;
+        super(null);
     }
 
     public GenericConnectionManager(TransactionSupport transactionSupport,
@@ -58,85 +45,76 @@
                                     RealmBridge realmBridge,
                                     ConnectionTracker connectionTracker,
                                     TransactionContextManager transactionContextManager)
{
-        this.transactionSupport = transactionSupport;
-        this.pooling = pooling;
-        this.objectName = objectName;
-        this.realmBridge = realmBridge;
-        this.connectionTracker = connectionTracker;
-        assert transactionContextManager != null;
-        this.transactionContextManager = transactionContextManager;
+        super(new InterceptorsImpl(transactionSupport, pooling, objectName, realmBridge,
connectionTracker, transactionContextManager));
     }
 
-    /**
-     * Order of constructed interceptors:
-     * <p/>
-     * ConnectionTrackingInterceptor (connectionTracker != null)
-     * ConnectionHandleInterceptor
-     * TransactionCachingInterceptor (useTransactions & useTransactionCaching)
-     * TransactionEnlistingInterceptor (useTransactions)
-     * SubjectInterceptor (realmBridge != null)
-     * SinglePoolConnectionInterceptor or MultiPoolConnectionInterceptor
-     * LocalXAResourceInsertionInterceptor or XAResourceInsertionInterceptor (useTransactions
(&localTransactions))
-     * MCFConnectionInterceptor
-     */
-    protected ConnectionInterceptor[] setUpConnectionManager() throws IllegalStateException
{
-        //check for consistency between attributes
-        if (realmBridge == null && pooling instanceof PartitionedPool &&
((PartitionedPool) pooling).isPartitionBySubject()) {
-            throw new IllegalStateException("To use Subject in pooling, you need a SecurityDomain");
-        }
+    private static class InterceptorsImpl implements AbstractConnectionManager.Interceptors
{
 
-        //Set up the interceptor stack
-        MCFConnectionInterceptor tail = new MCFConnectionInterceptor();
-        ConnectionInterceptor stack = tail;
-
-        stack = transactionSupport.addXAResourceInsertionInterceptor(stack, objectName);
-        stack = pooling.addPoolingInterceptors(stack);
-        //experimental threadlocal caching
-        //moved to XATransactions
+        private final ConnectionInterceptor stack;
+        private final ConnectionInterceptor recoveryStack;
+        private final PoolingAttributes poolingSupport;
+
+        /**
+         * Order of constructed interceptors:
+         * <p/>
+         * ConnectionTrackingInterceptor (connectionTracker != null)
+         * ConnectionHandleInterceptor
+         * TransactionCachingInterceptor (useTransactions & useTransactionCaching)
+         * TransactionEnlistingInterceptor (useTransactions)
+         * SubjectInterceptor (realmBridge != null)
+         * SinglePoolConnectionInterceptor or MultiPoolConnectionInterceptor
+         * LocalXAResourceInsertionInterceptor or XAResourceInsertionInterceptor (useTransactions
(&localTransactions))
+         * MCFConnectionInterceptor
+         */
+        public InterceptorsImpl(TransactionSupport transactionSupport, PoolingSupport pooling,
String objectName, RealmBridge realmBridge, ConnectionTracker connectionTracker, TransactionContextManager
transactionContextManager) {
+            //check for consistency between attributes
+            if (realmBridge == null && pooling instanceof PartitionedPool &&
((PartitionedPool) pooling).isPartitionBySubject()) {
+                throw new IllegalStateException("To use Subject in pooling, you need a SecurityDomain");
+            }
+
+            //Set up the interceptor stack
+            MCFConnectionInterceptor tail = new MCFConnectionInterceptor();
+            ConnectionInterceptor stack = tail;
+
+            stack = transactionSupport.addXAResourceInsertionInterceptor(stack, objectName);
+            stack = pooling.addPoolingInterceptors(stack);
+            this.poolingSupport = pooling;
+            //experimental threadlocal caching
+            //moved to XATransactions
 //        if (transactionSupport instanceof XATransactions && ((XATransactions)transactionSupport).isUseThreadCaching())
{
 //            stack = new ThreadLocalCachingConnectionInterceptor(stack, false);
 //        }
-        stack = transactionSupport.addTransactionInterceptors(stack, transactionContextManager);
+            stack = transactionSupport.addTransactionInterceptors(stack, transactionContextManager);
 
-        if (realmBridge != null) {
-            stack = new SubjectInterceptor(stack, realmBridge);
+            if (realmBridge != null) {
+                stack = new SubjectInterceptor(stack, realmBridge);
+            }
+
+            recoveryStack = stack;
+
+            stack = new ConnectionHandleInterceptor(stack);
+            if (connectionTracker != null) {
+                stack = new ConnectionTrackingInterceptor(stack,
+                        objectName,
+                        connectionTracker);
+            }
+            tail.setStack(stack);
+            this.stack = stack;
         }
 
-        ConnectionInterceptor recoveryStack = stack;
-
-        stack = new ConnectionHandleInterceptor(stack);
-        if (connectionTracker != null) {
-            stack = new ConnectionTrackingInterceptor(stack,
-                    objectName,
-                    connectionTracker);
+        public ConnectionInterceptor getStack() {
+            return stack;
         }
-        tail.setStack(stack);
-        return new ConnectionInterceptor[]{stack, recoveryStack};
-    }
-
-    public TransactionSupport getTransactionSupport() {
-        return transactionSupport;
-    }
 
-    public void setTransactionSupport(TransactionSupport transactionSupport) {
-        this.transactionSupport = transactionSupport;
-    }
-
-    public PoolingSupport getPooling() {
-        return pooling;
-    }
-
-    public void setPooling(PoolingSupport pooling) {
-        this.pooling = pooling;
-    }
+        public ConnectionInterceptor getRecoveryStack() {
+            return recoveryStack;
+        }
 
-    public RealmBridge getRealmBridge() {
-        return realmBridge;
+        public PoolingAttributes getPoolingAttributes() {
+            return poolingSupport;
+        }
     }
 
-    public ConnectionTracker getConnectionTracker() {
-        return connectionTracker;
-    }
 
     public static final GBeanInfo GBEAN_INFO;
 

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/MultiPoolConnectionInterceptor.java
Thu Oct 28 23:02:22 2004
@@ -21,6 +21,7 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Iterator;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionRequestInfo;
@@ -37,7 +38,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class MultiPoolConnectionInterceptor implements ConnectionInterceptor {
+public class MultiPoolConnectionInterceptor implements ConnectionInterceptor, PoolingAttributes{
 
     private final ConnectionInterceptor next;
     private final PoolingSupport singlePoolFactory;
@@ -83,6 +84,32 @@
         ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
         ConnectionInterceptor poolInterceptor = mci.getPoolInterceptor();
         poolInterceptor.returnConnection(connectionInfo, connectionReturnAction);
+    }
+
+    public int getPartitionCount() {
+        return pools.size();
+    }
+
+    public int getPartitionMaxSize() {
+        return singlePoolFactory.getPartitionMaxSize();
+    }
+
+    public int getIdleConnectionCount() {
+        int count = 0;
+        for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
+            PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+            count += poolingAttributes.getIdleConnectionCount();
+        }
+        return count;
+    }
+
+    public int getConnectionCount() {
+        int count = 0;
+        for (Iterator iterator = pools.entrySet().iterator(); iterator.hasNext();) {
+            PoolingAttributes poolingAttributes = (PoolingAttributes) ((Map.Entry) iterator.next()).getValue();
+            count += poolingAttributes.getConnectionCount();
+        }
+        return count;
     }
 
     static class SubjectCRIKey {

Added: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/PoolingAttributes.java
==============================================================================
--- (empty file)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/PoolingAttributes.java
Thu Oct 28 23:02:22 2004
@@ -0,0 +1,31 @@
+/**
+ *
+ * Copyright 2003-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.connector.outbound;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
+ */
+public interface PoolingAttributes {
+    int getPartitionCount();
+
+    int getPartitionMaxSize();
+
+    int getIdleConnectionCount();
+
+    int getConnectionCount();
+}

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolConnectionInterceptor.java
Thu Oct 28 23:02:22 2004
@@ -38,7 +38,7 @@
  * @version $Rev$ $Date$
  *
  */
-public class SinglePoolConnectionInterceptor implements ConnectionInterceptor {
+public class SinglePoolConnectionInterceptor implements ConnectionInterceptor, PoolingAttributes
{
 
     private static Log log = LogFactory.getLog(SinglePoolConnectionInterceptor.class.getName());
 
@@ -52,6 +52,8 @@
     private int blockingTimeout;
     private boolean selectOneAssumeMatch;
 
+    private int connectionCount = 0;
+
     public SinglePoolConnectionInterceptor(
             final ConnectionInterceptor next,
             int maxSize,
@@ -75,6 +77,7 @@
                 synchronized (pool) {
                     if (pool.isEmpty()) {
                         next.getConnection(connectionInfo);
+                        connectionCount++;
                         if (log.isTraceEnabled()) {
                             log.trace("Returning new connection " + connectionInfo.getManagedConnectionInfo());
                         }
@@ -165,6 +168,7 @@
 
         if (connectionReturnAction == ConnectionReturnAction.DESTROY) {
             next.returnConnection(connectionInfo, connectionReturnAction);
+            connectionCount--;
         } else {
             synchronized (pool) {
                 mci.setLastUsed(System.currentTimeMillis());
@@ -178,6 +182,22 @@
         }
     }
 
+    public int getPartitionCount() {
+        return 1;
+    }
+
+    public int getPartitionMaxSize() {
+        return pool.capacity();
+    }
+
+    public int getIdleConnectionCount() {
+        return pool.currentSize();
+    }
+
+    public int getConnectionCount() {
+        return connectionCount;
+    }
+
     static class PoolDeque {
 
         private final ManagedConnectionInfo[] deque;
@@ -229,6 +249,14 @@
 
             }
             return false;
+        }
+
+        public int capacity() {
+            return deque.length;
+        }
+
+        public int currentSize() {
+            return last - first + 1;
         }
     }
 

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/SinglePoolMatchAllConnectionInterceptor.java
Thu Oct 28 23:02:22 2004
@@ -38,7 +38,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class SinglePoolMatchAllConnectionInterceptor implements ConnectionInterceptor {
+public class SinglePoolMatchAllConnectionInterceptor implements ConnectionInterceptor, PoolingAttributes
{
 
     private static Log log = LogFactory.getLog(SinglePoolMatchAllConnectionInterceptor.class.getName());
 
@@ -84,6 +84,7 @@
                                             mci.getConnectionRequestInfo());
                             if (matchedMC != null) {
                                 connectionInfo.setManagedConnectionInfo((ManagedConnectionInfo)
pool.get(matchedMC));
+                                pool.remove(matchedMC);
                                 if (log.isTraceEnabled()) {
                                     log.trace("Returning pooled connection " + connectionInfo.getManagedConnectionInfo());
                                 }
@@ -164,4 +165,20 @@
         }
     }
 
+    //PoolingAttributes implementation
+    public int getPartitionCount() {
+        return 1;
+    }
+
+    public int getPartitionMaxSize() {
+        return maxSize;
+    }
+
+    public int getIdleConnectionCount() {
+        return pool.size();
+    }
+
+    public int getConnectionCount() {
+        return actualConnections;
+    }
 }

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoPool.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoPool.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/NoPool.java
Thu Oct 28 23:02:22 2004
@@ -25,8 +25,24 @@
  * @version $Rev$ $Date$
  *
  * */
-public class NoPool extends PoolingSupport {
+public class NoPool implements PoolingSupport {
     public ConnectionInterceptor addPoolingInterceptors(ConnectionInterceptor tail) {
         return tail;
+    }
+
+    public int getPartitionCount() {
+        return 0;
+    }
+
+    public int getPartitionMaxSize() {
+        return 0;
+    }
+
+    public int getIdleConnectionCount() {
+        return 0;
+    }
+
+    public int getConnectionCount() {
+        return 0;
     }
 }

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PartitionedPool.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PartitionedPool.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PartitionedPool.java
Thu Oct 28 23:02:22 2004
@@ -19,6 +19,7 @@
 
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.MultiPoolConnectionInterceptor;
+import org.apache.geronimo.connector.outbound.PoolingAttributes;
 
 /**
  *
@@ -26,13 +27,15 @@
  * @version $Rev$ $Date$
  *
  * */
-public class PartitionedPool extends PoolingSupport {
+public class PartitionedPool implements PoolingSupport {
 
     private boolean partitionByConnectionRequestInfo;
     private boolean partitionBySubject;
 
     private final SinglePool singlePool;
 
+    private PoolingAttributes poolingAttributes;
+
     public PartitionedPool(boolean partitionByConnectionRequestInfo, boolean partitionBySubject,
int maxSize, int blockingTimeoutMilliseconds, boolean matchOne, boolean matchAll, boolean
selectOneAssumeMatch) {
         singlePool = new SinglePool(maxSize, blockingTimeoutMilliseconds, matchOne, matchAll,
selectOneAssumeMatch);
         this.partitionByConnectionRequestInfo = partitionByConnectionRequestInfo;
@@ -96,10 +99,28 @@
     }
 
         public ConnectionInterceptor addPoolingInterceptors(ConnectionInterceptor tail) {
-            return new MultiPoolConnectionInterceptor(
+            MultiPoolConnectionInterceptor pool = new MultiPoolConnectionInterceptor(
                             tail,
                             singlePool,
                             isPartitionBySubject(),
                             isPartitionByConnectionRequestInfo());
+            this.poolingAttributes = pool;
+            return pool;
         }
+
+    public int getPartitionCount() {
+        return poolingAttributes.getPartitionCount();
+    }
+
+    public int getPartitionMaxSize() {
+        return poolingAttributes.getPartitionMaxSize();
+    }
+
+    public int getIdleConnectionCount() {
+        return poolingAttributes.getIdleConnectionCount();
+    }
+
+    public int getConnectionCount() {
+        return poolingAttributes.getConnectionCount();
+    }
 }

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PoolingSupport.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PoolingSupport.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/PoolingSupport.java
Thu Oct 28 23:02:22 2004
@@ -20,13 +20,13 @@
 import java.io.Serializable;
 
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
+import org.apache.geronimo.connector.outbound.PoolingAttributes;
 
 /**
- *
- *
  * @version $Rev$ $Date$
- *
- * */
-public abstract class PoolingSupport implements Serializable {
-    public abstract ConnectionInterceptor addPoolingInterceptors(ConnectionInterceptor tail);
+ */
+public interface PoolingSupport extends Serializable, PoolingAttributes {
+
+    ConnectionInterceptor addPoolingInterceptors(ConnectionInterceptor tail);
+
 }

Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/SinglePool.java
==============================================================================
--- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/SinglePool.java
(original)
+++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/connectionmanagerconfig/SinglePool.java
Thu Oct 28 23:02:22 2004
@@ -20,6 +20,7 @@
 import org.apache.geronimo.connector.outbound.ConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor;
 import org.apache.geronimo.connector.outbound.SinglePoolMatchAllConnectionInterceptor;
+import org.apache.geronimo.connector.outbound.PoolingAttributes;
 
 /**
  *
@@ -27,13 +28,15 @@
  * @version $Rev$ $Date$
  *
  * */
-public class SinglePool extends PoolingSupport {
+public class SinglePool implements PoolingSupport {
     private int maxSize;
     private int blockingTimeoutMilliseconds;
     private boolean matchOne;
     private boolean matchAll;
     private boolean selectOneAssumeMatch;
 
+    private PoolingAttributes pool;
+
     public SinglePool(int maxSize, int blockingTimeoutMilliseconds, boolean matchOne, boolean
matchAll, boolean selectOneAssumeMatch) {
         this.maxSize = maxSize;
         this.blockingTimeoutMilliseconds = blockingTimeoutMilliseconds;
@@ -84,17 +87,37 @@
 
     public ConnectionInterceptor addPoolingInterceptors(ConnectionInterceptor tail) {
         if (isMatchAll()) {
-            return new SinglePoolMatchAllConnectionInterceptor(
+            SinglePoolMatchAllConnectionInterceptor pool = new SinglePoolMatchAllConnectionInterceptor(
                     tail,
                     getMaxSize(),
                     getBlockingTimeoutMilliseconds());
+            this.pool = pool;
+            return pool;
 
         } else {
-            return new SinglePoolConnectionInterceptor(
+            SinglePoolConnectionInterceptor pool = new SinglePoolConnectionInterceptor(
                     tail,
                     getMaxSize(),
                     getBlockingTimeoutMilliseconds(),
                     isSelectOneAssumeMatch());
+            this.pool = pool;
+            return pool;
         }
+    }
+
+    public int getPartitionCount() {
+        return 1;
+    }
+
+    public int getPartitionMaxSize() {
+        return pool == null?  maxSize: pool.getPartitionMaxSize();
+    }
+
+    public int getIdleConnectionCount() {
+        return pool.getIdleConnectionCount();
+    }
+
+    public int getConnectionCount() {
+        return pool.getConnectionCount();
     }
 }

Modified: geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
==============================================================================
--- geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
(original)
+++ geronimo/trunk/modules/connector/src/test/org/apache/geronimo/connector/outbound/ConnectionManagerTestUtils.java
Thu Oct 28 23:02:22 2004
@@ -100,7 +100,6 @@
                 realmBridge,
                 connectionTrackingCoordinator,
                 transactionContextManager);
-        connectionManagerDeployment.doStart();
         connectionFactory = (MockConnectionFactory) connectionManagerDeployment.createConnectionFactory(mockManagedConnectionFactory);
         defaultComponentContext = new DefaultInstanceContext(unshareableResources, applicationManagedSecurityResources);
         defaultComponentInterceptor = new DefaultComponentInterceptor(this, connectionTrackingCoordinator,
transactionContextManager);

Mime
View raw message