[jboss-cvs] JBossAS SVN: r107264 - branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 2 11:28:38 EDT 2010
Author: jesper.pedersen
Date: 2010-08-02 11:28:38 -0400 (Mon, 02 Aug 2010)
New Revision: 107264
Modified:
branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java
Log:
[JBPAPP-2845] Lazy initialization fix
Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2010-08-02 14:51:44 UTC (rev 107263)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/InternalManagedConnectionPool.java 2010-08-02 15:28:38 UTC (rev 107264)
@@ -87,6 +87,9 @@
/** Whether trace is enabled */
private final boolean trace;
+
+ /** The subpool */
+ private JBossManagedConnectionPool.SubPoolContext subPoolContext;
/** Stats */
private final Counter connectionCounter = new Counter();
@@ -114,6 +117,7 @@
*/
protected InternalManagedConnectionPool(ManagedConnectionFactory mcf, ConnectionListenerFactory clf, Subject subject,
ConnectionRequestInfo cri, PoolParams poolParams, JBossManagedConnectionPool jmcp,
+ JBossManagedConnectionPool.SubPoolContext subPoolContext,
Logger log)
{
this.mcf = mcf;
@@ -124,6 +128,7 @@
this.maxSize = poolParams.maxSize;
this.jmcp = jmcp;
this.log = log;
+ this.subPoolContext = subPoolContext;
this.trace = log.isTraceEnabled();
this.cls = new ArrayList(this.maxSize);
this.permits = new Semaphore(this.maxSize, true);
@@ -835,6 +840,11 @@
return poolParams.minSize;
}
+ public JBossManagedConnectionPool.SubPoolContext getSubPoolContext()
+ {
+ return subPoolContext;
+ }
+
public static class PoolParams
{
public int minSize = 0;
Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java 2010-08-02 14:51:44 UTC (rev 107263)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/JBossManagedConnectionPool.java 2010-08-02 15:28:38 UTC (rev 107264)
@@ -562,7 +562,7 @@
public SubPoolContext(TransactionManager tm, ManagedConnectionFactory mcf, ConnectionListenerFactory clf, Subject subject,
ConnectionRequestInfo cri, PoolParams poolParams, JBossManagedConnectionPool jmcp, Logger log)
{
- subPool = new InternalManagedConnectionPool(mcf, clf, subject, cri, poolParams, jmcp, log);
+ subPool = new InternalManagedConnectionPool(mcf, clf, subject, cri, poolParams, jmcp, this, log);
if (tm != null)
trackByTx = new TransactionLocal(tm);
}
Modified: branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java
===================================================================
--- branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java 2010-08-02 14:51:44 UTC (rev 107263)
+++ branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java 2010-08-02 15:28:38 UTC (rev 107264)
@@ -52,6 +52,7 @@
import org.jboss.resource.JBossResourceException;
import org.jboss.resource.connectionmanager.xa.XAResourceWrapperImpl;
import org.jboss.tm.LastResource;
+import org.jboss.tm.TransactionLocal;
import org.jboss.tm.TransactionTimeoutConfiguration;
import org.jboss.tm.TxUtils;
import org.jboss.util.NestedRuntimeException;
@@ -434,6 +435,29 @@
{
cls.add(cl);
cl.enlist();
+ if(!isInterleaving())
+ {
+ cl.setTrackByTx(true);
+ InternalManagedConnectionPool imcp = (InternalManagedConnectionPool)cl.getContext();
+ JBossManagedConnectionPool.SubPoolContext subPool = imcp.getSubPoolContext();
+ TransactionLocal trackByTx = subPool.getTrackByTx();
+ try
+ {
+ trackByTx.lock();
+ }
+ catch (Throwable t)
+ {
+ rethrowAsSystemException("Unable to begin transaction with JCA lazy enlistment scenario", trackByTx.getTransaction(), t);
+ }
+ try
+ {
+ trackByTx.set(cl);
+ }
+ finally
+ {
+ trackByTx.unlock();
+ }
+ }
}
}
}
More information about the jboss-cvs-commits
mailing list