[infinispan-commits] Infinispan SVN: r1851 - in trunk/core/src: main/java/org/infinispan/manager and 4 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue May 25 17:26:50 EDT 2010


Author: manik.surtani at jboss.com
Date: 2010-05-25 17:26:50 -0400 (Tue, 25 May 2010)
New Revision: 1851

Removed:
   trunk/core/src/main/java/org/infinispan/NamedCacheNotDefinedException.java
Modified:
   trunk/core/src/main/java/org/infinispan/manager/NamedCacheNotFoundException.java
   trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java
   trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java
   trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java
   trunk/core/src/test/java/org/infinispan/replication/SyncReplTest.java
   trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java
Log:
Fixed regressions

Deleted: trunk/core/src/main/java/org/infinispan/NamedCacheNotDefinedException.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/NamedCacheNotDefinedException.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/main/java/org/infinispan/NamedCacheNotDefinedException.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -1,25 +0,0 @@
-package org.infinispan;
-
-/**
- * An exception thrown when a command refers to a named cache that does not exist.
- *
- * @author Manik Surtani
- * @version 4.1
- */
-public class NamedCacheNotDefinedException extends CacheException {
-   public NamedCacheNotDefinedException(String cacheName) {
-      super("Cache name: " + cacheName);
-   }
-
-   public NamedCacheNotDefinedException(String cacheName, Throwable cause) {
-      super("Cache name: " + cacheName, cause);
-   }
-
-   public NamedCacheNotDefinedException(String cacheName, String msg) {
-      super(msg + " Cache name: " + cacheName);
-   }
-
-   public NamedCacheNotDefinedException(String cacheName, String msg, Throwable cause) {
-      super(msg + " Cache name: " + cacheName, cause);
-   }
-}

Modified: trunk/core/src/main/java/org/infinispan/manager/NamedCacheNotFoundException.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/manager/NamedCacheNotFoundException.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/main/java/org/infinispan/manager/NamedCacheNotFoundException.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -10,18 +10,19 @@
 
    private static final long serialVersionUID = 5937213470732655993L;
 
