[jboss-cvs] JBossAS SVN: r110850 - projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 8 12:30:34 EST 2011


Author: jesper.pedersen
Date: 2011-03-08 12:30:34 -0500 (Tue, 08 Mar 2011)
New Revision: 110850

Modified:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthKey.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthPool.java
Log:
[JBJCA-94] Initial implementation based on OnePool

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthKey.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthKey.java	2011-03-08 13:06:47 UTC (rev 110849)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthKey.java	2011-03-08 17:30:34 UTC (rev 110850)
@@ -26,8 +26,10 @@
 import javax.security.auth.Subject;
 
 /**
- * Pool key based on {@link Subject} and {@link ConnectionRequestInfo}.
+ * Reauthentication pool key based on {@link Subject} and {@link ConnectionRequestInfo}.
  * 
+ * However, initial implementation only divides on separateNoTx.
+ *
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a> 
  * @version $Rev: $
  */
@@ -46,7 +48,7 @@
    private final Object cri;
    
    /** The cached hashCode */
-   private int hashCode = Integer.MAX_VALUE;
+   private int hashCode;
 
    /** Separate no tx */
    private boolean separateNoTx;
@@ -62,6 +64,7 @@
       this.subject = (subject == null) ? NOSUBJECT : subject;
       this.cri = (cri == null) ? NOCRI : cri;
       this.separateNoTx = separateNoTx;
+      this.hashCode = separateNoTx ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
    }
    
    /**
@@ -70,11 +73,6 @@
    @Override
    public int hashCode()
    {
-      if (hashCode == Integer.MAX_VALUE)
-      {
-         hashCode = SecurityActions.hashCode(subject) ^ cri.hashCode();  
-      }
-      
       return hashCode;
    }
 
@@ -96,8 +94,6 @@
       
       ReauthKey other = (ReauthKey)obj;
       
-      return SecurityActions.equals(subject, other.subject) &&
-         cri.equals(other.cri) &&
-         separateNoTx == other.separateNoTx;
+      return separateNoTx == other.separateNoTx;
    }
 }

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthPool.java	2011-03-08 13:06:47 UTC (rev 110849)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/ReauthPool.java	2011-03-08 17:30:34 UTC (rev 110850)
@@ -24,6 +24,7 @@
 
 import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
 import org.jboss.jca.core.connectionmanager.pool.AbstractPool;
+import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionRequestInfo;
@@ -32,7 +33,12 @@
 
 /**
  * Pool implementation that supports reauthentication
- * 
+ *
+ * Initial implementation is based on OnePool with no prefill support, since
+ * each managed connection will likely have different credentials. Note, that
+ * using a simple key (ReauthKey) will result in a higher reauthentication
+ * numbers than optimal.
+ *
  * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
  */
 public class ReauthPool extends AbstractPool
@@ -59,4 +65,16 @@
    {
       return new ReauthKey(subject, cri, separateNoTx);
    }
+
+   /**
+    * There is no reason to empty the subpool for reauth enabled
+    * resource adapters, since all managed connections can change
+    * its credentials
+    * 
+    * @param pool the internal managed connection pool
+    */
+   public void emptySubPool(ManagedConnectionPool pool)
+   {
+      // No-operation
+   }
 }



More information about the jboss-cvs-commits mailing list