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

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Mon Feb 8 10:48:34 EST 2010


Author: manik.surtani at jboss.com
Date: 2010-02-08 10:48:33 -0500 (Mon, 08 Feb 2010)
New Revision: 1468

Modified:
   trunk/core/src/main/java/org/infinispan/interceptors/DistLockingInterceptor.java
   trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java
   trunk/core/src/main/java/org/infinispan/interceptors/LockingInterceptor.java
   trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransaction.java
   trunk/core/src/main/java/org/infinispan/util/Util.java
   trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManager.java
   trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManagerImpl.java
Log:
IntelliJ Inspection refactoring

Modified: trunk/core/src/main/java/org/infinispan/interceptors/DistLockingInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/DistLockingInterceptor.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/interceptors/DistLockingInterceptor.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -21,7 +21,7 @@
    }
 
    @Override
-   protected void commitEntry(InvocationContext ctx, CacheEntry entry) {
+   protected void commitEntry(CacheEntry entry) {
       boolean doCommit = true;
       if (!dm.isLocal(entry.getKey())) {
          if (configuration.isL1CacheEnabled()) {

Modified: trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/interceptors/DistributionInterceptor.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -113,7 +113,8 @@
       } else {
          // maybe we are still rehashing as a joiner? ISPN-258
          if (isMappedToLocalNode && dmWasRehashingDuringLocalLookup) {
-            if (trace) log.trace("Key is mapped to local node, but a rehash is in progress so may need to look elsewhere");
+            if (trace)
+               log.trace("Key is mapped to local node, but a rehash is in progress so may need to look elsewhere");
             // try a remote lookup all the same
             return realRemoteGet(ctx, key, false);
          } else {
@@ -188,11 +189,13 @@
 
    @Override
    public Object visitLockControlCommand(TxInvocationContext ctx, LockControlCommand command) throws Throwable {
-      if (ctx.isOriginLocal()) rpcManager.invokeRemotely(dm.getAffectedNodes(ctx.getAffectedKeys()), command, true, true);
+      if (ctx.isOriginLocal())
+         rpcManager.invokeRemotely(dm.getAffectedNodes(ctx.getAffectedKeys()), command, true, true);
       return invokeNextInterceptor(ctx, command);
    }
 
    // ---- TX boundary commands
+
    @Override
    public Object visitCommitCommand(TxInvocationContext ctx, CommitCommand command) throws Throwable {
       if (ctx.isOriginLocal() && ctx.hasModifications()) {
@@ -214,7 +217,8 @@
       if (ctx.isOriginLocal() && ctx.hasModifications()) {
          List<Address> recipients = dm.getAffectedNodes(ctx.getAffectedKeys());
          NotifyingNotifiableFuture<Object> f = null;
-         if (command.isOnePhaseCommit()) f = flushL1Cache(recipients.size(), getKeys(ctx.getModifications()), null, sync);
+         if (command.isOnePhaseCommit())
+            f = flushL1Cache(recipients.size(), getKeys(ctx.getModifications()), null, sync);
          // this method will return immediately if we're the only member (because exclude_self=true)
          rpcManager.invokeRemotely(recipients, command, sync);
          if (f != null) f.get();
@@ -224,7 +228,8 @@
 
    @Override
    public Object visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable {
-      if (ctx.isOriginLocal()) rpcManager.invokeRemotely(dm.getAffectedNodes(ctx.getAffectedKeys()), command, configuration.isSyncRollbackPhase(), true);
+      if (ctx.isOriginLocal())
+         rpcManager.invokeRemotely(dm.getAffectedNodes(ctx.getAffectedKeys()), command, configuration.isSyncRollbackPhase(), true);
       return invokeNextInterceptor(ctx, command);
    }
 
@@ -254,17 +259,13 @@
       return l.toArray(new Object[l.size()]);
    }
 
-   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, Object[] keys, Object retval, boolean sync) {
+   private NotifyingNotifiableFuture<Object> flushL1Cache(int numCallRecipients, Object[] keys, Object retval) {
       if (isL1CacheEnabled && numCallRecipients > 0 && rpcManager.getTransport().getMembers().size() > numCallRecipients) {
          if (trace) log.trace("Invalidating L1 caches");
          InvalidateCommand ic = cf.buildInvalidateFromL1Command(false, keys);
-//         if (useFuture) {
-            NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
-            rpcManager.broadcastRpcCommandInFuture(ic, future);
-            return future;
-//         } else {
-//            rpcManager.broadcastRpcCommand(ic, sync);
-//         }
+         NotifyingNotifiableFuture<Object> future = new AggregatingNotifyingFutureImpl(retval, 2);
+         rpcManager.broadcastRpcCommandInFuture(ic, future);
+         return future;
       }
       return null;
    }
@@ -300,7 +301,7 @@
                   if (future == null) future = new NotifyingFutureImpl(returnValue);
                   rpcManager.invokeRemotelyInFuture(rec, command, future);
                   return future;
-               } else {                  
+               } else {
                   rpcManager.invokeRemotely(rec, command, sync);
                   if (future != null && !sync) future.get(); // wait for the inval command to complete
                }

Modified: trunk/core/src/main/java/org/infinispan/interceptors/LockingInterceptor.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/interceptors/LockingInterceptor.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/interceptors/LockingInterceptor.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -278,7 +278,7 @@
             boolean needToUnlock = lockManager.possiblyLocked(entry);
             // could be null with read-committed
             if (entry != null && entry.isChanged()) {
-               commitEntry(ctx, entry);
+               commitEntry(entry);
             } else {
                if (trace) log.trace("Entry for key {0} is null, not calling commitUpdate", key);
             }
@@ -294,7 +294,7 @@
       }
    }
 
-   protected void commitEntry(InvocationContext ctx, CacheEntry entry) {
+   protected void commitEntry(CacheEntry entry) {
       entry.commit(dataContainer);
    }
 }

Modified: trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransaction.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransaction.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/transaction/tm/DummyTransaction.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -157,18 +157,6 @@
    }
 
    /**
-    * Change the transaction timeout for transactions started by the calling thread with the {@link
-    * DummyTransactionManager#begin()} method.
-    *
-    * @param seconds The new timeout value, in seconds. If this parameter is <code>0</code>, the timeout value is reset
-    *                to the default value.
-    * @throws SystemException If the transaction service fails in an unexpected way.
-    */
-   public void setTransactionTimeout(int seconds) throws SystemException {
-      throw new SystemException("not supported");
-   }
-
-   /**
     * Enlist an XA resource with this transaction.
     *
     * @return <code>true</code> if the resource could be enlisted with this transaction, otherwise <code>false</code>.
@@ -311,7 +299,7 @@
       }
    }
 
-   private boolean runCommitTx() throws HeuristicMixedException {
+   private void runCommitTx() throws HeuristicMixedException {
       DummyTransaction transaction = tm_.getTransaction();
       Collection<XAResource> resources = transaction.getEnlistedResources();
       for (XAResource res : resources) {
@@ -323,7 +311,6 @@
             throw new HeuristicMixedException(e.getMessage());
          }
       }
-      return true;
    }
 
    public void setStatus(int stat) {

Modified: trunk/core/src/main/java/org/infinispan/util/Util.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/Util.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/util/Util.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -93,10 +93,6 @@
    private Util() {
    }
 
-   public static Util getInstance() {
-      return null;
-   }
-
    /**
     * Null-safe equality test.
     *

Modified: trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManager.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManager.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManager.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -50,7 +50,7 @@
     *
     * @param owner lock owner
     */
-   void unlock(Object key, Object owner);
+   void unlock(Object key);
 
    /**
     * Releases locks present in an invocation context and transaction entry, if one is available.

Modified: trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManagerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManagerImpl.java	2010-02-08 15:26:50 UTC (rev 1467)
+++ trunk/core/src/main/java/org/infinispan/util/concurrent/locks/LockManagerImpl.java	2010-02-08 15:48:33 UTC (rev 1468)
@@ -92,7 +92,7 @@
             0 : configuration.getLockAcquisitionTimeout();
    }
 
-   public void unlock(Object key, Object owner) {
+   public void unlock(Object key) {
       if (trace) log.trace("Attempting to unlock " + key);
       lockContainer.releaseLock(key);
    }



More information about the infinispan-commits mailing list