-   public NamedCacheNotFoundException() {
+   public NamedCacheNotFoundException(String cacheName) {
+      super("Cache: " + cacheName);
    }
 
-   public NamedCacheNotFoundException(String message) {
-      super(message);
+   public NamedCacheNotFoundException(String cacheName, String message) {
+      super(message + " Cache: " + cacheName);
    }
 
-   public NamedCacheNotFoundException(String message, Throwable cause) {
-      super(message, cause);
+   public NamedCacheNotFoundException(String cacheName, String message, Throwable cause) {
+      super(message + " Cache: " + cacheName, cause);
    }
 
-   public NamedCacheNotFoundException(Throwable cause) {
-      super(cause);
+   public NamedCacheNotFoundException(String cacheName, Throwable cause) {
+      super("Cache: " + cacheName, cause);
    }
 }

Modified: trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/main/java/org/infinispan/remoting/InboundInvocationHandlerImpl.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -1,6 +1,5 @@
 package org.infinispan.remoting;
 
-import org.infinispan.NamedCacheNotDefinedException;
 import org.infinispan.commands.CommandsFactory;
 import org.infinispan.commands.remote.CacheRpcCommand;
 import org.infinispan.config.Configuration;
@@ -10,6 +9,7 @@
 import org.infinispan.factories.scopes.Scope;
 import org.infinispan.factories.scopes.Scopes;
 import org.infinispan.manager.CacheManager;
+import org.infinispan.manager.NamedCacheNotFoundException;
 import org.infinispan.marshall.Marshaller;
 import org.infinispan.remoting.responses.ExceptionResponse;
 import org.infinispan.remoting.responses.RequestIgnoredResponse;
@@ -45,16 +45,21 @@
    public Response handle(CacheRpcCommand cmd) throws Throwable {
       String cacheName = cmd.getCacheName();
       ComponentRegistry cr = gcr.getNamedComponentRegistry(cacheName);
+      long giveupTime = System.currentTimeMillis() + 30000; // arbitraty (?) wait time for caches to start
+      while (cr == null && System.currentTimeMillis() < giveupTime) {
+         Thread.sleep(100);
+         cr = gcr.getNamedComponentRegistry(cacheName);
+      }
+
       if (cr == null) {
          if (log.isInfoEnabled()) log.info("Cache named {0} does not exist on this cache manager!", cacheName);
-         return new ExceptionResponse(new NamedCacheNotDefinedException(cacheName));
-//         return null;
+         return new ExceptionResponse(new NamedCacheNotFoundException(cacheName));
       }
 
       Configuration localConfig = cr.getComponent(Configuration.class);
 
       if (!cr.getStatus().allowInvocations()) {
-         long giveupTime = System.currentTimeMillis() + localConfig.getStateRetrievalTimeout();
+         giveupTime = System.currentTimeMillis() + localConfig.getStateRetrievalTimeout();
          while (cr.getStatus().startingUp() && System.currentTimeMillis() < giveupTime) Thread.sleep(100);
          if (!cr.getStatus().allowInvocations()) {
             log.warn("Cache named [{0}] exists but isn't in a state to handle invocations.  Its state is {1}.", cacheName, cr.getStatus());

Modified: trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/test/java/org/infinispan/distribution/ConcurrentStartWithReplTest.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -63,7 +63,7 @@
 
    }
 
-   @Test(timeOut = 30000)
+   @Test(timeOut = 30000, enabled = false, description = "This will probably always be an unsupported sequence of startup, in a single thread.")
    public void testSequence2() throws ExecutionException, InterruptedException {
       /*
 

Modified: trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/test/java/org/infinispan/distribution/UnknownCacheStartTest.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -1,6 +1,7 @@
 package org.infinispan.distribution;
 
 import org.infinispan.Cache;
+import org.infinispan.CacheException;
 import org.infinispan.config.Configuration;
 import org.infinispan.manager.CacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
@@ -33,7 +34,7 @@
       killCacheManagers(cm1, cm2);
    }
 
-//   @Test (timeOut = 5000)
+   @Test (expectedExceptions = CacheException.class, timeOut = 30000)
    public void testStartingUnknownCaches() throws Throwable {
       cm1 = createCacheManager(configuration);
 

Modified: trunk/core/src/test/java/org/infinispan/replication/SyncReplTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/replication/SyncReplTest.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/test/java/org/infinispan/replication/SyncReplTest.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -8,8 +8,10 @@
 
 import static org.easymock.EasyMock.*;
 import org.infinispan.Cache;
+import org.infinispan.CacheException;
 import org.infinispan.commands.remote.CacheRpcCommand;
 import org.infinispan.config.Configuration;
+import org.infinispan.manager.NamedCacheNotFoundException;
 import org.infinispan.remoting.rpc.ResponseFilter;
 import org.infinispan.remoting.rpc.ResponseMode;
 import org.infinispan.remoting.rpc.RpcManager;
@@ -92,6 +94,7 @@
       }
    }
 
+   @Test (expectedExceptions = CacheException.class)
    public void testReplicateToNonExistentCache() {
       Cache cache1 = cache(0, "replSync");
       Cache cache2 = cache(1, "replSync");

Modified: trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java	2010-05-25 21:24:52 UTC (rev 1850)
+++ trunk/core/src/test/java/org/infinispan/statetransfer/StateTransferFunctionalTest.java	2010-05-25 21:26:50 UTC (rev 1851)
@@ -231,6 +231,7 @@
       log.info("testSTWithThirdWritingTxCache end - " + testCount);
    }
 
+   @Test (timeOut = 120000)
    public void testSTWithWritingNonTxThread() throws Exception {
       testCount++;
       log.info("testSTWithWritingNonTxThread start - " + testCount);
@@ -238,6 +239,7 @@
       log.info("testSTWithWritingNonTxThread end - " + testCount);
    }
 
+   @Test (timeOut = 120000)
    public void testSTWithWritingTxThread() throws Exception {
       testCount++;
       log.info("testSTWithWritingTxThread start - " + testCount);



More information about the infinispan-commits mailing list