[jboss-cvs] JBossAS SVN: r68345 - in projects/jboss-jca/trunk: adapter/src/main/org/jboss/rars/cm/pooling and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 17 11:42:05 EST 2007


Author: adrian at jboss.org
Date: 2007-12-17 11:42:05 -0500 (Mon, 17 Dec 2007)
New Revision: 68345

Modified:
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/AbstractRARInterceptor.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/TraceAdvice.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionEventListener.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionManager.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/cf/GenericConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnection.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/ReflectionUtil.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericConnection.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericManagedConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/JDBCManagedConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/local/LocalJDBCManagedConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jms/JMSManagedConnectionFactory.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/ra/ResourceErrorHandler.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericChild.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericConnection.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericWrapper.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/ParentChildAdvice.java
   projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/WrapperAdvice.java
   projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/RARTest.java
   projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestConnectionImpl.java
   projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestManagedConnectionFactory.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/ConnectionManagerFactory.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/pool/simple/SimplePool.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/Activation.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointAdvice.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointFactory.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/JBossWorkManager.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/WorkWrapper.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContext.java
   projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContextManager.java
   projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnection.java
   projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnectionFactory.java
   projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestResourceAdapter.java
Log:
Generification and source code tidyup

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/AbstractRARInterceptor.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/AbstractRARInterceptor.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/AbstractRARInterceptor.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -27,7 +27,6 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.logging.Logger;
-import org.jboss.util.JBossStringBuilder;
 
 /**
  * AbstractRARInterceptor.
@@ -47,12 +46,12 @@
 
    protected static String format(Invocation invocation)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, invocation);
       return buffer.toString();
    }
    
-   protected static void format(JBossStringBuilder buffer, Invocation invocation)
+   protected static void format(StringBuilder buffer, Invocation invocation)
    {
       if (invocation instanceof MethodInvocation)
       {
@@ -61,7 +60,7 @@
          buffer.append("[method=").append(method.getDeclaringClass().getName());
          buffer.append('.').append(method.getName());
          buffer.append('(');
-         Class[] parameters = method.getParameterTypes();
+         Class<?>[] parameters = method.getParameterTypes();
          for (int i = 0; i < parameters.length; ++i)
          {
             if (i > 0)

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/TraceAdvice.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/TraceAdvice.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/advice/TraceAdvice.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,7 +22,6 @@
 package org.jboss.rars.advice;
 
 import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.util.JBossStringBuilder;
 
 /**
  * Trace advice.
@@ -62,13 +61,13 @@
       }
    }
    
-   protected static void format(JBossStringBuilder buffer, String context, Invocation invocation)
+   protected static void format(StringBuilder buffer, String context, Invocation invocation)
    {
       buffer.append(context);
       format(buffer, invocation);
    }
    
-   protected static void format(JBossStringBuilder buffer, String context, Invocation invocation, long time)
+   protected static void format(StringBuilder buffer, String context, Invocation invocation, long time)
    {
       if (time > 10)
          buffer.append("-------> ");
@@ -76,23 +75,23 @@
       buffer.append(" time=").append(time).append("ms");
    }
    
-   protected static JBossStringBuilder format(String context, Invocation invocation)
+   protected static StringBuilder format(String context, Invocation invocation)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, context, invocation);
       return buffer;
    }
    
-   protected static JBossStringBuilder format(String context, Invocation invocation, long time)
+   protected static StringBuilder format(String context, Invocation invocation, long time)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, context, invocation, time);
       return buffer;
    }
    
-   protected static JBossStringBuilder format(String context, Invocation invocation, long time, Object result)
+   protected static StringBuilder format(String context, Invocation invocation, long time, Object result)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, context, invocation, time);
       buffer.append(" RESULT=").append(result);
       return buffer;

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionEventListener.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionEventListener.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionEventListener.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -49,6 +49,7 @@
    /**
     * Create a new PoolingConnectionEventListener.
     * 
+    * @param cm the connection manager
     * @param mc the managed connection
     */
    public PoolingConnectionEventListener(PoolingConnectionManager cm, ManagedConnection mc)

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionManager.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionManager.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/cm/pooling/PoolingConnectionManager.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -21,8 +21,8 @@
 */
 package org.jboss.rars.cm.pooling;
 
-import java.util.Iterator;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionManager;
@@ -33,7 +33,6 @@
 import javax.security.auth.Subject;
 
 import org.jboss.logging.Logger;
-import org.jboss.util.collection.CollectionsFactory;
 
 /**
  * PoolingConnectionManager.
@@ -50,10 +49,10 @@
    private static final Logger log = Logger.getLogger(PoolingConnectionManager.class); 
    
    /** The pool */
-   private Set pool = CollectionsFactory.createCopyOnWriteSet();  
+   private Set<ManagedConnection> pool = new CopyOnWriteArraySet<ManagedConnection>();  
    
    /** The checked out connectins */
