[jboss-cvs] JBossAS SVN: r111159 - in projects/jboss-jca/trunk: common/src/main/resources/schema and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 11 14:18:45 EDT 2011
Author: jesper.pedersen
Date: 2011-04-11 14:18:44 -0400 (Mon, 11 Apr 2011)
New Revision: 111159
Added:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PrefillPool.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/PrefillTestCase.java
Removed:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/PreFillPoolSupport.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PreFillPoolingTestCase.java
Modified:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd
projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd
projects/jboss-jca/trunk/common/src/main/resources/schema/resource-adapters_1_0.xsd
projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/api/connectionmanager/pool/PoolConfiguration.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPrefillPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/OnePool.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/PoolBySubject.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnection.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnectionFactory.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/OnePoolTestCase.java
projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
projects/jboss-jca/trunk/doc/userguide/en-US/modules/deployment.xml
Log:
[JBJCA-543] Prefill support not working correctly
Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -44,11 +44,10 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import org.jboss.logging.Logger;
-
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import org.jboss.logging.Logger;
/**
*
@@ -241,7 +240,7 @@
{
Integer minPoolSize = null;
Integer maxPoolSize = null;
- boolean prefill = true;
+ boolean prefill = false;
boolean useStrictMin = false;
while (reader.hasNext())
@@ -373,7 +372,7 @@
{
Integer minPoolSize = null;
Integer maxPoolSize = null;
- boolean prefill = true;
+ boolean prefill = false;
boolean interleaving = false;
boolean isSameRmOverrideValue = false;
boolean padXid = false;
Modified: projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd
===================================================================
--- projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/common/src/main/resources/schema/datasources_1_0.xsd 2011-04-11 18:18:44 UTC (rev 111159)
@@ -634,7 +634,7 @@
<![CDATA[[
Whether to attempt to prefill the connection pool. Empty element denotes
a true value. e.g. <prefill>true</prefill>.
- Default is true
+ Default is false
]]>
</xs:documentation>
</xs:annotation>
Modified: projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd
===================================================================
--- projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/common/src/main/resources/schema/ironjacamar_1_0.xsd 2011-04-11 18:18:44 UTC (rev 111159)
@@ -373,7 +373,7 @@
<xs:documentation>
<![CDATA[[
Whether to attempt to prefill the connection pool.
- Default is true. e.g. <prefill>true</prefill>.
+ Default is false. e.g. <prefill>false</prefill>.
]]>
</xs:documentation>
</xs:annotation>
Modified: projects/jboss-jca/trunk/common/src/main/resources/schema/resource-adapters_1_0.xsd
===================================================================
--- projects/jboss-jca/trunk/common/src/main/resources/schema/resource-adapters_1_0.xsd 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/common/src/main/resources/schema/resource-adapters_1_0.xsd 2011-04-11 18:18:44 UTC (rev 111159)
@@ -404,8 +404,8 @@
<xs:annotation>
<xs:documentation>
<![CDATA[[
- Whether to attempt to prefill the connection pool. Default is true.
- e.g. <prefill>true</prefill>.
+ Whether to attempt to prefill the connection pool. Default is false.
+ e.g. <prefill>false</prefill>.
]]>
</xs:documentation>
</xs:annotation>
Modified: projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java
===================================================================
--- projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/common/src/test/java/org/jboss/jca/common/metadata/ironjacamar/IronJacamarParserTestCase.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -416,7 +416,7 @@
assertThat(connDef.isXa(), is(false));
assertThat(connDef.getPool().getMinPoolSize(), new IsNull<Integer>());
assertThat(connDef.getPool().getMaxPoolSize(), new IsNull<Integer>());
- assertThat(connDef.getPool().isPrefill(), is(true));
+ assertThat(connDef.getPool().isPrefill(), is(false));
assertThat(connDef.getPool().isUseStrictMin(), is(false));
//security defaults
@@ -479,7 +479,7 @@
assertThat(connDef.isXa(), is(true));
assertThat(connDef.getPool().getMinPoolSize(), new IsNull<Integer>());
assertThat(connDef.getPool().getMaxPoolSize(), new IsNull<Integer>());
- assertThat(connDef.getPool().isPrefill(), is(true));
+ assertThat(connDef.getPool().isPrefill(), is(false));
assertThat(connDef.getPool().isUseStrictMin(), is(false));
//security defaults
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/api/connectionmanager/pool/PoolConfiguration.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/api/connectionmanager/pool/PoolConfiguration.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/api/connectionmanager/pool/PoolConfiguration.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -74,7 +74,7 @@
idleTimeout = new AtomicLong(1000 * 60 * 30);
backgroundValidation = new AtomicBoolean(false);
backgroundValidationMinutes = new AtomicInteger(0);
- prefill = new AtomicBoolean(true);
+ prefill = new AtomicBoolean(false);
strictMin = new AtomicBoolean(false);
useFastFail = new AtomicBoolean(false);
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPrefillPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPrefillPool.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/AbstractPrefillPool.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -23,6 +23,7 @@
package org.jboss.jca.core.connectionmanager.pool;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.pool.api.PrefillPool;
import javax.resource.spi.ConnectionRequestInfo;
import javax.resource.spi.ManagedConnectionFactory;
@@ -33,7 +34,7 @@
*
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
-public abstract class AbstractPrefillPool extends AbstractPool implements PreFillPoolSupport
+public abstract class AbstractPrefillPool extends AbstractPool implements PrefillPool
{
/** Should prefill be performed */
private boolean shouldPrefill = false;
@@ -55,25 +56,9 @@
/**
* {@inheritDoc}
*/
- public void prefill()
- {
- prefill(null, null, false);
- }
-
- /**
- * {@inheritDoc}
- */
- public void prefill(boolean noTxSeperatePool)
- {
- prefill(null, null, noTxSeperatePool);
- }
-
- /**
- * {@inheritDoc}
- */
public void prefill(Subject subject, ConnectionRequestInfo cri, boolean noTxnSeperatePool)
{
- if (shouldPrefill())
+ if (shouldPrefill)
{
if (log.isDebugEnabled())
log.debug("Attempting to prefill pool: " + getName());
@@ -93,12 +78,4 @@
}
}
}
-
- /**
- * {@inheritDoc}
- */
- public boolean shouldPrefill()
- {
- return shouldPrefill;
- }
}
Deleted: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/PreFillPoolSupport.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/PreFillPoolSupport.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/PreFillPoolSupport.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.core.connectionmanager.pool;
-
-import javax.resource.spi.ConnectionRequestInfo;
-import javax.security.auth.Subject;
-
-/**
- * PreFillPoolSupport allows for prefilling connection pools.
- *
- * @author <a href="weston.price at jboss.com">Weston Price</a>
- * @version $Revision: 71554 $
- */
-public interface PreFillPoolSupport
-{
-
- /**
- * Prefill the connection pool
- *
- */
- public void prefill();
-
- /**
- * Prefill the connection pool
- *
- * @param noTxSeperatePool whether or not we are seperating non transaction and transaction pools
- */
- public void prefill(boolean noTxSeperatePool);
-
- /**
- * Prefill the connection pool
- *
- * @param subject the subject the subject
- * @param cri the connection request info
- * @param noTxnSeperatePool whether or not we are seperating non transaction and transaction pools
- *
- */
- public void prefill(Subject subject, ConnectionRequestInfo cri, boolean noTxnSeperatePool);
-
- /**
- * Get the flag indicating whether or not to attempt to prefill this pool.
- *
- * @return true or false depending on whether or not to prefill this pool.
- */
- public boolean shouldPrefill();
-}
Copied: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PrefillPool.java (from rev 111136, projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/PreFillPoolSupport.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PrefillPool.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/api/PrefillPool.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.connectionmanager.pool.api;
+
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.security.auth.Subject;
+
+/**
+ * Prefill pool allows for prefilling connection pools.
+ *
+ * @author <a href="weston.price at jboss.com">Weston Price</a>
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public interface PrefillPool extends Pool
+{
+ /**
+ * Prefill the connection pool
+ *
+ * @param subject the subject the subject
+ * @param cri the connection request info
+ * @param noTxnSeperatePool whether or not we are seperating non transaction and transaction pools
+ *
+ */
+ public void prefill(Subject subject, ConnectionRequestInfo cri, boolean noTxnSeperatePool);
+}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ArrayBlockingQueueManagedConnectionPool.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -27,6 +27,7 @@
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListenerFactory;
import org.jboss.jca.core.connectionmanager.listener.ConnectionState;
+import org.jboss.jca.core.connectionmanager.pool.AbstractPrefillPool;
import org.jboss.jca.core.connectionmanager.pool.SubPoolContext;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.idle.IdleRemover;
@@ -131,6 +132,24 @@
ConnectionRequestInfo cri, PoolConfiguration pc, Pool p, SubPoolContext spc,
Logger log)
{
+ if (mcf == null)
+ throw new IllegalArgumentException("ManagedConnectionFactory is null");
+
+ if (clf == null)
+ throw new IllegalArgumentException("ConnectionListenerFactory is null");
+
+ if (pc == null)
+ throw new IllegalArgumentException("PoolConfiguration is null");
+
+ if (p == null)
+ throw new IllegalArgumentException("Pool is null");
+
+ if (spc == null)
+ throw new IllegalArgumentException("SubPoolContext is null");
+
+ if (log == null)
+ throw new IllegalArgumentException("Logger is null");
+
this.mcf = mcf;
this.clf = clf;
this.defaultSubject = subject;
@@ -145,7 +164,8 @@
this.permits = new ConcurrentHashMap<ConnectionListener, ConnectionListener>(this.maxSize);
this.statistics = new ManagedConnectionPoolStatisticsImpl();
- if (pc.isPrefill())
+ // Schedule managed connection pool for prefill
+ if (pc.isPrefill() && p instanceof AbstractPrefillPool)
{
PoolFiller.fillPool(this);
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreArrayListManagedConnectionPool.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -27,6 +27,7 @@
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListenerFactory;
import org.jboss.jca.core.connectionmanager.listener.ConnectionState;
+import org.jboss.jca.core.connectionmanager.pool.AbstractPrefillPool;
import org.jboss.jca.core.connectionmanager.pool.SubPoolContext;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.idle.IdleRemover;
@@ -138,6 +139,24 @@
ConnectionRequestInfo cri, PoolConfiguration pc, Pool p, SubPoolContext spc,
Logger log)
{
+ if (mcf == null)
+ throw new IllegalArgumentException("ManagedConnectionFactory is null");
+
+ if (clf == null)
+ throw new IllegalArgumentException("ConnectionListenerFactory is null");
+
+ if (pc == null)
+ throw new IllegalArgumentException("PoolConfiguration is null");
+
+ if (p == null)
+ throw new IllegalArgumentException("Pool is null");
+
+ if (spc == null)
+ throw new IllegalArgumentException("SubPoolContext is null");
+
+ if (log == null)
+ throw new IllegalArgumentException("Logger is null");
+
this.mcf = mcf;
this.clf = clf;
this.defaultSubject = subject;
@@ -152,7 +171,8 @@
this.permits = new Semaphore(this.maxSize, true);
this.statistics = new ManagedConnectionPoolStatisticsImpl();
- if (pc.isPrefill())
+ // Schedule managed connection pool for prefill
+ if (pc.isPrefill() && p instanceof AbstractPrefillPool)
{
PoolFiller.fillPool(this);
}
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/OnePool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/OnePool.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/OnePool.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -26,7 +26,6 @@
import org.jboss.jca.core.connectionmanager.pool.AbstractPrefillPool;
import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool;
-import javax.resource.ResourceException;
import javax.resource.spi.ConnectionRequestInfo;
import javax.resource.spi.ManagedConnectionFactory;
import javax.security.auth.Subject;
@@ -68,27 +67,6 @@
}
/**
- * Prefill.
- *
- * @param sub subject instance
- */
- public void prefill(Subject sub)
- {
- if (log.isDebugEnabled())
- log.debug("Attempting to prefill pool" + getClass());
-
- try
- {
- // WMP is this really the best way to do this?
- getSubPool(getKey(null, null, false), null, null);
- }
- catch (ResourceException e)
- {
- log.error("Prefill failed for pool instance " + getClass(), e);
- }
- }
-
- /**
* {@inheritDoc}
*/
public void emptySubPool(ManagedConnectionPool pool)
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/PoolBySubject.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/PoolBySubject.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/strategy/PoolBySubject.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -23,7 +23,7 @@
package org.jboss.jca.core.connectionmanager.pool.strategy;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
-import org.jboss.jca.core.connectionmanager.pool.AbstractPool;
+import org.jboss.jca.core.connectionmanager.pool.AbstractPrefillPool;
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionRequestInfo;
@@ -36,7 +36,7 @@
* @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
-public class PoolBySubject extends AbstractPool
+public class PoolBySubject extends AbstractPrefillPool
{
/**
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnection.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnection.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -22,6 +22,8 @@
package org.jboss.jca.core.connectionmanager.common;
import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionEventListener;
@@ -41,15 +43,15 @@
*/
public class MockManagedConnection implements ManagedConnection
{
-
private int cleanUpCalled = 0;
+ private Set<ConnectionEventListener> listeners;
/**
* Creates a new instance.
*/
public MockManagedConnection()
{
-
+ this.listeners = new HashSet<ConnectionEventListener>();
}
/**
@@ -57,8 +59,7 @@
*/
public void addConnectionEventListener(ConnectionEventListener listener)
{
-
-
+ listeners.add(listener);
}
/**
@@ -67,8 +68,6 @@
public void associateConnection(Object connection) throws ResourceException
{
-
-
}
/**
@@ -78,7 +77,6 @@
public void cleanup() throws ResourceException
{
cleanUpCalled++;
-
}
/**
@@ -87,8 +85,6 @@
public void destroy() throws ResourceException
{
-
-
}
/**
@@ -106,7 +102,6 @@
public LocalTransaction getLocalTransaction() throws ResourceException
{
-
return new MockLocalTransaction();
}
@@ -116,7 +111,6 @@
public PrintWriter getLogWriter() throws ResourceException
{
-
return null;
}
@@ -126,7 +120,6 @@
public ManagedConnectionMetaData getMetaData() throws ResourceException
{
-
return null;
}
@@ -136,7 +129,6 @@
public XAResource getXAResource() throws ResourceException
{
-
return new MockXAResource();
}
@@ -146,8 +138,7 @@
public void removeConnectionEventListener(ConnectionEventListener listener)
{
-
-
+ listeners.remove(listener);
}
/**
@@ -156,8 +147,6 @@
public void setLogWriter(PrintWriter out) throws ResourceException
{
-
-
}
/**
@@ -169,5 +158,4 @@
{
return cleanUpCalled;
}
-
}
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnectionFactory.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/common/MockManagedConnectionFactory.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -57,7 +57,6 @@
public Object createConnectionFactory() throws ResourceException
{
-
return null;
}
@@ -68,7 +67,6 @@
public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
throws ResourceException
{
-
return new MockManagedConnection();
}
@@ -78,7 +76,6 @@
public PrintWriter getLogWriter() throws ResourceException
{
-
return null;
}
@@ -87,9 +84,14 @@
*/
@SuppressWarnings("unchecked")
public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
- ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
{
-
+ for (Object c : connectionSet)
+ {
+ if (c instanceof MockManagedConnection)
+ return (ManagedConnection)c;
+ }
+
return null;
}
@@ -99,8 +101,5 @@
public void setLogWriter(PrintWriter out) throws ResourceException
{
-
-
}
-
}
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/OnePoolTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/OnePoolTestCase.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/OnePoolTestCase.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -22,6 +22,8 @@
package org.jboss.jca.core.connectionmanager.pool;
import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.NoTxConnectionManager;
import org.jboss.jca.core.connectionmanager.listener.ConnectionListener;
import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPool;
import org.jboss.jca.core.connectionmanager.pool.strategy.OnePool;
@@ -98,65 +100,6 @@
/**
*
- * prefillWithSubjectArgumentShouldPopulateSubPool
- * @throws Exception in case of unexpected errors
- */
- @Test
- public void prefillWithSubjectArgumentShouldPopulateSubPool() throws Exception
- {
- //given
- AbstractPool pool = new OnePool(mock(ManagedConnectionFactory.class), mock(PoolConfiguration.class), false);
- //when (note: argument is not important, set to null just for convenience)
- ((OnePool) pool).prefill(null);
- //then
- assertThat(pool.getSubPools().get(pool.getKey(null, null, false)) == null, is(false));
- }
-
- /**
- *
- * prefillWithAllArgumentsShouldPopulateSubPoolIfPoolConfigHasPrefillSetToTrue
- * @throws Exception in case of unexpected errors
- */
- @Test
- public void prefillWithAllArgumentsShouldPopulateSubPoolIfPoolConfigHasPrefillSetToTrue() throws Exception
- {
- //given
- PoolConfiguration config = new PoolConfiguration();
- //prefill=true is the default
- ManagedConnectionFactory mcf = mock(ManagedConnectionFactory.class);
- AbstractPrefillPool pool = new OnePool(mcf, config, false);
- Subject subject = new Subject();
- ConnectionRequestInfo cri = mock(ConnectionRequestInfo.class);
- boolean noTxnSeperatePool = true;
- //when
- pool.prefill(subject, cri, noTxnSeperatePool);
- //then
- assertThat(pool.getSubPools().get(pool.getKey(subject, cri, noTxnSeperatePool)) == null, is(false));
- }
-
- /**
- *
- * prefillWithAllArgumentsShouldPopulateSubPool
- * @throws Exception in case of unexpected errors
- */
- @Test
- public void prefillWithAllArgumentsShouldDoNothingIfPoolConfigHasPrefillSetToFalse() throws Exception
- {
- //given
- PoolConfiguration config = new PoolConfiguration();
- config.setPrefill(false);
- AbstractPrefillPool pool = new OnePool(mock(ManagedConnectionFactory.class), config, false);
- Subject subject = new Subject();
- ConnectionRequestInfo cri = mock(ConnectionRequestInfo.class);
- boolean noTxnSeperatePool = true;
- //when
- pool.prefill(subject, cri, noTxnSeperatePool);
- //then
- assertThat(pool.getSubPools().get(pool.getKey(subject, cri, noTxnSeperatePool)), is((SubPoolContext) null));
- }
-
- /**
- *
* emptySubPoolShouldDoNothing
* @throws Exception in case of unexpected errors
*/
@@ -166,11 +109,9 @@
//given
AbstractPool pool = new OnePool(mock(ManagedConnectionFactory.class), mock(PoolConfiguration.class), false);
//when (note: argument is not important, set to null just for convenience)
- ((OnePool) pool).prefill(null);
((OnePool) pool).emptySubPool(null);
//then
- assertThat(pool.getSubPools().get(pool.getKey(null, null, false)) == null, is(false));
-
+ assertThat(pool.getSubPools().get(pool.getKey(null, null, false)) == null, is(true));
}
/**
@@ -184,7 +125,6 @@
//given
AbstractPool pool = new OnePool(mock(ManagedConnectionFactory.class), mock(PoolConfiguration.class), false);
//when (note: argument is not important, set to null just for convenience)
- ((OnePool) pool).prefill(null);
((OnePool) pool).flush();
//then
assertThat(pool.getSubPools().size(), is(0));
@@ -202,7 +142,6 @@
//given
AbstractPool pool = new OnePool(mock(ManagedConnectionFactory.class), mock(PoolConfiguration.class), false);
//when (note: argument is not important, set to null just for convenience)
- ((OnePool) pool).prefill(null);
((OnePool) pool).shutdown();
//then
assertThat(pool.getSubPools().size(), is(0));
Copied: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/PrefillTestCase.java (from rev 111136, projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PreFillPoolingTestCase.java)
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/PrefillTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/pool/PrefillTestCase.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -0,0 +1,256 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.core.connectionmanager.pool;
+
+import org.jboss.jca.core.api.connectionmanager.pool.PoolConfiguration;
+import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
+import org.jboss.jca.core.connectionmanager.NoTxConnectionManager;
+import org.jboss.jca.core.connectionmanager.common.MockManagedConnectionFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.connectionmanager.pool.api.PrefillPool;
+import org.jboss.jca.core.connectionmanager.pool.mcp.ManagedConnectionPoolStatistics;
+import org.jboss.jca.core.security.DefaultSubjectFactory;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.security.auth.Subject;
+
+import org.jboss.security.SubjectFactory;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Prefill test case
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class PrefillTestCase
+{
+ /**
+ * OnePool
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testOnePool() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ PoolConfiguration config = new PoolConfiguration();
+ config.setMinSize(10);
+ config.setPrefill(true);
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, config, false);
+
+ assertTrue(pool instanceof PrefillPool);
+
+ AbstractPrefillPool app = (AbstractPrefillPool)pool;
+
+ NoTxConnectionManager noTxConnectionManager =
+ cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool, null, null, null, null);
+
+ app.prefill(null, null, false);
+
+ assertEquals(1, app.getSubPools().size());
+
+ Thread.sleep(1000);
+
+ int size = 0;
+
+ for (SubPoolContext spc : app.getSubPools().values())
+ {
+ ManagedConnectionPoolStatistics mcps = spc.getSubPool().getStatistics();
+ size += mcps.getActiveCount();
+ }
+
+ assertEquals(10, size);
+ }
+
+ /**
+ * OnePool: No prefill
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testOnePoolNoPrefill() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ PoolConfiguration config = new PoolConfiguration();
+ config.setMinSize(10);
+ config.setPrefill(false);
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, config, false);
+
+ assertTrue(pool instanceof PrefillPool);
+
+ AbstractPrefillPool app = (AbstractPrefillPool)pool;
+
+ NoTxConnectionManager noTxConnectionManager =
+ cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, pool, null, null, null, null);
+
+ app.prefill(null, null, false);
+
+ assertEquals(0, app.getSubPools().size());
+
+ Thread.sleep(1000);
+
+ int size = 0;
+
+ for (SubPoolContext spc : app.getSubPools().values())
+ {
+ ManagedConnectionPoolStatistics mcps = spc.getSubPool().getStatistics();
+ size += mcps.getActiveCount();
+ }
+
+ assertEquals(0, size);
+ }
+
+ /**
+ * PoolByCri
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testPoolByCri() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ PoolConfiguration config = new PoolConfiguration();
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.POOL_BY_CRI, mcf, config, false);
+
+ assertFalse(pool instanceof PrefillPool);
+ }
+
+ /**
+ * PoolBySubject
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testPoolBySubject() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ SubjectFactory subjectFactory = new DefaultSubjectFactory("domain", "user", "password");
+ Subject subject = subjectFactory.createSubject();
+
+ PoolConfiguration config = new PoolConfiguration();
+ config.setMinSize(10);
+ config.setPrefill(true);
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.POOL_BY_SUBJECT, mcf, config, false);
+
+ assertTrue(pool instanceof PrefillPool);
+
+ AbstractPrefillPool app = (AbstractPrefillPool)pool;
+
+ NoTxConnectionManager noTxConnectionManager =
+ cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, app, subjectFactory, "domain", null, null);
+
+ app.prefill(subject, null, false);
+
+ assertEquals(1, app.getSubPools().size());
+
+ Thread.sleep(1000);
+
+ int size = 0;
+
+ for (SubPoolContext spc : app.getSubPools().values())
+ {
+ ManagedConnectionPoolStatistics mcps = spc.getSubPool().getStatistics();
+ size += mcps.getActiveCount();
+ }
+
+ assertEquals(10, size);
+ }
+
+ /**
+ * PoolBySubject: No prefill
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testPoolBySubjectNoPrefill() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ SubjectFactory subjectFactory = new DefaultSubjectFactory("domain", "user", "password");
+ Subject subject = subjectFactory.createSubject();
+
+ PoolConfiguration config = new PoolConfiguration();
+ config.setMinSize(10);
+ config.setPrefill(false);
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.POOL_BY_SUBJECT, mcf, config, false);
+
+ assertTrue(pool instanceof PrefillPool);
+
+ AbstractPrefillPool app = (AbstractPrefillPool)pool;
+
+ NoTxConnectionManager noTxConnectionManager =
+ cmf.createNonTransactional(TransactionSupportLevel.NoTransaction, app, subjectFactory, "domain", null, null);
+
+ app.prefill(subject, null, false);
+
+ assertEquals(0, app.getSubPools().size());
+
+ Thread.sleep(1000);
+
+ int size = 0;
+
+ for (SubPoolContext spc : app.getSubPools().values())
+ {
+ ManagedConnectionPoolStatistics mcps = spc.getSubPool().getStatistics();
+ size += mcps.getActiveCount();
+ }
+
+ assertEquals(0, size);
+ }
+
+ /**
+ * PoolBySubjectAndCri
+ * @throws Exception for exception.
+ */
+ @Test
+ public void testPoolBySubjectAndCri() throws Exception
+ {
+ ConnectionManagerFactory cmf = new ConnectionManagerFactory();
+ ManagedConnectionFactory mcf = new MockManagedConnectionFactory();
+
+ PoolConfiguration config = new PoolConfiguration();
+
+ PoolFactory pf = new PoolFactory();
+ Pool pool = pf.create(PoolStrategy.POOL_BY_SUBJECT_AND_CRI, mcf, config, false);
+
+ assertFalse(pool instanceof PrefillPool);
+ }
+}
Modified: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PoolConfigurationTestCase.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -110,9 +110,9 @@
public void testIsPrefill()
{
PoolConfiguration params = new PoolConfiguration();
+ assertFalse("Prefill must be false", params.isPrefill());
+ params.setPrefill(true);
assertTrue("Prefill must be true", params.isPrefill());
- params.setPrefill(false);
- assertFalse("Prefill must be false", params.isPrefill());
}
/**
Deleted: projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PreFillPoolingTestCase.java
===================================================================
--- projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PreFillPoolingTestCase.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/core/src/test/java/org/jboss/jca/core/connectionmanager/unit/pool/PreFillPoolingTestCase.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.core.connectionmanager.unit.pool;
-
-import org.junit.Test;
-
-/**
- * PreFillPoolingTestCase.
- * @author <a href="mailto:gurkanerdogdu at yahoo.com">Gurkan Erdogdu</a>
- * @version $Rev$ $Date$
- *
- */
-public class PreFillPoolingTestCase
-{
-
- /**
- * testDeployPreFillPool.
- * @throws Exception for exception.
- */
- @Test
- public void testDeployPreFillPool() throws Exception
- {
-
- }
-
- /**
- * testPreFillFlush.
- * @throws Exception for exception.
- */
- @Test
- public void testPreFillFlush() throws Exception
- {
-
- }
-
- /**
- * testDeployNoPreFillPool.
- * @throws Exception for exception.
- */
- @Test
- public void testDeployNoPreFillPool() throws Exception
- {
-
- }
-
- /**
- * testDeployElementNoPreFillPool.
- * @throws Exception for exception.
- */
- @Test
- public void testDeployElementNoPreFillPool() throws Exception
- {
-
- }
-
- /**
- * testInvalidPreFillPool.
- * @throws Exception for exception.
- */
- @Test
- public void testInvalidPreFillPool() throws Exception
- {
-
- }
-
- /**
- * testPoolByCriPreFill.
- * @throws Exception for exception.
- */
- @Test
- public void testPoolByCriPreFill() throws Exception
- {
-
- }
-
- /**
- * testNonPreFillSupportingPoolPreFill.
- * @throws Exception for exception.
- */
- @Test
- public void testNonPreFillSupportingPoolPreFill() throws Exception
- {
-
- }
-
- /**
- * testNoPreFillSupportingPool.
- * @throws Exception for exception.
- */
- @Test
- public void testNoPreFillSupportingPool() throws Exception
- {
-
- }
-
- /**
- * testPreFillSupportingPool.
- * @throws Exception for exception.
- */
- @Test
- public void testPreFillSupportingPool() throws Exception
- {
-
- }
-}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -44,6 +44,7 @@
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.connectionmanager.pool.api.PrefillPool;
import org.jboss.jca.core.recovery.DefaultRecoveryPlugin;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
@@ -62,6 +63,7 @@
import javax.resource.spi.ManagedConnectionFactory;
import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.security.auth.Subject;
import org.jboss.logging.Logger;
import org.jboss.security.SubjectFactory;
@@ -430,6 +432,19 @@
}
}
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = subjectFactory.createSubject();
+
+ pp.prefill(subject, null, false);
+ }
+
// ConnectionFactory
return mcf.createConnectionFactory(cm);
}
@@ -683,6 +698,19 @@
recovery = recoveryImpl;
}
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = subjectFactory.createSubject();
+
+ pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ }
+
// ConnectionFactory
return mcf.createConnectionFactory(cm);
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2011-04-11 18:18:44 UTC (rev 111159)
@@ -48,8 +48,10 @@
import org.jboss.jca.core.connectionmanager.ConnectionManager;
import org.jboss.jca.core.connectionmanager.ConnectionManagerFactory;
import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
import org.jboss.jca.core.connectionmanager.pool.api.PoolFactory;
import org.jboss.jca.core.connectionmanager.pool.api.PoolStrategy;
+import org.jboss.jca.core.connectionmanager.pool.api.PrefillPool;
import org.jboss.jca.core.recovery.DefaultRecoveryPlugin;
import org.jboss.jca.core.spi.recovery.RecoveryPlugin;
import org.jboss.jca.core.spi.transaction.TransactionIntegration;
@@ -89,6 +91,7 @@
import javax.resource.spi.ResourceAdapterAssociation;
import javax.resource.spi.TransactionSupport;
import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.security.auth.Subject;
import javax.transaction.TransactionManager;
import org.jboss.logging.Logger;
@@ -1154,6 +1157,19 @@
addAll(createManagementView(ra10.getConfigProperties()));
mgtConnector.getConnectionFactories().add(mgtCf);
+
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = subjectFactory.createSubject();
+
+ pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ }
}
}
}
@@ -1607,6 +1623,19 @@
addAll(createManagementView(cdMeta.getConfigProperties()));
mgtConnector.getConnectionFactories().add(mgtCf);
+
+ // Prefill
+ if (pool instanceof PrefillPool)
+ {
+ PrefillPool pp = (PrefillPool)pool;
+ SubjectFactory subjectFactory = getSubjectFactory(securityDomain);
+ Subject subject = null;
+
+ if (subjectFactory != null)
+ subject = subjectFactory.createSubject();
+
+ pp.prefill(subject, null, noTxSeparatePool.booleanValue());
+ }
}
}
}
Modified: projects/jboss-jca/trunk/doc/userguide/en-US/modules/deployment.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en-US/modules/deployment.xml 2011-04-11 16:30:40 UTC (rev 111158)
+++ projects/jboss-jca/trunk/doc/userguide/en-US/modules/deployment.xml 2011-04-11 18:18:44 UTC (rev 111159)
@@ -316,7 +316,7 @@
<entry><code>prefill</code></entry>
<entry>
Whether to attempt to prefill the connection pool.
- Default is true
+ Default is false
</entry>
</row>
<row>
@@ -362,7 +362,7 @@
<entry><code>prefill</code></entry>
<entry>
Whether to attempt to prefill the connection pool.
- Default is true
+ Default is false
</entry>
</row>
<row>
@@ -932,7 +932,7 @@
<entry><code>prefill</code></entry>
<entry>
Whether to attempt to prefill the connection pool. Empty element denotes
- a true value. Default is true
+ a true value. Default is false
</entry>
</row>
<row>
@@ -978,7 +978,7 @@
<entry><code>prefill</code></entry>
<entry>
Whether to attempt to prefill the connection pool. Empty element denotes
- a true value. Default is true
+ a true value. Default is false
</entry>
</row>
<row>
More information about the jboss-cvs-commits
mailing list