[jboss-svn-commits] JBL Code SVN: r33029 - labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/xa/managed.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon May 24 06:06:22 EDT 2010


Author: whitingjr
Date: 2010-05-24 06:06:21 -0400 (Mon, 24 May 2010)
New Revision: 33029

Removed:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/xa/managed/LazyCachedXAManagedConnection.java
Log:
Removed unused class.

Deleted: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/xa/managed/LazyCachedXAManagedConnection.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/xa/managed/LazyCachedXAManagedConnection.java	2010-05-24 10:05:36 UTC (rev 33028)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/xa/managed/LazyCachedXAManagedConnection.java	2010-05-24 10:06:21 UTC (rev 33029)
@@ -1,94 +0,0 @@
- /*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2005, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt 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.jbossts.performance.xa.managed;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.resource.ResourceException;
-import javax.resource.spi.ConnectionRequestInfo;
-import javax.security.auth.Subject;
-import javax.sql.XAConnection;
-
-import org.apache.log4j.Logger;
-import org.jboss.resource.adapter.jdbc.xa.XAManagedConnection;
-import org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory;
-
-/**
- * A LazyCachedXAManagedConnection to hold a reference of the XAConnection
- * object and associate it with the thread. The client application has been
- * designed to use the same connection for a single thread.
- * Reason for this design is to avoid the connection pooling implementation 
- * which attempts to allocate a connection object for each transaction.
- * 
- * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
- * @version $Revision: 1.1 $
- */
-public class LazyCachedXAManagedConnection extends XAManagedConnection
-{
-   private ThreadLocal<Object> cachedConnection = new ThreadLocal<Object>();
-   private static Logger logger = Logger.getLogger(LazyCachedXAManagedConnection.class);
-   
-   public LazyCachedXAManagedConnection(XAManagedConnectionFactory mcf, XAConnection xaConnection, Properties props,
-         int transactionIsolation, int psCacheSize) throws SQLException
-   {
-      super(mcf, xaConnection, props, transactionIsolation, psCacheSize);
-   }
-   
-   /**
-    * Provide a cached ManagedConnection object. This implementation uses lazy
-    * loading, the first request will pass on the request to the underlying 
-    * implementation.
-    * After the first initial request all subsequent requests will return the 
-    * same ManagedConnection.
-    */
-   @Override
-   public Object getConnection(Subject subject, ConnectionRequestInfo cri) throws ResourceException
-   {
-      if (null == this.cachedConnection.get())
-      {
-         this.cachedConnection.set(super.getConnection(subject, cri));
-      }
-      /**
-       * In some situations the underlying Connection was closed by the application.
-       * The performance framework should not be doing this. Usually this happens 
-       * during initialisation of the 
-       * entity objects. So detect when this occured and obtain a
-       * fresh WrappedConnection handle.
-       */
-      try
-      {
-         if (((Connection)this.cachedConnection.get()).isClosed() )
-         {
-            //ok, throw away the cached object. This allocates the Connection again for the thread
-            this.cachedConnection.set(super.getConnection(subject, cri));
-         }
-      } catch (SQLException sqle)
-      {
-         logger.error(sqle.getMessage(), sqle);
-      }
-      
-      return this.cachedConnection.get();
-   }
-}



More information about the jboss-svn-commits mailing list