-   private Set checkedOut = CollectionsFactory.createCopyOnWriteSet();
+   private Set<ManagedConnection> checkedOut = new CopyOnWriteArraySet<ManagedConnection>();
    
    public Object allocateConnection(ManagedConnectionFactory mcf, ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
@@ -90,9 +89,8 @@
    {
       if (pool.size() != 0)
       {
-         for (Iterator i = pool.iterator(); i.hasNext();)
+         for (ManagedConnection mc : pool)
          {
-            ManagedConnection mc = (ManagedConnection) i.next();
             try
             {
                mc.destroy();
@@ -112,6 +110,7 @@
     * @param subject the subject
     * @param cri the connection request info
     * @return the managed connection
+    * @throws ResourceException for any error
     */
    protected synchronized ManagedConnection getManagedConnection(ManagedConnectionFactory mcf, Subject subject, ConnectionRequestInfo cri) throws ResourceException
    {

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/cf/GenericConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/cf/GenericConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/cf/GenericConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -94,7 +94,7 @@
     * 
     * @param cri the connection request info
     * @return the connection
-    * @throws Exception for any error
+    * @throws ResourceException for any error
     */
    public Object allocateConnection(ConnectionRequestInfo cri) throws ResourceException
    {
@@ -109,7 +109,7 @@
     * @param context the context
     * @param t the throwable
     * @return never
-    * @throws the correct error
+    * @throws Throwable the correct error
     */
    public Throwable throwError(Object context, Throwable t) throws Throwable
    {

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnection.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnection.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,10 +22,13 @@
 package org.jboss.rars.generic.mcf;
 
 import java.io.PrintWriter;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
@@ -41,12 +44,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.rars.generic.wrapper.GenericConnection;
 import org.jboss.rars.generic.wrapper.GenericHandle;
-import org.jboss.util.collection.CollectionsFactory;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.util.Strings;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
 /**
  * GenericManagedConnection.
  * 
@@ -71,22 +69,21 @@
    private Object requestID;
    
    /** Whether the managed connection is destroyed */
-   protected SynchronizedBoolean destroyed = new SynchronizedBoolean(false);
+   protected AtomicBoolean destroyed = new AtomicBoolean(false);
 
    /** The associated connection handles */
-   private Set associated = CollectionsFactory.createCopyOnWriteSet();
+   private Set<GenericConnection> associated = new CopyOnWriteArraySet<GenericConnection>();
    
    /** The listeners */
-   private List listeners = CollectionsFactory.createCopyOnWriteList(); 
+   private List<ConnectionEventListener> listeners = new CopyOnWriteArrayList<ConnectionEventListener>(); 
 
    /** The connections by handle */
-   private Map connectionsByHandle = CollectionsFactory.createConcurrentReaderMap();
+   private Map<GenericHandle, GenericConnection> connectionsByHandle = new ConcurrentHashMap<GenericHandle, GenericConnection>();
    
    /**
     * Create a new GenericManagedConnection.
     * 
     * @param mcf the managed connection factory
-    * @param connection the real connection
     * @param requestID the request id
     */
    protected GenericManagedConnection(GenericManagedConnectionFactory mcf, Object requestID)
@@ -126,7 +123,7 @@
    public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
       GenericConnection impl = mcf.createGenericConnection(this, subject, cxRequestInfo);
-      Class[] interfaces = mcf.getConnectionInterfaces(impl);
+      Class<?>[] interfaces = mcf.getConnectionInterfaces(impl);
       GenericHandle handle = impl.createHandle(interfaces);
       connectionsByHandle.put(handle, impl);
       associateConnection(impl);
@@ -135,7 +132,7 @@
    
    public void associateConnection(Object connection) throws ResourceException
    {
-      GenericConnection wrapper = (GenericConnection) connectionsByHandle.get(connection);
+      GenericConnection wrapper = connectionsByHandle.get(connection);
       if (wrapper == null)
          throw new ResourceAdapterInternalException("Unknown connnection handle " + connection);
       associateConnection(wrapper);
@@ -189,11 +186,8 @@
 
    public void cleanup() throws ResourceException
    {
-      for (Iterator i = associated.iterator(); i.hasNext();)
-      {
-         GenericConnection wrapper = (GenericConnection) i.next();
+      for (GenericConnection wrapper : associated)
          disassociateConnection(wrapper);
-      }
    }
 
    public void safeDestroy()
@@ -213,7 +207,7 @@
       log.debug(this + " DESTROY");
       cleanup();
       listeners.clear();
-      if (destroyed.set(true))
+      if (destroyed.getAndSet(true))
       {
          log.debug(this + " already destroyed");
          return;
@@ -318,9 +312,8 @@
       if (listeners.size() == 0)
          return;
       
-      for (Iterator i = listeners.iterator(); i.hasNext();)
+      for (ConnectionEventListener listener : listeners)
       {
-         ConnectionEventListener listener = (ConnectionEventListener) i.next();
          try
          {
             switch (event.getId())
@@ -400,8 +393,8 @@
 
    public String toString()
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
-      Strings.defaultToString(buffer, this);
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName()).append('@').append(System.identityHashCode(this));
       buffer.append('[').append(getRealConnection()).append(']');
       return buffer.toString();
    }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/GenericManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -29,6 +29,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionManager;
@@ -53,7 +54,6 @@
 import org.jboss.rars.generic.wrapper.GenericConnection;
 import org.jboss.rars.generic.wrapper.GenericHandle;
 import org.jboss.rars.generic.wrapper.GenericWrapper;
-import org.jboss.util.collection.CollectionsFactory;
 
 /**
  * GenericManagedConnectionFactory.
@@ -76,7 +76,7 @@
    private static final Object NO_CLOSE_METHOD = new Object();
    
    /** Cache of close methods Map<class name, method> */
-   private Map closeMethodCache = CollectionsFactory.createConcurrentReaderMap();
+   private Map<String, Object> closeMethodCache = new ConcurrentHashMap<String, Object>();
    
    /** The writer */
    private transient PrintWriter writer;
@@ -85,13 +85,13 @@
    private transient GenericResourceAdapter ra;
 
    /** The connection factory interfaces cache */
-   private transient Class[] connectionFactoryInterfaces;
+   private transient Class<?>[] connectionFactoryInterfaces;
 
    /** The connection interfaces cache */
-   private transient Class[] connectionInterfaces;
+   private transient Class<?>[] connectionInterfaces;
    
    /** The wrapped interfaces cache */
-   private transient Map wrappedInterfaces = CollectionsFactory.createConcurrentReaderMap();
+   private transient Map<Class<?>, Class<?>[]> wrappedInterfaces = new ConcurrentHashMap<Class<?>, Class<?>[]>();
    
    public Object createConnectionFactory() throws ResourceException
    {
@@ -103,7 +103,7 @@
    {
       GenericConnectionFactory impl = createGenericConnectionFactory(cxManager);
 
-      Class[] interfaces = getConnectionFactoryInterfaces(impl);
+      Class<?>[] interfaces = getConnectionFactoryInterfaces(impl);
       
       Object connectionFactory = createProxy(interfaces, impl, null);
       log.debug(this + " CREATED " + connectionFactory);
@@ -117,14 +117,14 @@
     * @return the interfaces
     * @throws ResourceException for any error
     */
-   private Class[] getConnectionFactoryInterfaces(GenericConnectionFactory impl) throws ResourceException
+   private Class<?>[] getConnectionFactoryInterfaces(GenericConnectionFactory impl) throws ResourceException
    {
       if (connectionFactoryInterfaces == null)
       {
-         Set interfaces = new HashSet();
+         Set<Class<?>> interfaces = new HashSet<Class<?>>();
          addConnectionFactoryInterfaces(impl, interfaces);
          addGenericConnectionFactoryInterfaces(impl, interfaces);
-         connectionFactoryInterfaces = (Class[]) interfaces.toArray(new Class[interfaces.size()]);
+         connectionFactoryInterfaces = interfaces.toArray(new Class[interfaces.size()]);
       }
       return connectionFactoryInterfaces;
    }
@@ -144,7 +144,7 @@
     * @param impl the generic connection factory
     * @param interfaces add the interfaces to this set
     */
-   protected abstract void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set interfaces);
+   protected abstract void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set<Class<?>> interfaces);
 
    /**
     * Add the generic connection factory interfaces
@@ -153,9 +153,9 @@
     * @param interfaces add the interfaces to this set
     * @throws ResourceException for any error
     */
-   protected void addGenericConnectionFactoryInterfaces(GenericConnectionFactory impl, Set interfaces) throws ResourceException
+   protected void addGenericConnectionFactoryInterfaces(GenericConnectionFactory impl, Set<Class<?>> interfaces) throws ResourceException
    {
-      Class clazz = impl.getClass();
+      Class<?> clazz = impl.getClass();
       addInterfaces(clazz, interfaces);
    }
 
@@ -168,14 +168,15 @@
       return mc;
    }
 
+   @SuppressWarnings("unchecked")
    public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
       if (connectionSet != null && connectionSet.size() >= 0)
       {
          Object requestID = getRequestID(subject, cxRequestInfo);
-         for (Iterator i = connectionSet.iterator(); i.hasNext();)
+         for (Iterator<GenericManagedConnection> i = connectionSet.iterator(); i.hasNext();)
          {
-            GenericManagedConnection managedConnection = (GenericManagedConnection) i.next();
+            GenericManagedConnection managedConnection = i.next();
             if (managedConnection.matches(requestID))
                return managedConnection;
          }
@@ -220,7 +221,7 @@
     * @param clazz the clazz
     * @return the method or null when not found
     */
-   protected Method findCloseMethod(Class clazz)
+   protected Method findCloseMethod(Class<?> clazz)
    {
       if (clazz.isInterface())
       {
@@ -232,7 +233,7 @@
          {
          }
       }
-      Class[] interfaces = clazz.getInterfaces();
+      Class<?>[] interfaces = clazz.getInterfaces();
       for (int i = 0; i < interfaces.length; ++i)
       {
          Method method = findCloseMethod(interfaces[i]);
@@ -268,7 +269,7 @@
          return;
       }
 
-      Class clazz = object.getClass();
+      Class<?> clazz = object.getClass();
       Object closeMethod = closeMethodCache.get(clazz.getName());
       if (closeMethod == null)
       {
@@ -317,14 +318,14 @@
     * Whether this result is the parent
     * 
     * @param method the method
-    * @param parent the parent wrapper
+    * @param parentWrapper the parent wrapper
     * @param child the target child of the method
     * @return true when result is parent
     * @throws ResourceException for any error
     */
    public boolean isParent(Method method, GenericWrapper parentWrapper, GenericWrapper child) throws ResourceException
    {
-      Class returnType = method.getReturnType();
+      Class<?> returnType = method.getReturnType();
       Object parent = parentWrapper.getWrappedTarget();
       return returnType.isInstance(parent);
    }
@@ -338,7 +339,7 @@
     */
    public boolean isChild(Method method, Object object)
    {
-      Class returnType = method.getReturnType();
+      Class<?> returnType = method.getReturnType();
       if (ignoreChild(method, object, returnType))
          return false;
       return isChild(method, object, returnType);
@@ -352,7 +353,7 @@
     * @param type the type
     * @return true when it should be ignored
     */
-   protected boolean ignoreChild(Method method, Object object, Class type)
+   protected boolean ignoreChild(Method method, Object object, Class<?> type)
    {
       if (Collection.class.isAssignableFrom(type))
          return true;
@@ -373,7 +374,7 @@
     * @param type the type
     * @return true when it is a child
     */
-   protected boolean isChild(Method method, Object object, Class type)
+   protected boolean isChild(Method method, Object object, Class<?> type)
    {
       return type.isInterface();
    }
@@ -397,7 +398,7 @@
     * Map an error
     * 
     * @param context the context
-    * @param e the error
+    * @param t the error
     * @return the mapped error
     */
    public Throwable error(Object context, Throwable t)
@@ -454,7 +455,8 @@
    
    /**
     * Get the connection request info
-    * 
+    *
+    * @param cf the connection factory
     * @param method the method
     * @param args the arguments
     * @return the connection request info
@@ -486,14 +488,14 @@
     * @return the interfaces
     * @throws ResourceException for any error
     */
-   protected Class[] getConnectionInterfaces(GenericConnection impl) throws ResourceException
+   protected Class<?>[] getConnectionInterfaces(GenericConnection impl) throws ResourceException
    {
       if (connectionInterfaces == null)
       {
-         Set interfaces = new HashSet();
+         Set<Class<?>> interfaces = new HashSet<Class<?>>();
          addConnectionInterfaces(impl, interfaces);
          interfaces.add(GenericHandle.class);
-         connectionInterfaces = (Class[]) interfaces.toArray(new Class[interfaces.size()]);
+         connectionInterfaces = interfaces.toArray(new Class[interfaces.size()]);
       }
       return connectionInterfaces;
    }
@@ -517,10 +519,10 @@
     * @param interfaces add the interfaces to this set
     * @throws ResourceException for any error
     */
-   protected void addConnectionInterfaces(GenericConnection connection, Set interfaces) throws ResourceException
+   protected void addConnectionInterfaces(GenericConnection connection, Set<Class<?>> interfaces) throws ResourceException
    {
       Object object = connection.getWrappedTarget();
-      Class clazz = object.getClass();
+      Class<?> clazz = object.getClass();
       addInterfaces(clazz, interfaces);
    }
 
@@ -531,17 +533,17 @@
     * @return the interfaces
     * @throws ResourceException for any error
     */
-   public Class[] getWrappedInterfaces(GenericWrapper wrapper) throws ResourceException
+   public Class<?>[] getWrappedInterfaces(GenericWrapper wrapper) throws ResourceException
    {
       Object object = wrapper.getWrappedTarget();
-      Class clazz = object.getClass();
-      Class[] result = (Class[]) wrappedInterfaces.get(clazz);
+      Class<?> clazz = object.getClass();
+      Class<?>[] result = wrappedInterfaces.get(clazz);
       if (result == null)
       {
-         Set interfaces = new HashSet();
+         Set<Class<?>> interfaces = new HashSet<Class<?>>();
          addInterfaces(clazz, interfaces);
          interfaces.add(GenericHandle.class);
-         result = (Class[]) interfaces.toArray(new Class[interfaces.size()]);
+         result = interfaces.toArray(new Class[interfaces.size()]);
          wrappedInterfaces.put(clazz, result);
       }
       return result;
@@ -554,11 +556,11 @@
     * @param interfaces add the interfaces to this set
     * @throws ResourceException for any error
     */
-   private void addInterfaces(Class clazz, Set interfaces) throws ResourceException
+   private void addInterfaces(Class<?> clazz, Set<Class<?>> interfaces) throws ResourceException
    {
       if (clazz == null)
          return;
-      Class[] intfs = clazz.getInterfaces();
+      Class<?>[] intfs = clazz.getInterfaces();
       for (int i = 0; i < intfs.length; ++i)
          interfaces.add(intfs[i]);
       addInterfaces(clazz.getSuperclass(), interfaces);
@@ -569,9 +571,10 @@
     * 
     * @param interfaces the interfaces
     * @param impl the implementation
+    * @param metaData the metadata
     * @return the proxy
     */
-   public Object createProxy(Class[] interfaces, Object impl, SimpleMetaData metaData)
+   public Object createProxy(Class<?>[] interfaces, Object impl, SimpleMetaData metaData)
    {
       AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
       params.setObjectAsSuperClass(true);

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/ReflectionUtil.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/ReflectionUtil.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/ReflectionUtil.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -25,8 +25,6 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 
-import org.jboss.util.JBossStringBuilder;
-
 /**
  * ReflectionUtil.
  *
@@ -73,15 +71,15 @@
       {
          if (target == null)
             throw new IllegalArgumentException("Null target for method " + method);
-         Class methodClass = method.getClass();
-         Class targetClass = target.getClass();
+         Class<?> methodClass = method.getClass();
+         Class<?> targetClass = target.getClass();
          if (methodClass.isAssignableFrom(targetClass) == false)
             throw new IllegalArgumentException("Wrong target. " + targetClass + " for " + method);
-         ArrayList expected = new ArrayList();
-         Class[] parameterTypes = method.getParameterTypes();
+         ArrayList<String> expected = new ArrayList<String>();
+         Class<?>[] parameterTypes = method.getParameterTypes();
          for (int i = 0; i < parameterTypes.length; ++i)
             expected.add(parameterTypes[i].getName());
-         ArrayList actual = new ArrayList();
+         ArrayList<String> actual = new ArrayList<String>();
          if (arguments != null)
          {
             for (int i = 0; i < arguments.length; ++i)
@@ -101,13 +99,13 @@
       throw t;
    }
    
-   protected static void format(JBossStringBuilder buffer, String context, Method method, Object target)
+   protected static void format(StringBuilder buffer, String context, Method method, Object target)
    {
       buffer.append(context);
       buffer.append("[method=").append(method.getDeclaringClass().getName());
       buffer.append('.').append(method.getName());
       buffer.append('(');
-      Class[] parameters = method.getParameterTypes();
+      Class<?>[] parameters = method.getParameterTypes();
       for (int i = 0; i < parameters.length; ++i)
       {
          if (i > 0)
@@ -119,16 +117,16 @@
       buffer.append(']');
    }
    
-   protected static JBossStringBuilder format(String context, Method method, Object target)
+   protected static StringBuilder format(String context, Method method, Object target)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, context, method, target);
       return buffer;
    }
    
-   protected static JBossStringBuilder format(String context, Method method, Object target, Object result)
+   protected static StringBuilder format(String context, Method method, Object target, Object result)
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
+      StringBuilder buffer = new StringBuilder();
       format(buffer, context, method, target);
       buffer.append(" RESULT=").append(result);
       return buffer;

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericConnection.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericConnection.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericConnection.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -31,7 +31,6 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.rars.generic.wrapper.GenericWrapper;
-import org.jboss.util.JBossStringBuilder;
 
 /**
  * IndirectGenericConnection.
@@ -57,6 +56,7 @@
     * Create a new IndirectGenericConnection.
     * 
     * @param mcf the managed connection factory
+    * @param cm the connection manager
     * @param cri the connection request info
     */
    public IndirectGenericConnection(IndirectGenericManagedConnectionFactory mcf, ConnectionManager cm, ConnectionRequestInfo cri)
@@ -132,7 +132,7 @@
       }
    }
 
-   protected void toString(JBossStringBuilder buffer)
+   protected void toString(StringBuilder buffer)
    {
       buffer.append(cri);
    }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/indirect/IndirectGenericManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -50,7 +50,7 @@
    private static final Method CLOSE_FROM_INDIRECT_CONNECTION;
 
    /** The indirect connection interfaces */
-   private Class[] indirectConnectionInterfaces;
+   private Class<?>[] indirectConnectionInterfaces;
    
    static
    {
@@ -81,7 +81,7 @@
    {
       IndirectGenericConnection impl = new IndirectGenericConnection(this, cm, cri);
 
-      Class[] interfaces = getIndirectConnectionInterfaces(impl);
+      Class<?>[] interfaces = getIndirectConnectionInterfaces(impl);
       Object connection = impl.createProxy(interfaces, impl);
       return connection;
    }
@@ -93,14 +93,14 @@
     * @return the interfaces
     * @throws ResourceException for any error
     */
-   private Class[] getIndirectConnectionInterfaces(IndirectGenericConnection impl) throws ResourceException
+   private Class<?>[] getIndirectConnectionInterfaces(IndirectGenericConnection impl) throws ResourceException
    {
       if (indirectConnectionInterfaces == null)
       {
-         Set interfaces = new HashSet();
+         Set<Class<?>> interfaces = new HashSet<Class<?>>();
          addIndirectConnectionInterfaces(impl, interfaces);
          interfaces.add(IndirectConnection.class);
-         indirectConnectionInterfaces = (Class[]) interfaces.toArray(new Class[interfaces.size()]);
+         indirectConnectionInterfaces = interfaces.toArray(new Class[interfaces.size()]);
       }
       return indirectConnectionInterfaces;
    }
@@ -111,9 +111,9 @@
     * @param connection the connection 
     * @param interfaces the interfaces
     */
-   protected abstract void addIndirectConnectionInterfaces(IndirectGenericConnection connection, Set interfaces);
+   protected abstract void addIndirectConnectionInterfaces(IndirectGenericConnection connection, Set<Class<?>> interfaces);
    
-   protected void addConnectionInterfaces(GenericConnection connection, Set interfaces) throws ResourceException
+   protected void addConnectionInterfaces(GenericConnection connection, Set<Class<?>> interfaces) throws ResourceException
    {
       interfaces.add(RealConnection.class);
       super.addConnectionInterfaces(connection, interfaces);

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/JDBCManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/JDBCManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/JDBCManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -49,7 +49,7 @@
       return e;
    }
 
-   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set interfaces)
+   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set<Class<?>> interfaces)
    {
       interfaces.add(DataSource.class);
    }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/local/LocalJDBCManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/local/LocalJDBCManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jdbc/local/LocalJDBCManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -303,7 +303,7 @@
       }
    }
 
-   static class SubjectActions implements PrivilegedAction
+   static class SubjectActions implements PrivilegedAction<Boolean>
    {
       Subject subject;
 
@@ -318,9 +318,9 @@
          this.mcf = mcf;
       }
 
-      public Object run()
+      public Boolean run()
       {
-         Iterator i = subject.getPrivateCredentials().iterator();
+         Iterator<Object> i = subject.getPrivateCredentials().iterator();
          while (i.hasNext())
          {
             Object o = i.next();
@@ -342,7 +342,7 @@
       static boolean addMatchingProperties(Subject subject, Properties props, ManagedConnectionFactory mcf)
       {
          SubjectActions action = new SubjectActions(subject, props, mcf);
-         Boolean matched = (Boolean) AccessController.doPrivileged(action);
+         Boolean matched = AccessController.doPrivileged(action);
          return matched.booleanValue();
       }
    }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jms/JMSManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jms/JMSManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/mcf/jms/JMSManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -126,7 +126,7 @@
       this.connectionFactory = connectionFactory;
    }
 
-   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set interfaces)
+   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set<Class<?>> interfaces)
    {
       interfaces.add(ConnectionFactory.class);
       interfaces.add(QueueConnectionFactory.class);
@@ -134,7 +134,7 @@
       interfaces.add(Serializable.class);
    }
 
-   protected void addIndirectConnectionInterfaces(IndirectGenericConnection connection, Set interfaces)
+   protected void addIndirectConnectionInterfaces(IndirectGenericConnection connection, Set<Class<?>> interfaces)
    {
       interfaces.add(Connection.class);
       interfaces.add(QueueConnection.class);
@@ -193,7 +193,7 @@
       }
    }
 
-   protected boolean ignoreChild(Method method, Object object, Class type)
+   protected boolean ignoreChild(Method method, Object object, Class<?> type)
    {
       if (Message.class.isAssignableFrom(type))
          return true;

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/ra/ResourceErrorHandler.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/ra/ResourceErrorHandler.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/ra/ResourceErrorHandler.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -35,7 +35,7 @@
     * @param context the context
     * @param t the throwable
     * @return never
-    * @throws the correct error
+    * @throws Throwable the correct error
     */
    Throwable throwError(Object context, Throwable t) throws Throwable;
 }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericChild.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericChild.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericChild.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -27,7 +27,6 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.rars.generic.mcf.GenericManagedConnectionFactory;
-import org.jboss.util.JBossStringBuilder;
 
 /**
  * GenericChild.
@@ -72,7 +71,7 @@
       getManagedConnectionFactory().invokeClose(this, method, false);
    }
    
-   protected void toString(JBossStringBuilder buffer)
+   protected void toString(StringBuilder buffer)
    {
       buffer.append(target);
    }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericConnection.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericConnection.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericConnection.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -28,7 +28,6 @@
 
 import org.jboss.logging.Logger;
 import org.jboss.rars.generic.mcf.GenericManagedConnection;
-import org.jboss.util.JBossStringBuilder;
 
 /**
  * GenericConnection.
@@ -106,7 +105,7 @@
       managedConnection.close(this);
    }
    
-   protected void toString(JBossStringBuilder buffer)
+   protected void toString(StringBuilder buffer)
    {
       GenericManagedConnection managedConnection = getManagedConnection();
       if (managedConnection == null)

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericWrapper.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericWrapper.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/GenericWrapper.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,8 +22,9 @@
 package org.jboss.rars.generic.wrapper;
 
 import java.lang.reflect.Method;
-import java.util.Iterator;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.ResourceException;
 
@@ -31,12 +32,7 @@
 import org.jboss.logging.Logger;
 import org.jboss.rars.generic.mcf.GenericManagedConnectionFactory;
 import org.jboss.rars.generic.ra.ResourceErrorHandler;
-import org.jboss.util.collection.CollectionsFactory;
-import org.jboss.util.JBossStringBuilder;
-import org.jboss.util.Strings;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
 /**
  * GenericWrapper.
  * 
@@ -61,13 +57,13 @@
    private Object proxy;
    
    /** Whether we are closed */
-   private SynchronizedBoolean closed = new SynchronizedBoolean(false);
+   private AtomicBoolean closed = new AtomicBoolean(false);
 
    /** The parent */
    private GenericWrapper parent;
    
    /** The children */
-   private Set children = CollectionsFactory.createCopyOnWriteSet();
+   private Set<GenericWrapper> children = new CopyOnWriteArraySet<GenericWrapper>();
    
    /**
     * Create a new GenericWrapper.
@@ -154,16 +150,15 @@
     */
    public void closeWrapper(Method method)
    {
-      if (closed.set(true) == false)
+      if (closed.getAndSet(true) == false)
       {
          if (trace)
             log.trace(this + " CLOSED");
-         Set children = getChildren();
+         Set<GenericWrapper> children = getChildren();
          if (children != null && children.size() > 0)
          {
-            for (Iterator i = children.iterator(); i.hasNext();)
+            for (GenericWrapper child : children)
             {
-               GenericWrapper child = (GenericWrapper) i.next();
                removeChild(child);
                child.setParent(null);
                child.invokeClose(null);
@@ -232,7 +227,7 @@
     * @param context the context
     * @param t the throwable
     * @return never
-    * @throws the correct error
+    * @throws Throwable the correct error
     */
    public Throwable throwError(Object context, Throwable t) throws Throwable
    {
@@ -288,7 +283,7 @@
     * 
     * @return the children
     */
-   protected Set getChildren()
+   protected Set<GenericWrapper> getChildren()
    {
       return children;
    }
@@ -331,13 +326,12 @@
    /**
     * Create a handle
     * 
-    * @param interfaces the interfaces
     * @return the handle
     * @throws ResourceException for any error
     */
    protected GenericHandle createHandle() throws ResourceException
    {
-      Class[] interfaces = mcf.getWrappedInterfaces(this);
+      Class<?>[] interfaces = mcf.getWrappedInterfaces(this);
       return createHandle(interfaces);
    }
 
@@ -346,8 +340,9 @@
     * 
     * @param interfaces the interfaces
     * @return the handle
+    * @throws ResourceException for any error
     */
-   public GenericHandle createHandle(Class[] interfaces) throws ResourceException
+   public GenericHandle createHandle(Class<?>[] interfaces) throws ResourceException
    {
       return (GenericHandle) createProxy(interfaces, getWrappedObject());
    }
@@ -358,8 +353,9 @@
     * @param interfaces the interfaces
     * @param impl the implementation
     * @return the proxy
+    * @throws ResourceException for any error
     */
-   public Object createProxy(Class[] interfaces, Object impl) throws ResourceException
+   public Object createProxy(Class<?>[] interfaces, Object impl) throws ResourceException
    {
       SimpleMetaData metaData = new SimpleMetaData();
       metaData.addMetaData(GenericWrapper.METADATA_KEY, GenericWrapper.METADATA_KEY, this);
@@ -371,8 +367,8 @@
 
    public String toString()
    {
-      JBossStringBuilder buffer = new JBossStringBuilder();
-      Strings.defaultToString(buffer, this);
+      StringBuilder buffer = new StringBuilder();
+      buffer.append(getClass().getSimpleName()).append('@').append(System.identityHashCode(this));
       buffer.append('[');
       toString(buffer);
       buffer.append(']');
@@ -384,5 +380,5 @@
     * 
     * @param buffer the buffer
     */
-   protected abstract void toString(JBossStringBuilder buffer);
+   protected abstract void toString(StringBuilder buffer);
 }

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/ParentChildAdvice.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/ParentChildAdvice.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/ParentChildAdvice.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -41,7 +41,7 @@
       GenericWrapper wrapper = (GenericWrapper) mi.getMetaData(GenericWrapper.METADATA_KEY, GenericWrapper.METADATA_KEY);
 
       Method method = mi.getMethod();
-      Class returnType = method.getReturnType();
+      Class<?> returnType = method.getReturnType();
       boolean checkResult = (returnType != Void.class);
 
       Object result;

Modified: projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/WrapperAdvice.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/WrapperAdvice.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/main/org/jboss/rars/generic/wrapper/WrapperAdvice.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -49,8 +49,8 @@
       
       // Is this a straight forward invocation?
       Object target = mi.getTargetObject();
-      Class targetClass = target.getClass();
-      Class declaringClass = method.getDeclaringClass();
+      Class<?> targetClass = target.getClass();
+      Class<?> declaringClass = method.getDeclaringClass();
       if (declaringClass.isAssignableFrom(targetClass))
          return invocation.invokeNext();
       

Modified: projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/RARTest.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/RARTest.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/RARTest.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -42,7 +42,7 @@
       super(name);
    }
 
-   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
    {
       AbstractTestDelegate delegate = MicrocontainerTest.getDelegate(clazz);
       //delegate.enableSecurity = true;

Modified: projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestConnectionImpl.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestConnectionImpl.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestConnectionImpl.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -21,7 +21,7 @@
 */
 package org.jboss.test.rars.generic.mcf.support;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * TestConnectionImpl.
@@ -31,7 +31,7 @@
  */
 public class TestConnectionImpl implements TestConnection
 {
-   private SynchronizedBoolean closed = new SynchronizedBoolean(false);
+   private AtomicBoolean closed = new AtomicBoolean(false);
 
    public void close()
    {

Modified: projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/adapter/src/tests/org/jboss/test/rars/generic/mcf/support/TestManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -42,9 +42,9 @@
    /** The serialVersionUID */
    private static final long serialVersionUID = 1155075489153266482L;
    
-   private static final Class CONNECTION_FACTORY_CLASS = TestConnectionFactory.class;
+   private static final Class<?> CONNECTION_FACTORY_CLASS = TestConnectionFactory.class;
 
-   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set interfaces)
+   protected void addConnectionFactoryInterfaces(GenericConnectionFactory impl, Set<Class<?>> interfaces)
    {
       interfaces.add(CONNECTION_FACTORY_CLASS);
    }

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/ConnectionManagerFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/ConnectionManagerFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/ConnectionManagerFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -103,7 +103,7 @@
       if (manager == null)
          throw new IllegalStateException("Null manager");
       
-      Class[] interfaces = new Class[] { ConnectionManager.class }; 
+      Class<?>[] interfaces = new Class<?>[] { ConnectionManager.class }; 
       
       AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
       params.setProxiedClass(Object.class);

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/pool/simple/SimplePool.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/pool/simple/SimplePool.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/cm/pool/simple/SimplePool.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -44,7 +44,7 @@
    private static final Logger log = Logger.getLogger(SimplePool.class);
    
    /** The pool */
-   private List pool = new ArrayList(); 
+   private List<ManagedConnectionContext> pool = new ArrayList<ManagedConnectionContext>(); 
    
    public ManagedConnectionContext getManagedConnectonContext(Subject subject, ConnectionRequestInfo cri) throws ResourceException
    {
@@ -56,7 +56,7 @@
             int size = pool.size();
             if (size == 0)
                return null;
-            context = (ManagedConnectionContext) pool.remove(size-1);
+            context = pool.remove(size-1);
          }
          
          if (context.match(subject, cri))

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/Activation.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/Activation.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/Activation.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -81,7 +81,7 @@
    /**
     * Set the endpointFactory.
     * 
-    * @param endpointFactory The messageEndpointFactory to set.
+    * @param messageEndpointFactory The messageEndpointFactory to set.
     */
    public void setMessageEndpointFactory(MessageEndpointFactory messageEndpointFactory)
    {

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointAdvice.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointAdvice.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointAdvice.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,6 +22,7 @@
 package org.jboss.jca.plugins.endpoint;
 
 import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.endpoint.MessageEndpoint;
@@ -30,8 +31,6 @@
 import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.jca.plugins.advice.AbstractJCAInterceptor;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
 /**
  * Implements the message endpoint requirements.
  *
@@ -48,13 +47,13 @@
    private String cachedProxyString = null;
    
    /** Whether this proxy has had before invoked */
-   protected SynchronizedBoolean beforeInvoked = new SynchronizedBoolean(false);
+   protected AtomicBoolean beforeInvoked = new AtomicBoolean(false);
    
    /** Whether this proxy has been released */
-   protected SynchronizedBoolean released = new SynchronizedBoolean(false);
+   protected AtomicBoolean released = new AtomicBoolean(false);
    
    /** Whether we have delivered a message */
-   protected SynchronizedBoolean delivered = new SynchronizedBoolean(false);
+   protected AtomicBoolean delivered = new AtomicBoolean(false);
    
    /** The in use thread */
    protected Thread inUseThread = null;

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/endpoint/POJOMessageEndpointFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -51,7 +51,7 @@
    protected AspectManager manager;
    
    /** The message listener class */
-   protected Class messageListener;
+   protected Class<?> messageListener;
 
    /**
     * Get the manager.
@@ -78,7 +78,7 @@
     * 
     * @return the messageListener.
     */
-   public Class getMessageListener()
+   public Class<?> getMessageListener()
    {
       return messageListener;
    }
@@ -88,7 +88,7 @@
     * 
     * @param messageListener The messageListener to set.
     */
-   public void setMessageListener(Class messageListener)
+   public void setMessageListener(Class<?> messageListener)
    {
       this.messageListener = messageListener;
    }
@@ -122,7 +122,7 @@
       if (messageListener == null)
          throw new IllegalStateException("Null messageListener");
       
-      Class[] interfaces = new Class[] { messageListener, MessageEndpoint.class }; 
+      Class<?>[] interfaces = new Class<?>[] { messageListener, MessageEndpoint.class }; 
       
       AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
       params.setInterfaces(interfaces);

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/JBossWorkManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/JBossWorkManager.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/JBossWorkManager.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -236,7 +236,6 @@
     * End work
     * 
     * @param wrapper the work wrapper
-    * @throws WorkException for any error 
     */
    protected void endWork(WorkWrapper wrapper)
    {
@@ -260,7 +259,6 @@
     * Cancel work
     * 
     * @param wrapper the work wrapper
-    * @throws WorkException for any error 
     */
    protected void cancelWork(WorkWrapper wrapper)
    {

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/WorkWrapper.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/WorkWrapper.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/plugins/rar/work/WorkWrapper.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -80,6 +80,7 @@
     * @param workManager the work manager
     * @param work the work
     * @param waitType the waitType
+    * @param startTimeout the start timeout
     * @param executionContext the execution context
     * @param workListener the WorkListener
     * @throws IllegalArgumentException for null work, execution context or a negative start timeout

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContext.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContext.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContext.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -23,6 +23,8 @@
 
 import java.util.Collections;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ApplicationServerInternalException;
@@ -37,12 +39,9 @@
 import org.jboss.jca.spi.ResourceExceptionUtil;
 import org.jboss.jca.spi.pool.ManagedConnectionContextPool;
 import org.jboss.logging.Logger;
-import org.jboss.util.collection.CollectionsFactory;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
-
 /**
  * A ManagedConnectionContext.
  * 
@@ -85,13 +84,13 @@
    protected ManagedConnectionContextPool pool;
    
    /** The state */
-   private SynchronizedInt state = new SynchronizedInt(INITIALIZING); 
+   private AtomicInteger state = new AtomicInteger(INITIALIZING); 
    
    /** The connection handles */
-   protected Set handles = CollectionsFactory.createCopyOnWriteSet(); 
+   protected Set<Object> handles = new CopyOnWriteArraySet<Object>(); 
    
    /** Any cached connection set */
-   protected Set connectionSet;
+   protected Set<ManagedConnection> connectionSet;
    
    /**
     * Safely destroy a managed connecton
@@ -120,6 +119,7 @@
     * Create a new ManagedConnectionContext.
     * 
     * @param contextManager the context manager
+    * @param managedConnectionFactory the managed connection factory
     * @param managedConnection the managed connection
     * @throws ResourceException for any error
     */
@@ -162,6 +162,9 @@
    
    /**
     * Set the context in use
+    * 
+    * @param pool the pool
+    * @throws ResourceException for any error
     */
    public void setInUse(ManagedConnectionContextPool pool) throws ResourceException
    {
@@ -462,7 +465,7 @@
     */
    private int changeState(int newState)
    {
-      return state.set(newState);
+      return state.getAndSet(newState);
    }
    
    /**

Modified: projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContextManager.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContextManager.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/main/org/jboss/jca/spi/cm/ManagedConnectionContextManager.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,13 +22,13 @@
 package org.jboss.jca.spi.cm;
 
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ManagedConnection;
 import javax.resource.spi.ManagedConnectionFactory;
 
 import org.jboss.logging.Logger;
-import org.jboss.util.collection.CollectionsFactory;
 
 /**
  * A ManagedConnectionContextManager.
@@ -42,7 +42,7 @@
    private static final Logger log = Logger.getLogger(ManagedConnectionContextManager.class);
    
    /** The contexts */
-   private Set contexts = CollectionsFactory.createCopyOnWriteSet();
+   private Set<ManagedConnectionContext> contexts = new CopyOnWriteArraySet<ManagedConnectionContext>();
    
    /**
     * Create a new managed connection context

Modified: projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnection.java
===================================================================
--- projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnection.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnection.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -22,8 +22,9 @@
 package org.jboss.test.jca.rar.support;
 
 import java.io.PrintWriter;
-import java.util.Iterator;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
@@ -36,10 +37,7 @@
 import javax.transaction.xa.XAResource;
 
 import org.jboss.logging.Logger;
-import org.jboss.util.collection.CollectionsFactory;
 
-import EDU.oswego.cs.dl.util.concurrent.SynchronizedBoolean;
-
 /**
  * TestManagedConnection.
  * 
@@ -50,11 +48,11 @@
 {
    private static final Logger log = Logger.getLogger(TestManagedConnection.class);
    
-   protected SynchronizedBoolean destroyed = new SynchronizedBoolean(false);
+   protected AtomicBoolean destroyed = new AtomicBoolean(false);
    
-   protected Set handles = CollectionsFactory.createCopyOnWriteSet(); 
+   protected Set<TestConnectionImpl> handles = new CopyOnWriteArraySet<TestConnectionImpl>(); 
    
-   protected Set listeners = CollectionsFactory.createCopyOnWriteSet();
+   protected Set<ConnectionEventListener> listeners = new CopyOnWriteArraySet<ConnectionEventListener>();
    
    public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
@@ -89,11 +87,8 @@
    
    public void cleanup() throws ResourceException
    {
-      for (Iterator i = handles.iterator(); i.hasNext();)
-      {
-         TestConnectionImpl handle = (TestConnectionImpl) i.next();
+      for (TestConnectionImpl handle : handles)
          handle.setManagedConnection(null);
-      }
       handles.clear();
    }
 
@@ -118,9 +113,8 @@
 
    protected void broadcastEvent(ConnectionEvent event)
    {
-      for (Iterator i = listeners.iterator(); i.hasNext();)
+      for (ConnectionEventListener listener : listeners)
       {
-         ConnectionEventListener listener = (ConnectionEventListener) i.next();
          try
          {
             switch (event.getId())

Modified: projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnectionFactory.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestManagedConnectionFactory.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -53,6 +53,7 @@
       return new TestManagedConnection();
    }
 
+   @SuppressWarnings("unchecked")
    public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
    {
       // TODO FIXME

Modified: projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestResourceAdapter.java	2007-12-17 15:54:50 UTC (rev 68344)
+++ projects/jboss-jca/trunk/core/src/tests/org/jboss/test/jca/rar/support/TestResourceAdapter.java	2007-12-17 16:42:05 UTC (rev 68345)
@@ -21,9 +21,9 @@
 */
 package org.jboss.test.jca.rar.support;
 
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Timer;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ActivationSpec;
@@ -37,8 +37,6 @@
 import javax.resource.spi.work.WorkManager;
 import javax.transaction.xa.XAResource;
 
-import org.jboss.util.collection.CollectionsFactory;
-
 /**
  * A TestResourceAdapter.
  * 
@@ -49,7 +47,7 @@
 {
    protected BootstrapContext ctx;
 
-   protected Map endpoints = CollectionsFactory.createConcurrentReaderMap();
+   protected Map<TestActivationSpec, MessageEndpoint> endpoints = new ConcurrentHashMap<TestActivationSpec, MessageEndpoint>();
 
    public void start(BootstrapContext ctx) throws ResourceAdapterInternalException
    {
@@ -59,40 +57,37 @@
    public void stop()
    {
       
-      for (Iterator i = endpoints.entrySet().iterator(); i.hasNext();)
+      for (Map.Entry<TestActivationSpec, MessageEndpoint> entry : endpoints.entrySet())
       {
-         Map.Entry entry = (Map.Entry) i.next();
-         MessageEndpoint endpoint = (MessageEndpoint) entry.getValue();
+         MessageEndpoint endpoint = entry.getValue();
          if (endpoint != null)
-         {
             endpoint.release();
-            i.remove();
-         }
+         endpoints.clear();
       }
       ctx = null;
    }
    
    public MessageEndpoint getEndpoint(String name) throws Exception
    {
-      for (Iterator i = endpoints.entrySet().iterator(); i.hasNext();)
+      for (Map.Entry<TestActivationSpec, MessageEndpoint> entry : endpoints.entrySet())
       {
-         Map.Entry entry = (Map.Entry) i.next();
-         TestActivationSpec spec = (TestActivationSpec) entry.getKey();
+         TestActivationSpec spec = entry.getKey();
          if (name.equals(spec.getName()))
-            return (MessageEndpoint) entry.getValue();
+            return entry.getValue();
       }
       throw new Exception("MessageEndpoint not found for name: " + name);      
    }
 
    public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws ResourceException
    {
+      TestActivationSpec test = TestActivationSpec.class.cast(spec);
       MessageEndpoint endpoint = endpointFactory.createEndpoint(null);
-      endpoints.put(spec, endpoint);
+      endpoints.put(test, endpoint);
    }
 
    public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec)
    {
-      MessageEndpoint endpoint = (MessageEndpoint) endpoints.remove(spec);
+      MessageEndpoint endpoint = endpoints.remove(spec);
       if (endpoint != null)
          endpoint.release();
    }




More information about the jboss-cvs-commits mailing list