[jboss-cvs] JBossAS SVN: r108219 - in projects/jboss-jca/trunk: deployers/src/main/java/org/jboss/jca/deployers/fungal and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Sep 20 09:23:28 EDT 2010


Author: jesper.pedersen
Date: 2010-09-20 09:23:27 -0400 (Mon, 20 Sep 2010)
New Revision: 108219

Modified:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
   projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
Log:
[JBJCA-405] Remove TODOs in deployers

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java	2010-09-20 12:34:11 UTC (rev 108218)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PoolConfiguration.java	2010-09-20 13:23:27 UTC (rev 108219)
@@ -40,9 +40,12 @@
    
    /** Idle timeout period. Default 30 mins. In milliseconds */
    private long idleTimeout;
+
+   /** Background validation */
+   private boolean backgroundValidation;
    
-   /** Background validation interval */
-   private long backgroundValidationInterval;
+   /** Background validation - minutes */
+   private int backgroundValidationMinutes;
    
    /** Prefill pool*/
    private boolean prefill;
@@ -65,7 +68,8 @@
       maxSize = 20;
       blockingTimeout = 30000;
       idleTimeout = 1000 * 60 * 30;
-      backgroundValidationInterval = 0;
+      backgroundValidation = false;
+      backgroundValidationMinutes = 0;
       prefill = false;
       strictMin = false;
       useFastFail = false;
@@ -142,22 +146,49 @@
    }
 
    /**
-    * @return the backgroundInterval
+    * @return Should background validation be performed
     */
-   public long getBackgroundValidationInterval()
+   public boolean isBackgroundValidation()
    {
-      return backgroundValidationInterval;
+      return backgroundValidation;
    }
 
    /**
-    * @param backgroundValidationInterval the backgroundInterval to set
+    * @param v Should background validation be performed 
     */
-   public void setBackgroundValidationInterval(long backgroundValidationInterval)
+   public void setBackgroundValidation(boolean v)
    {
-      this.backgroundValidationInterval = backgroundValidationInterval;
+      this.backgroundValidation = v;
    }
 
    /**
+    * Get the background validation minutes setting
+    * @return The value
+    */
+   public int getBackgroundValidationMinutes()
+   {
+      return backgroundValidationMinutes;
+   }
+
+   /**
+    * Set the background validation minutes setting
+    * @param v The value
+    */
+   public void setBackgroundValidationMinutes(int v)
+   {
+      this.backgroundValidationMinutes = v;
+   }
+
+   /**
+    * Get the background validation interval in milliseconds
+    * @return The interval
+    */
+   public long getBackgroundValidationInterval()
+   {
+      return backgroundValidationMinutes * 1000L;
+   }
+
+   /**
     * @return the prefill
     */
    public boolean isPrefill()

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java	2010-09-20 12:34:11 UTC (rev 108218)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractResourceAdapterDeployer.java	2010-09-20 13:23:27 UTC (rev 108219)
@@ -471,11 +471,11 @@
          if (pp.getMaxPoolSize() != null)
             pc.setMaxSize(pp.getMaxPoolSize().intValue());
 
-         //if (pp.isPrefill() != null)
-         pc.setPrefill(pp.isPrefill()); // TODO
+         if (pp.isPrefill() != null)
+            pc.setPrefill(pp.isPrefill());
          
-         //if (pp.isUseStrictMin() != null)
-         pc.setStrictMin(pp.isUseStrictMin()); // TODO
+         if (pp.isUseStrictMin() != null)
+            pc.setStrictMin(pp.isUseStrictMin());
       }
 
       if (tp != null)
@@ -487,16 +487,16 @@
             pc.setIdleTimeout(tp.getIdleTimeoutMinutes().longValue());
       }
 
-      /*
-        TODO
-        if (backgroundValidationInterval != null)
-           pc.setBackgroundValidationInterval(backgroundValidationInterval.longValue());
-      */
-
       if (vp != null)
       {
-         //if (vp.isUseFastFail() != null)
-         pc.setUseFastFail(vp.isUseFastFail()); // TODO
+         if (vp.isBackgroundValidation() != null)
+            pc.setBackgroundValidation(vp.isBackgroundValidation().booleanValue());
+
+         if (vp.getBackgroundValidationMinutes() != null)
+            pc.setBackgroundValidationMinutes(vp.getBackgroundValidationMinutes().intValue());
+
+         if (vp.isUseFastFail() != null)
+            pc.setUseFastFail(vp.isUseFastFail());
       }
 
       return pc;

Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	2010-09-20 12:34:11 UTC (rev 108218)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/DsXmlDeployer.java	2010-09-20 13:23:27 UTC (rev 108219)
@@ -22,6 +22,9 @@
 
 package org.jboss.jca.deployers.fungal;
 
+import org.jboss.jca.common.api.metadata.common.CommonPool;
+import org.jboss.jca.common.api.metadata.common.CommonTimeOut;
+import org.jboss.jca.common.api.metadata.common.CommonValidation;
 import org.jboss.jca.common.api.metadata.ds.DataSource;
 import org.jboss.jca.common.api.metadata.ds.DataSources;
 import org.jboss.jca.common.api.metadata.ds.XaDataSource;
@@ -377,24 +380,8 @@
                                                  cd.getConfigProperties(),
                                                  cl);
       // Create the pool
