[jboss-cvs] JBossAS SVN: r71963 - in projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects: txlock and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 10 12:54:34 EDT 2008
Author: adrian at jboss.org
Date: 2008-04-10 12:54:34 -0400 (Thu, 10 Apr 2008)
New Revision: 71963
Modified:
projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptor.java
projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptorFactory.java
projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxPolicy.java
projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxTimeoutReaderFactory.java
projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/txlock/QueuedTxLock.java
Log:
Source code tidyup
Modified: projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptor.java
===================================================================
--- projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptor.java 2008-04-10 16:50:16 UTC (rev 71962)
+++ projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptor.java 2008-04-10 16:54:34 UTC (rev 71963)
@@ -23,9 +23,9 @@
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
+
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
-import org.jboss.logging.Logger;
/**
* This interceptor handles transactions for AOP
@@ -36,7 +36,6 @@
*/
public class TxInterceptor
{
- private static final Logger log = Logger.getLogger(TxInterceptor.class);
private static final TxTimeoutReader txTimeoutReader = TxTimeoutReaderFactory.getTxTimeoutReader();
public static class Never implements Interceptor
@@ -157,8 +156,6 @@
public static class Required implements Interceptor
{
- private static final Logger log = Logger.getLogger(Required.class);
-
protected TransactionManager tm;
protected TxPolicy policy;
protected int timeout;
Modified: projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptorFactory.java
===================================================================
--- projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptorFactory.java 2008-04-10 16:50:16 UTC (rev 71962)
+++ projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxInterceptorFactory.java 2008-04-10 16:54:34 UTC (rev 71963)
@@ -27,6 +27,7 @@
import java.util.HashMap;
import org.jboss.aop.Advisor;
import org.jboss.aop.InstanceAdvisor;
+import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.ConstructorJoinpoint;
import org.jboss.aop.joinpoint.Joinpoint;
import org.jboss.aop.joinpoint.MethodJoinpoint;
@@ -42,7 +43,7 @@
public class TxInterceptorFactory implements org.jboss.aop.advice.AspectFactory
{
protected TxPolicy policy;
- protected HashMap nameMap = new HashMap();
+ protected HashMap<String, Interceptor> nameMap = new HashMap<String, Interceptor>();
protected void initializePolicy()
{
@@ -65,7 +66,7 @@
{
if (jp instanceof ConstructorJoinpoint)
{
- Constructor con = ((ConstructorJoinpoint)jp).getConstructor();
+ Constructor<?> con = ((ConstructorJoinpoint)jp).getConstructor();
String txType = (String)advisor.getConstructorMetaData().getConstructorMetaData(con, "transaction", "trans-attribute");
if (txType != null) return txType;
Modified: projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxPolicy.java
===================================================================
--- projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxPolicy.java 2008-04-10 16:50:16 UTC (rev 71962)
+++ projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxPolicy.java 2008-04-10 16:54:34 UTC (rev 71963)
@@ -145,13 +145,8 @@
* translates any exceptions into
* TransactionRolledBack[Local]Exception or SystemException.
*
- * @param invocation an <code>Invocation</code> value
* @param tm a <code>TransactionManager</code> value
* @param tx a <code>Transaction</code> value
- * @throws javax.transaction.TransactionRolledbackException
- * if an error occurs
- * @throws javax.transaction.SystemException
- * if an error occurs
*/
public void endTransaction(TransactionManager tm, Transaction tx)
{
@@ -203,7 +198,7 @@
* on the invocation's transaction and logs any exceptions than may
* occur.
*
- * @param invocation an <code>Invocation</code> value
+ * @param tx the transaction
*/
public void setRollbackOnly(Transaction tx)
{
@@ -228,27 +223,28 @@
* if the supplied Throwable is an application exception and
* rethrows it if it is.
*
+ * @param inv the invocation
* @param e a <code>Throwable</code> value
- * @throws Exception if an error occurs
+ * @throws Throwable if an error occurs
*/
public void rethrowApplicationException(Invocation inv, Throwable e) throws Throwable
{
Object applicationExceptions = inv.getMetaData("transaction", "application-exceptions");
if (applicationExceptions == null) return;
- Class[] applicationExceptionsList;
+ Class<?>[] applicationExceptionsList;
if (applicationExceptions instanceof String)
{
- ArrayList tmpList = new ArrayList();
+ ArrayList<Class<?>> tmpList = new ArrayList<Class<?>>();
String aes = (String) applicationExceptions;
aes = aes.trim();
StringTokenizer tokenizer = new StringTokenizer(aes, ",");
while (tokenizer.hasMoreTokens())
{
String token = tokenizer.nextToken().trim();
- Class excClass = Thread.currentThread().getContextClassLoader().loadClass(token);
+ Class<?> excClass = Thread.currentThread().getContextClassLoader().loadClass(token);
tmpList.add(excClass);
}
- applicationExceptionsList = (Class[]) tmpList.toArray(new Class[tmpList.size()]);
+ applicationExceptionsList = tmpList.toArray(new Class[tmpList.size()]);
}
else
{
Modified: projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxTimeoutReaderFactory.java
===================================================================
--- projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxTimeoutReaderFactory.java 2008-04-10 16:50:16 UTC (rev 71962)
+++ projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/tx/TxTimeoutReaderFactory.java 2008-04-10 16:54:34 UTC (rev 71963)
@@ -35,7 +35,7 @@
{
try
{
- Class clazz = Class.forName("org.jboss.tm.TransactionTimeoutConfiguration");
+ Class.forName("org.jboss.tm.TransactionTimeoutConfiguration");
return new TransactionTimeoutConfigurationReader();
}
catch (ClassNotFoundException e)
@@ -44,7 +44,7 @@
try
{
- Class clazz = Class.forName("org.jboss.tm.TxManager");
+ Class.forName("org.jboss.tm.TxManager");
return new TxManagerTimeOutReader();
}
catch (ClassNotFoundException e)
Modified: projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/txlock/QueuedTxLock.java
===================================================================
--- projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/txlock/QueuedTxLock.java 2008-04-10 16:50:16 UTC (rev 71962)
+++ projects/jboss-aspects/trunk/transaction/src/main/org/jboss/aspects/txlock/QueuedTxLock.java 2008-04-10 16:54:34 UTC (rev 71963)
@@ -55,8 +55,8 @@
public static final String TXLOCK = "TxLock";
public static final String TIMEOUT = "timeout";
- private HashMap txLocks = new HashMap();
- private LinkedList txWaitQueue = new LinkedList();
+ private HashMap<TxLock, TxLock> txLocks = new HashMap<TxLock, TxLock>();
+ private LinkedList<TxLock> txWaitQueue = new LinkedList<TxLock>();
/** Transaction holding lock on bean */
private Transaction tx = null;
@@ -93,6 +93,8 @@
/**
* The setTransaction associates a transaction with the lock.
* The current transaction is associated by the schedule call.
+ *
+ * @param tx the transaction
*/
public void setTransaction(Transaction tx)
{
@@ -147,7 +149,7 @@
{
TxLock lock = null;
TxLock key = new TxLock(miTx);
- lock = (TxLock) txLocks.get(key);
+ lock = txLocks.get(key);
if (lock == null)
{
txLocks.put(key, key);
@@ -196,7 +198,10 @@
*
* Synchronizing on lock: a failure to get scheduled must result in a wait() call and a
* release of the lock. Schedulation must return with lock.
- *
+ *
+ * @param miTx the transaction
+ * @param mi the invocation
+ * @throws Exception for any error
*/
public void schedule(Transaction miTx, org.jboss.aop.joinpoint.Invocation mi)
throws Exception
@@ -231,8 +236,10 @@
/**
* Wait until no other transaction is running with this lock.
- *
- * @return Returns true if this thread was scheduled in txWaitQueue
+ * @param mi the invocation
+ * @param miTx the transaction
+ * @param trace whether trace is enabled
+ * @throws Exception for any error
*/
protected void waitForTx(org.jboss.aop.joinpoint.Invocation mi, Transaction miTx, boolean trace) throws Exception
{
@@ -340,7 +347,7 @@
TxLock thelock = null;
if (!txWaitQueue.isEmpty())
{
- thelock = (TxLock) txWaitQueue.removeFirst();
+ thelock = txWaitQueue.removeFirst();
txLocks.remove(thelock);
thelock.isQueued = false;
// The new transaction is the next one, important to set it up to avoid race with
More information about the jboss-cvs-commits
mailing list