[jboss-svn-commits] JBL Code SVN: r34419 - in labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance: managed and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 30 11:54:32 EDT 2010


Author: whitingjr
Date: 2010-07-30 11:54:32 -0400 (Fri, 30 Jul 2010)
New Revision: 34419

Added:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/AbstractCachedConnectionWrapper.java
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/localtx/
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/localtx/LocalTXWrappedConnection.java
Log:
Added objects to control the connection management.

Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/AbstractCachedConnectionWrapper.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/AbstractCachedConnectionWrapper.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/AbstractCachedConnectionWrapper.java	2010-07-30 15:54:32 UTC (rev 34419)
@@ -0,0 +1,62 @@
+ /*
+  * 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.managed;
+
+import java.sql.SQLException;
+
+import org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection;
+import org.jboss.resource.adapter.jdbc.WrappedConnection;
+
+/**
+ * 
+ * A AbstractCachedConnectionWrapper object to provide common
+ * behaviour to the cached connection wrapper concrete classes.
+ * This exposes a method to release the cached connection back
+ * to the pool.
+ * 
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractCachedConnectionWrapper extends WrappedConnection
+{
+   protected WrappedConnection connection;
+
+   public AbstractCachedConnectionWrapper(final BaseWrapperManagedConnection mc, final WrappedConnection conn)
+   {
+      super(mc);
+      this.connection = conn;
+   }
+   
+   public void deCacheConnection()
+      throws SQLException
+   {
+      if (null != this.connection && !this.connection.isClosed())
+      {
+         this.connection.close();
+      }
+      releaseResources();
+   }
+   
+   protected abstract void releaseResources();
+   
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/localtx/LocalTXWrappedConnection.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/localtx/LocalTXWrappedConnection.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/managed/localtx/LocalTXWrappedConnection.java	2010-07-30 15:54:32 UTC (rev 34419)
@@ -0,0 +1,277 @@
+ /*
+  * 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.managed.localtx;
+
+import java.sql.CallableStatement;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.util.Map;
+
+import org.jboss.jbossts.performance.managed.AbstractCachedConnectionWrapper;
+import org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection;
+import org.jboss.resource.adapter.jdbc.WrappedConnection;
+import org.jboss.resource.adapter.jdbc.WrapperDataSource;
+
+public class LocalTXWrappedConnection extends AbstractCachedConnectionWrapper
+{
+   
+   public LocalTXWrappedConnection(final BaseWrapperManagedConnection mc, final WrappedConnection conn)
+   {
+      super(null, conn);
+      this.connection = conn;
+   }
+
+   @Override
+   public void clearWarnings() throws SQLException
+   {
+      this.connection.clearWarnings();
+   }
+   @Override
+   public void close() throws SQLException
+   {
+   }
+   
+   @Override
+   public void commit() throws SQLException
+   {
+      this.connection.commit();
+   }
+
+   public Statement createStatement() throws SQLException
+   {
+      return this.connection.createStatement();
+   }
+   @Override
+   public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
+   {
+      return this.connection.createStatement(resultSetType, resultSetConcurrency);
+   }
+   @Override
+   public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
+         throws SQLException
+   {
+      return this.connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
+   }
+   @Override
+   public boolean getAutoCommit() throws SQLException
+   {
+      return this.connection.getAutoCommit();
+   }
+   @Override
+   public String getCatalog() throws SQLException
+   {
+      return this.connection.getCatalog();
+   }
+   @Override
+   public int getHoldability() throws SQLException
+   {
+      return this.connection.getHoldability();
+   }
+   @Override
+   public DatabaseMetaData getMetaData() throws SQLException
+   {
+      return this.connection.getMetaData();
+   }
+   @Override
+   public int getTransactionIsolation() throws SQLException
+   {
+      // FIXME getTransactionIsolation
+      return this.connection.getTransactionIsolation();
+   }
+   @SuppressWarnings("unchecked")
+   @Override
+   public Map<String, Class<?>> getTypeMap() throws SQLException
+   {
+      // FIXME getTypeMap
+      return this.connection.getTypeMap();
+   }
+   @Override
+   public SQLWarning getWarnings() throws SQLException
+   {
+      // FIXME getWarnings
+      return this.connection.getWarnings();
+   }
+   @Override
+   public boolean isClosed() throws SQLException
+   {
+      // FIXME isClosed
+      return this.connection.isClosed();
+   }
+   @Override
+   public boolean isReadOnly() throws SQLException
+   {
+      // FIXME isReadOnly
+      return this.connection.isReadOnly();
+   }
+   @Override
+   public String nativeSQL(String sql) throws SQLException
+   {
+      // FIXME nativeSQL
+      return this.connection.nativeSQL(sql);
+   }
+   @Override
+   public CallableStatement prepareCall(String sql) throws SQLException
+   {
+      // FIXME prepareCall
+      return this.connection.prepareCall(sql);
+   }
+   @Override
+   public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
+   {
+      // FIXME prepareCall
+      return this.connection.prepareCall(sql, resultSetType, resultSetConcurrency);
+   }
+   @Override
+   public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
+         int resultSetHoldability) throws SQLException
+   {
+      // FIXME prepareCall
+      return this.connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql) throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql, autoGeneratedKeys);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
+         throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql, resultSetType, resultSetConcurrency);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
+         int resultSetHoldability) throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql, columnIndexes);
+   }
+   @Override
+   public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
+   {
+      // FIXME prepareStatement
+      return this.connection.prepareStatement(sql, columnNames);
+   }
+   @Override
+   public void releaseSavepoint(Savepoint savepoint) throws SQLException
+   {
+      // FIXME releaseSavepoint
+      this.connection.releaseSavepoint(savepoint);
+   }
+
+   @Override
+   public void rollback() throws SQLException
+   {
+      this.connection.rollback();
+      
+   }
+
+   @Override
+   public void rollback(Savepoint savepoint) throws SQLException
+   {
+      // FIXME rollback
+      this.connection.rollback(savepoint);
+   }
+
+   @Override
+   public void setAutoCommit(boolean autoCommit) throws SQLException
+   {
+      // FIXME setAutoCommit
+      this.connection.setAutoCommit(autoCommit);
+   }
+
+   @Override
+   public void setCatalog(String catalog) throws SQLException
+   {
+      // FIXME setCatalog
+      this.connection.setCatalog(catalog);
+   }
+
+
+   @Override
+   public void setHoldability(int holdability) throws SQLException
+   {
+      // FIXME setHoldability
+      this.connection.setHoldability(holdability);
+   }
+
+   @Override
+   public void setReadOnly(boolean readOnly) throws SQLException
+   {
+      // FIXME setReadOnly
+      this.connection.setReadOnly(readOnly);
+   }
+
+   @Override
+   public Savepoint setSavepoint() throws SQLException
+   {
+      // FIXME setSavepoint
+      return this.connection.setSavepoint();
+   }
+
+   @Override
+   public Savepoint setSavepoint(String name) throws SQLException
+   {
+      // FIXME setSavepoint
+      return this.connection.setSavepoint(name);
+   }
+
+   @Override
+   public void setTransactionIsolation(int level) throws SQLException
+   {
+      // FIXME setTransactionIsolation
+      this.connection.setTransactionIsolation(level);
+   }
+   
+   @Override
+   protected void setDataSource(WrapperDataSource dataSource)
+   {
+      // FIXME setDataSource
+      super.setDataSource(dataSource);
+   }
+   
+
+   @Override
+   protected void releaseResources()
+   {
+   }
+   
+}



More information about the jboss-svn-commits mailing list