-      Integer minSize = ds.getPool() == null ? null : ds.getPool().getMinPoolSize();
-      Integer maxSize = ds.getPool() == null ? null : ds.getPool().getMaxPoolSize();
-      Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
-      Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
-      Long backgroundValidationInterval = null; // TODO
-      Boolean prefill = ds.getPool() == null ? null : ds.getPool().isPrefill();
-      Boolean strictMin = ds.getPool() == null ? null : ds.getPool().isUseStrictMin();
-      Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
+      PoolConfiguration pc = createPoolConfiguration(ds.getPool(), ds.getTimeOut(), ds.getValidation());
 
-      PoolConfiguration pc = createPoolConfiguration(minSize,
-                                                     maxSize,
-                                                     blockingTimeout,
-                                                     idleTimeout,
-                                                     backgroundValidationInterval,
-                                                     prefill,
-                                                     strictMin,
-                                                     useFastFail);
-
       PoolFactory pf = new PoolFactory();
       Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, false);
 
@@ -457,24 +444,8 @@
                                                  cd.getConfigProperties(),
                                                  cl);
       // Create the pool
-      Integer minSize = ds.getXaPool() == null ? null : ds.getXaPool().getMinPoolSize();
-      Integer maxSize = ds.getXaPool() == null ? null : ds.getXaPool().getMaxPoolSize();
-      Long blockingTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getBlockingTimeoutMillis() : null;
-      Long idleTimeout = ds.getTimeOut() != null ? ds.getTimeOut().getIdleTimeoutMinutes() : null;
-      Long backgroundValidationInterval = null; // TODO
-      Boolean prefill = ds.getXaPool() == null ? null : ds.getXaPool().isPrefill();
-      Boolean strictMin = ds.getXaPool() == null ? null : ds.getXaPool().isUseStrictMin();
-      Boolean useFastFail = ds.getValidation() != null ? ds.getValidation().isUseFastFail() : null;
+      PoolConfiguration pc = createPoolConfiguration(ds.getXaPool(), ds.getTimeOut(), ds.getValidation());
 
-      PoolConfiguration pc = createPoolConfiguration(minSize,
-                                                     maxSize,
-                                                     blockingTimeout,
-                                                     idleTimeout,
-                                                     backgroundValidationInterval,
-                                                     prefill,
-                                                     strictMin,
-                                                     useFastFail);
-
       Boolean noTxSeparatePool = Boolean.FALSE;
 
       if (ds.getXaPool() != null && ds.getXaPool().isNoTxSeparatePool() != null)
@@ -529,51 +500,53 @@
 
    /**
     * Create an instance of the pool configuration based on the input
-    * @param minSize The min size
-    * @param maxSize The max size
-    * @param blockingTimeout The blocking timeout
-    * @param idleTimeout The idle timeout
-    * @param backgroundValidationInterval The background valdation interval
-    * @param prefill The prefill
-    * @param strictMin The strict min
-    * @param useFastFail The use fast fail
+    * @param pp The pool parameters
+    * @param tp The timeout parameters
+    * @param vp The validation parameters
     * @return The configuration
     */
-   private PoolConfiguration createPoolConfiguration(Integer minSize,
-                                                     Integer maxSize,
-                                                     Long blockingTimeout,
-                                                     Long idleTimeout,
-                                                     Long backgroundValidationInterval,
-                                                     Boolean prefill,
-                                                     Boolean strictMin,
-                                                     Boolean useFastFail)
+   private PoolConfiguration createPoolConfiguration(CommonPool pp,
+                                                     CommonTimeOut tp,
+                                                     CommonValidation vp)
    {
       PoolConfiguration pc = new PoolConfiguration();
 
-      if (minSize != null)
-         pc.setMinSize(minSize.intValue());
+      if (pp != null)
+      {
+         if (pp.getMinPoolSize() != null)
+            pc.setMinSize(pp.getMinPoolSize().intValue());
+         
+         if (pp.getMaxPoolSize() != null)
+            pc.setMaxSize(pp.getMaxPoolSize().intValue());
 
-      if (maxSize != null)
-         pc.setMaxSize(maxSize.intValue());
+         if (pp.isPrefill() != null)
+            pc.setPrefill(pp.isPrefill());
+         
+         if (pp.isUseStrictMin() != null)
+            pc.setStrictMin(pp.isUseStrictMin());
+      }
 
-      if (blockingTimeout != null)
-         pc.setBlockingTimeout(blockingTimeout.longValue());
+      if (tp != null)
+      {
+         if (tp.getBlockingTimeoutMillis() != null)
+            pc.setBlockingTimeout(tp.getBlockingTimeoutMillis().longValue());
 
-      if (idleTimeout != null)
-         pc.setIdleTimeout(idleTimeout.longValue());
+         if (tp.getIdleTimeoutMinutes() != null)
+            pc.setIdleTimeout(tp.getIdleTimeoutMinutes().longValue());
+      }
 
-      if (backgroundValidationInterval != null)
-         pc.setBackgroundValidationInterval(backgroundValidationInterval.longValue());
+      if (vp != null)
+      {
+         if (vp.isBackgroundValidation() != null)
+            pc.setBackgroundValidation(vp.isBackgroundValidation().booleanValue());
 
-      if (prefill != null)
-         pc.setPrefill(prefill.booleanValue());
+         if (vp.getBackgroundValidationMinutes() != null)
+            pc.setBackgroundValidationMinutes(vp.getBackgroundValidationMinutes().intValue());
 
-      if (strictMin != null)
-         pc.setStrictMin(strictMin.booleanValue());
+         if (vp.isUseFastFail() != null)
+            pc.setUseFastFail(vp.isUseFastFail());
+      }
 
-      if (useFastFail != null)
-         pc.setUseFastFail(useFastFail.booleanValue());
-
       return pc;
    }
 



More information about the jboss-cvs-commits mailing list