[jboss-cvs] JBossAS SVN: r106625 - in projects/jboss-jca/branches/performance/rars: src/main/java/org/jboss/jca/performance/rars and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jul 13 05:26:33 EDT 2010
Author: jeff.zhang
Date: 2010-07-13 05:26:32 -0400 (Tue, 13 Jul 2010)
New Revision: 106625
Added:
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/ConnectionUnit.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnection.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactory.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactoryImpl.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionImpl.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionManager.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnection.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionFactory.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionMetaData.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfResourceAdapter.java
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/package.html
projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/workmanager/package.html
projects/jboss-jca/branches/performance/rars/src/main/resources/connection/
projects/jboss-jca/branches/performance/rars/src/main/resources/connection/META-INF/
projects/jboss-jca/branches/performance/rars/src/main/resources/connection/META-INF/ra.xml
Modified:
projects/jboss-jca/branches/performance/rars/build.xml
Log:
[JBJCA-381] performance test for connection getting and method invocation
Modified: projects/jboss-jca/branches/performance/rars/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/rars/build.xml 2010-07-13 05:37:34 UTC (rev 106624)
+++ projects/jboss-jca/branches/performance/rars/build.xml 2010-07-13 09:26:32 UTC (rev 106625)
@@ -59,7 +59,7 @@
</filterset>
</copy>
- <jar destfile="${target.dir}/@{as}_@{trans}_@{count}.rar"
+ <jar destfile="${target.dir}/wm_@{as}_@{trans}_@{count}.rar"
manifest="src/main/resources/rar-manifest.mf">
<fileset dir="${build.rars.dir}/jars/rars"
includes="org/jboss/jca/performance/rars/workmanager/*.class"/>
@@ -67,6 +67,14 @@
<fileset dir="${build.rars.dir}/jars/rars/@{as}/@{trans}/@{count}/workmanager"
includes="**/**"/>
</jar>
+ <jar destfile="${target.dir}/conn_@{as}_@{trans}_@{count}.rar"
+ manifest="src/main/resources/rar-manifest.mf">
+ <fileset dir="${build.rars.dir}/jars/rars"
+ includes="org/jboss/jca/performance/rars/connection/*.class"/>
+
+ <fileset dir="${build.rars.dir}/jars/rars/@{as}/@{trans}/@{count}/connection"
+ includes="**/**"/>
+ </jar>
</sequential>
</macrodef>
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/ConnectionUnit.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/ConnectionUnit.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/ConnectionUnit.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * A ConnectionUnit.
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ConnectionUnit
+{
+ /** count */
+ private int count;
+
+ /** rarname */
+ private String rarname;
+
+ /**
+ * constructor
+ * @param rarname rar name
+ * @param count count
+ */
+ public ConnectionUnit(int count, String rarname)
+ {
+ this.count = count;
+ this.rarname = rarname;
+ }
+
+ /**
+ * test get connection reference and invocation
+ */
+ public void test() throws Exception
+ {
+ Context context = new InitialContext();
+
+ PerfConnectionFactory pcf = (PerfConnectionFactory)context.lookup("java:/eis/" + rarname);
+
+ for (int i = 0; i < count; i++)
+ {
+ PerfConnection pc = pcf.getConnection();
+ pc.callMe();
+ }
+ }
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnection.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnection.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnection.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+/**
+ * PerfConnection
+ *
+ * @version $Revision: $
+ */
+public interface PerfConnection
+{
+ /**
+ * call me
+ */
+ public void callMe();
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactory.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactory.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactory.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import java.io.Serializable;
+
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+
+/**
+ * PerfConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public interface PerfConnectionFactory extends Serializable, Referenceable
+{
+ /**
+ * get connection from factory
+ *
+ * @return PerfConnection instance
+ * @exception ResourceException Thrown if a connection can't be obtained
+ */
+ public PerfConnection getConnection() throws ResourceException;
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactoryImpl.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactoryImpl.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionFactoryImpl.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+/**
+ * PerfConnectionFactoryImpl
+ *
+ * @version $Revision: $
+ */
+public class PerfConnectionFactoryImpl implements PerfConnectionFactory
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+ /** The reference */
+ private Reference reference;
+
+ /**
+ * default constructor
+ */
+ public PerfConnectionFactoryImpl()
+ {
+
+ }
+
+ /**
+ * default constructor
+ * @param cxManager ConnectionManager
+ */
+ public PerfConnectionFactoryImpl(ConnectionManager cxManager)
+ {
+
+ }
+
+ /**
+ * get connection from factory
+ *
+ * @return PerfConnection instance
+ * @exception ResourceException Thrown if a connection can't be obtained
+ */
+ @Override
+ public PerfConnection getConnection() throws ResourceException
+ {
+ return new PerfConnectionImpl();
+ }
+
+ /**
+ * Get the Reference instance.
+ *
+ * @return Reference instance
+ * @exception NamingException Thrown if a reference can't be obtained
+ */
+ @Override
+ public Reference getReference() throws NamingException
+ {
+ return reference;
+ }
+
+ /**
+ * Set the Reference instance.
+ *
+ * @param reference A Reference instance
+ */
+ @Override
+ public void setReference(Reference reference)
+ {
+ this.reference = reference;
+ }
+
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionImpl.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionImpl.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionImpl.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import java.util.logging.Logger;
+
+/**
+ * PerfConnectionImpl
+ *
+ * @version $Revision: $
+ */
+public class PerfConnectionImpl implements PerfConnection
+{
+ /** The logger */
+ private static Logger log = Logger.getLogger("PerfTest");
+
+ /**
+ * default constructor
+ */
+ public PerfConnectionImpl()
+ {
+
+ }
+
+ /**
+ * call me
+ */
+ public void callMe()
+ {
+ //log.info("call callMe");
+ }
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionManager.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionManager.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfConnectionManager.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnectionFactory;
+
+/**
+ * PerfConnectionManager
+ *
+ * @version $Revision: $
+ */
+public class PerfConnectionManager implements ConnectionManager
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * default constructor
+ */
+ public PerfConnectionManager()
+ {
+
+ }
+
+ /**
+ * Allocate a connection
+ *
+ * @param mcf The managed connection factory
+ * @param cri The connection request information
+ * @return Object The connection
+ * @exception ResourceException Thrown if an error occurs
+ */
+ @Override
+ public Object allocateConnection(ManagedConnectionFactory mcf,ConnectionRequestInfo cri) throws ResourceException
+ {
+ return null;
+ }
+
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnection.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnection.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnection.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import java.io.PrintWriter;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+import java.util.logging.Logger;
+
+/**
+ * PerfManagedConnection
+ *
+ * @version $Revision: $
+ */
+public class PerfManagedConnection implements ManagedConnection
+{
+
+ /** The logger */
+ private static Logger log = Logger.getLogger("PerfTest");
+
+ /**
+ * default constructor
+ */
+ public PerfManagedConnection()
+ {
+
+ }
+
+ /**
+ * Creates a new connection handle for the underlying physical connection
+ * represented by the ManagedConnection instance.
+ *
+ * @param subject security context as JAAS subject
+ * @param cxRequestInfo ConnectionRequestInfo instance
+ * @return generic Object instance representing the connection handle.
+ * @throws ResourceException generic exception if operation fails
+ */
+ public Object getConnection(Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ log.info("call getConnection");
+ return null;
+ }
+
+ /**
+ * Used by the container to change the association of an
+ * application-level connection handle with a ManagedConneciton instance.
+ *
+ * @param connection Application-level connection handle
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void associateConnection(Object connection) throws ResourceException
+ {
+ log.info("call associateConnection");
+ }
+
+ /**
+ * Application server calls this method to force any cleanup on the ManagedConnection instance.
+ *
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void cleanup() throws ResourceException
+
+ {
+ log.info("call cleanup");
+ }
+
+ /**
+ * Destroys the physical connection to the underlying resource manager.
+ *
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void destroy() throws ResourceException
+ {
+ log.info("call destroy");
+ }
+
+ /**
+ * Adds a connection event listener to the ManagedConnection instance.
+ *
+ * @param listener a new ConnectionEventListener to be registered
+ */
+ public void addConnectionEventListener(ConnectionEventListener listener)
+ {
+ log.info("call addConnectionEventListener");
+ }
+
+ /**
+ * Removes an already registered connection event listener from the ManagedConnection instance.
+ *
+ * @param listener already registered connection event listener to be removed
+ */
+ public void removeConnectionEventListener(ConnectionEventListener listener)
+ {
+ log.info("call removeConnectionEventListener");
+ }
+
+ /**
+ * Gets the log writer for this ManagedConnection instance.
+ *
+ * @return Character ourput stream associated with this Managed-Connection instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ log.info("call getLogWriter");
+ return null;
+ }
+
+ /**
+ * Sets the log writer for this ManagedConnection instance.
+ *
+ * @param out Character Output stream to be associated
+ * @throws ResourceException generic exception if operation fails
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ log.info("call setLogWriter");
+ }
+
+ /**
+ * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.
+ *
+ * @return LocalTransaction instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public LocalTransaction getLocalTransaction() throws ResourceException
+ {
+ log.info("call getLocalTransaction");
+ return null;
+ }
+
+ /**
+ * Returns an <code>javax.transaction.xa.XAresource</code> instance.
+ *
+ * @return XAResource instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public XAResource getXAResource() throws ResourceException
+ {
+ log.info("call getXAResource");
+ return null;
+ }
+
+ /**
+ * Gets the metadata information for this connection's underlying EIS resource manager instance.
+ *
+ * @return ManagedConnectionMetaData instance
+ * @throws ResourceException generic exception if operation fails
+ */
+ public ManagedConnectionMetaData getMetaData() throws ResourceException
+ {
+ log.info("call getMetaData");
+ return new PerfManagedConnectionMetaData();
+ }
+
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionFactory.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionFactory.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,206 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+import javax.security.auth.Subject;
+
+import java.util.logging.Logger;
+
+/**
+ * PerfManagedConnectionFactory
+ *
+ * @version $Revision: $
+ */
+public class PerfManagedConnectionFactory implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ /** The logger */
+ private static Logger log = Logger.getLogger("PerfTest");
+
+ /** The resource adapter */
+ private ResourceAdapter ra;
+
+ /** The logwriter */
+ private PrintWriter logwriter;
+
+ /**
+ * default constructor
+ */
+ public PerfManagedConnectionFactory()
+ {
+
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+ log.info("call createConnectionFactory");
+ return new PerfConnectionFactoryImpl(cxManager);
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+ return new PerfConnectionFactoryImpl(new PerfConnectionManager());
+ }
+
+ /**
+ * Creates a new physical connection to the underlying EIS resource manager.
+ *
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection instance
+ */
+ public ManagedConnection createManagedConnection(Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+ log.info("call createManagedConnection");
+ return null;
+ }
+
+ /**
+ * Returns a matched connection from the candidate set of connections.
+ *
+ * @param connectionSet candidate connection set
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection if resource adapter finds an acceptable match otherwise null
+ */
+ public ManagedConnection matchManagedConnections(Set connectionSet,
+ Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+ log.info("call matchManagedConnections");
+ return null;
+ }
+
+ /**
+ * Get the log writer for this ManagedConnectionFactory instance.
+ *
+ * @return PrintWriter
+ * @throws ResourceException generic exception
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ log.info("call getLogWriter");
+ return logwriter;
+ }
+
+ /**
+ * Set the log writer for this ManagedConnectionFactory instance.
+ *
+ * @param out PrintWriter - an out stream for error logging and tracing
+ * @throws ResourceException generic exception
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ log.info("call setLogWriter");
+ logwriter = out;
+ }
+
+ /**
+ * Get the resource adapter
+ *
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ log.info("call getResourceAdapter");
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ *
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ log.info("call setResourceAdapter");
+ this.ra = ra;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ * @return a hash code value for this object.
+ */
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ return result;
+ }
+
+ /**
+ * Indicates whether some other object is equal to this one.
+ * @param other the reference object with which to compare.
+ * @return true if this object is the same as the obj argument; false otherwise.
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (!(other instanceof PerfManagedConnectionFactory))
+ return false;
+ PerfManagedConnectionFactory obj = (PerfManagedConnectionFactory)other;
+ boolean result = true;
+ return result;
+ }
+
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionMetaData.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionMetaData.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfManagedConnectionMetaData.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import javax.resource.ResourceException;
+
+import javax.resource.spi.ManagedConnectionMetaData;
+
+/**
+ * PerfManagedConnectionMetaData
+ *
+ * @version $Revision: $
+ */
+public class PerfManagedConnectionMetaData implements ManagedConnectionMetaData
+{
+ /**
+ * default constructor
+ */
+ public PerfManagedConnectionMetaData()
+ {
+
+ }
+
+ /**
+ * Returns Product name of the underlying EIS instance connected through the ManagedConnection.
+ *
+ * @return Product name of the EIS instance
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getEISProductName() throws ResourceException
+ {
+ return null; //TODO
+ }
+
+ /**
+ * Returns Product version of the underlying EIS instance connected through the ManagedConnection.
+ *
+ * @return Product version of the EIS instance
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getEISProductVersion() throws ResourceException
+ {
+ return null; //TODO
+ }
+
+ /**
+ * Returns maximum limit on number of active concurrent connections
+ *
+ * @return Maximum limit for number of active concurrent connections
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public int getMaxConnections() throws ResourceException
+ {
+ return 0; //TODO
+ }
+
+ /**
+ * Returns name of the user associated with the ManagedConnection instance
+ *
+ * @return name of the user
+ * @throws ResourceException Thrown if an error occurs
+ */
+ @Override
+ public String getUserName() throws ResourceException
+ {
+ return null; //TODO
+ }
+
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfResourceAdapter.java
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfResourceAdapter.java (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/PerfResourceAdapter.java 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,273 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.performance.rars.connection;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+
+import javax.transaction.xa.XAResource;
+
+import java.util.logging.Logger;
+
+/**
+ * PerfResourceAdapter
+ *
+ * @version $Revision: $
+ */
+public class PerfResourceAdapter implements ResourceAdapter
+{
+
+ /** The logger */
+ private static Logger log = Logger.getLogger("PerfTest");
+
+ /**
+ * default constructor
+ */
+ public PerfResourceAdapter()
+ {
+
+ }
+
+ /** count */
+ private Integer count;
+
+ /** testCase */
+ private String testCase;
+
+ /** app server */
+ private String appserver;
+
+ /** trans */
+ private String trans;
+
+ /**
+ * set count
+ * @param count The value
+ */
+ public void setCount(Integer count)
+ {
+ this.count = count;
+ }
+
+ /**
+ * get count
+ * @return The value
+ */
+ public Integer getCount()
+ {
+ return count;
+ }
+
+ /**
+ * set testCase
+ * @param testCase The value
+ */
+ public void setTestCase(String testCase)
+ {
+ this.testCase = testCase;
+ }
+
+ /**
+ * get testCase
+ * @return The value
+ */
+ public String getTestCase()
+ {
+ return testCase;
+ }
+
+ /**
+ * Set the appserver.
+ *
+ * @param appserver The appserver to set.
+ */
+ public void setAppserver(String appserver)
+ {
+ this.appserver = appserver;
+ }
+
+ /**
+ * Get the appserver.
+ *
+ * @return the appserver.
+ */
+ public String getAppserver()
+ {
+ return appserver;
+ }
+
+ /**
+ * Set the trans.
+ *
+ * @param trans The trans to set.
+ */
+ public void setTrans(String trans)
+ {
+ this.trans = trans;
+ }
+
+ /**
+ * Get the trans.
+ *
+ * @return the trans.
+ */
+ public String getTrans()
+ {
+ return trans;
+ }
+
+ /**
+ * This is called during the activation of a message endpoint.
+ *
+ * @param endpointFactory a message endpoint factory instance.
+ * @param spec an activation spec JavaBean instance.
+ * @throws ResourceException generic exception
+ */
+ public void endpointActivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec) throws ResourceException
+ {
+ log.info("call endpointActivation");
+ }
+
+ /**
+ * This is called when a message endpoint is deactivated.
+ *
+ * @param endpointFactory a message endpoint factory instance.
+ * @param spec an activation spec JavaBean instance.
+ */
+ public void endpointDeactivation(MessageEndpointFactory endpointFactory,
+ ActivationSpec spec)
+ {
+ log.info("call endpointDeactivation");
+ }
+
+ /**
+ * This is called when a resource adapter instance is bootstrapped.
+ *
+ * @param ctx a bootstrap context containing references
+ * @throws ResourceAdapterInternalException indicates bootstrap failure.
+ */
+ public void start(BootstrapContext ctx)
+ throws ResourceAdapterInternalException
+ {
+ log.info("call start");
+
+ String rarname = "conn_" + appserver + "_" + trans + "_" + count;
+ long l1 = System.nanoTime();
+ try
+ {
+ Class<?> workUnitClazz = Class.forName(testCase);
+ Object obj = workUnitClazz.getDeclaredConstructor(int.class, String.class)
+ .newInstance(count, rarname);
+ ((ConnectionUnit)obj).test();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ long l2 = System.nanoTime();
+ long time = (l2 - l1) / 1000;
+
+ System.out.println("Stat: running " + trans + " " + count +
+ " on as server " + appserver + " time: " + time + " us" );
+ }
+
+ /**
+ * This is called when a resource adapter instance is undeployed or
+ * during application server shutdown.
+ */
+ public void stop()
+ {
+ log.info("call stop");
+ }
+
+ /**
+ * This method is called by the application server during crash recovery.
+ *
+ * @param specs an array of ActivationSpec JavaBeans
+ * @throws ResourceException generic exception
+ * @return an array of XAResource objects
+ */
+ public XAResource[] getXAResources(ActivationSpec[] specs)
+ throws ResourceException
+ {
+ log.info("call getXAResources");
+ return null;
+ }
+
+ /**
+ * Returns a hash code value for the object.
+ * @return a hash code value for this object.
+ */
+ @Override
+ public int hashCode()
+ {
+ int result = 17;
+ if (count != null)
+ result += 31 * result + 7 * count.hashCode();
+ else
+ result += 31 * result + 7;
+ if (testCase != null)
+ result += 31 * result + 7 * testCase.hashCode();
+ else
+ result += 31 * result + 7;
+ return result;
+ }
+
+ /**
+ * Indicates whether some other object is equal to this one.
+ * @param other the reference object with which to compare.
+ * @return true if this object is the same as the obj argument; false otherwise.
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (!(other instanceof PerfResourceAdapter))
+ return false;
+ PerfResourceAdapter obj = (PerfResourceAdapter)other;
+ boolean result = true;
+ if (result)
+ {
+ if (count == null)
+ result = obj.getCount() == null;
+ else
+ result = count.equals(obj.getCount());
+ }
+ if (result)
+ {
+ if (testCase == null)
+ result = obj.getTestCase() == null;
+ else
+ result = testCase.equals(obj.getTestCase());
+ }
+ return result;
+ }
+
+}
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/package.html
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/package.html (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/connection/package.html 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,3 @@
+<body>
+Performance test for connection
+</body>
Added: projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/workmanager/package.html
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/workmanager/package.html (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/java/org/jboss/jca/performance/rars/workmanager/package.html 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,3 @@
+<body>
+Performance test for work manager
+</body>
Added: projects/jboss-jca/branches/performance/rars/src/main/resources/connection/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/branches/performance/rars/src/main/resources/connection/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/branches/performance/rars/src/main/resources/connection/META-INF/ra.xml 2010-07-13 09:26:32 UTC (rev 106625)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.performance.rars.connection.PerfResourceAdapter</resourceadapter-class>
+ <config-property>
+ <config-property-name>count</config-property-name>
+ <config-property-type>java.lang.Integer</config-property-type>
+ <config-property-value>@COUNT@</config-property-value>
+ </config-property>
+
+ <config-property>
+ <config-property-name>testCase</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>org.jboss.jca.performance.rars.connection.ConnectionUnit</config-property-value>
+ </config-property>
+
+ <config-property>
+ <config-property-name>appserver</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>@AS@</config-property-value>
+ </config-property>
+
+ <config-property>
+ <config-property-name>trans</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>@TRANS@</config-property-value>
+ </config-property>
+
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.performance.rars.connection.PerfManagedConnectionFactory</managedconnectionfactory-class>
+ <connectionfactory-interface>org.jboss.jca.performance.rars.connection.PerfConnectionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.performance.rars.connection.PerfConnectionFactoryImpl</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.performance.rars.connection.PerfConnection</connection-interface>
+ <connection-impl-class>org.jboss.jca.performance.rars.connection.PerfConnectionImpl</connection-impl-class>
+ </connection-definition>
+ <transaction-support>@TRANS@</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
More information about the jboss-cvs-commits
mailing list