[infinispan-commits] Infinispan SVN: r346 - in trunk/core/src: main/java/org/infinispan/interceptors and 2 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Wed May 27 04:58:39 EDT 2009


Author: mircea.markus
Date: 2009-05-27 04:58:39 -0400 (Wed, 27 May 2009)
New Revision: 346

Modified:
   trunk/core/src/main/java/org/infinispan/Cache.java
   trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java
   trunk/core/src/main/java/org/infinispan/transaction/TransactionLog.java
   trunk/core/src/test/resources/log4j.xml
Log:
fixed NBST stuff and optimized txlog

Modified: trunk/core/src/main/java/org/infinispan/Cache.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/Cache.java	2009-05-27 08:57:17 UTC (rev 345)
+++ trunk/core/src/main/java/org/infinispan/Cache.java	2009-05-27 08:58:39 UTC (rev 346)
@@ -131,6 +131,7 @@
     * a 0 lock acquisition timeout so it does not block in attempting to acquire locks.  It behaves as a no-op if the
     * lock on the entry cannot be acquired <i>immediately</i>.
     * <p/>
+    * Important: this method should not be called from within a tx's scope.  
     *
     * @param key key to evict
     */

Modified: trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java	2009-05-27 08:57:17 UTC (rev 345)
+++ trunk/core/src/main/java/org/infinispan/interceptors/TxInterceptor.java	2009-05-27 08:58:39 UTC (rev 346)
@@ -32,7 +32,6 @@
 import javax.transaction.SystemException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
-import java.util.Arrays;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -81,33 +80,26 @@
          transactionLog.logPrepare(command);
       }
       if (getStatisticsEnabled()) prepares.incrementAndGet();
-      try {
-         return invokeNextInterceptor(ctx, command);
-      } finally {
-         if (command.isOnePhaseCommit()) {
-            transactionLog.logOnePhaseCommit(ctx.getGlobalTransaction(), Arrays.asList(command.getModifications()));
-         }
+      Object result = invokeNextInterceptor(ctx, command);
+      if (command.isOnePhaseCommit()) {
+         transactionLog.logOnePhaseCommit(ctx.getGlobalTransaction(), command.getModifications());
       }
+      return result;
    }
 
    @Override
    public Object visitCommitCommand(TxInvocationContext ctx, CommitCommand command) throws Throwable {
       if (getStatisticsEnabled()) commits.incrementAndGet();
-      try {
-         return invokeNextInterceptor(ctx, command);
-      } finally {
-         transactionLog.logCommit(command.getGlobalTransaction());
-      }
+      Object result = invokeNextInterceptor(ctx, command);
+      transactionLog.logCommit(command.getGlobalTransaction());
+      return result;
    }
 
    @Override
    public Object visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable {
       if (getStatisticsEnabled()) rollbacks.incrementAndGet();
-      try {
-         return invokeNextInterceptor(ctx, command);
-      } finally {
-         transactionLog.rollback(command.getGlobalTransaction());
-      }
+      transactionLog.rollback(command.getGlobalTransaction());
+      return invokeNextInterceptor(ctx, command);
    }
 
    @Override
@@ -154,7 +146,7 @@
 
    @Override
    public Object visitEvictCommand(InvocationContext ctx, EvictCommand command) throws Throwable {
-      return enlistWriteAndInvokeNext(ctx, command);
+      return invokeNextInterceptor(ctx, command);
    }
 
    @Override
@@ -192,9 +184,9 @@
          }
          localTxContext.setXaCache(xaAdapter);
       }
+      Object rv = invokeNextInterceptor(ctx, command);
       if (!ctx.isInTxScope())
          transactionLog.logNoTxWrite(command);
-      Object rv = invokeNextInterceptor(ctx, command);
       if (command.isSuccessful() && shouldAddMod) xaAdapter.addModification(command);
       return rv;
    }

Modified: trunk/core/src/main/java/org/infinispan/transaction/TransactionLog.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/transaction/TransactionLog.java	2009-05-27 08:57:17 UTC (rev 345)
+++ trunk/core/src/main/java/org/infinispan/transaction/TransactionLog.java	2009-05-27 08:58:39 UTC (rev 346)
@@ -95,11 +95,11 @@
       }
    }
 
-   public final void logOnePhaseCommit(GlobalTransaction gtx, List<WriteCommand> modifications) {
+   public final void logOnePhaseCommit(GlobalTransaction gtx, WriteCommand[] modifications) {
       // Just in case...
       if (gtx != null) pendingPrepares.remove(gtx);
-      if (isActive() && modifications != null && modifications.size() > 0)
-         addEntry(gtx, modifications.toArray(new WriteCommand[modifications.size()]));
+      if (isActive() && modifications != null && modifications.length > 0)
+         addEntry(gtx, modifications);
    }
 
    public final void logNoTxWrite(WriteCommand write) {

Modified: trunk/core/src/test/resources/log4j.xml
===================================================================
--- trunk/core/src/test/resources/log4j.xml	2009-05-27 08:57:17 UTC (rev 345)
+++ trunk/core/src/test/resources/log4j.xml	2009-05-27 08:58:39 UTC (rev 346)
@@ -48,6 +48,14 @@
       <priority value="INFO"/>
    </category>
 
+   <category name="org.infinispan.remoting.rpc.RpcManagerImpl">
+      <priority value="TRACE"/>
+   </category>
+
+   <category name="org.jgroups">
+      <priority value="TRACE"/>
+   </category>
+
    <category name="org.infinispan.profiling">
       <priority value="WARN"/>
    </category>




More information about the infinispan-commits mailing list