[infinispan-commits] Infinispan SVN: r1228 - in trunk/core/src/main/java/org/infinispan: remoting/responses and 1 other directory.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Fri Nov 27 11:26:59 EST 2009


Author: manik.surtani at jboss.com
Date: 2009-11-27 11:26:59 -0500 (Fri, 27 Nov 2009)
New Revision: 1228

Modified:
   trunk/core/src/main/java/org/infinispan/marshall/Ids.java
   trunk/core/src/main/java/org/infinispan/remoting/responses/DistributionResponseGenerator.java
   trunk/core/src/main/java/org/infinispan/remoting/responses/UnsureResponse.java
Log:
UnsureResponse should be marshallable

Modified: trunk/core/src/main/java/org/infinispan/marshall/Ids.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/marshall/Ids.java	2009-11-27 15:22:39 UTC (rev 1227)
+++ trunk/core/src/main/java/org/infinispan/marshall/Ids.java	2009-11-27 16:26:59 UTC (rev 1228)
@@ -48,6 +48,7 @@
    static final byte EXCEPTION_RESPONSE = 7;
    static final byte UNSUCCESSFUL_RESPONSE = 8;
    static final byte REQUEST_IGNORED_RESPONSE = 9;
+   static final byte UNSURE_RESPONSE = 54;
 
    // entries and values
    static final byte IMMORTAL_ENTRY = 10;

Modified: trunk/core/src/main/java/org/infinispan/remoting/responses/DistributionResponseGenerator.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/responses/DistributionResponseGenerator.java	2009-11-27 15:22:39 UTC (rev 1227)
+++ trunk/core/src/main/java/org/infinispan/remoting/responses/DistributionResponseGenerator.java	2009-11-27 16:26:59 UTC (rev 1228)
@@ -26,7 +26,7 @@
       if (command instanceof ClusteredGetCommand) {
          ClusteredGetCommand clusteredGet = (ClusteredGetCommand) command;
          if (distributionManager.isAffectedByRehash(clusteredGet.getKey()))
-            return new UnsureResponse();
+            return UnsureResponse.INSTANCE;
          return returnValue == null ? null : new SuccessfulResponse(returnValue);
       } else if (command instanceof SingleRpcCommand) {
          SingleRpcCommand src = (SingleRpcCommand) command;

Modified: trunk/core/src/main/java/org/infinispan/remoting/responses/UnsureResponse.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/remoting/responses/UnsureResponse.java	2009-11-27 15:22:39 UTC (rev 1227)
+++ trunk/core/src/main/java/org/infinispan/remoting/responses/UnsureResponse.java	2009-11-27 16:26:59 UTC (rev 1228)
@@ -1,5 +1,12 @@
 package org.infinispan.remoting.responses;
 
+import org.infinispan.marshall.Marshallable;
+import org.infinispan.marshall.Ids;
+
+import java.io.ObjectOutput;
+import java.io.IOException;
+import java.io.ObjectInput;
+
 /**
  * An unsure response - used with Dist - essentially asks the caller to check the next response from the next node since
  * the sender is in a state of flux (probably in the middle of rebalancing)
@@ -7,8 +14,19 @@
  * @author Manik Surtani
  * @since 4.0
  */
+ at Marshallable(externalizer = UnsureResponse.Externalizer.class, id = Ids.UNSURE_RESPONSE)
 public class UnsureResponse extends ValidResponse {
+   public static final UnsureResponse INSTANCE = new UnsureResponse();
    public boolean isSuccessful() {
       return false;
    }
+
+   public static class Externalizer implements org.infinispan.marshall.Externalizer {
+      public void writeObject(ObjectOutput output, Object subject) throws IOException {
+      }
+
+      public Object readObject(ObjectInput input) throws IOException, ClassNotFoundException {
+         return INSTANCE;
+      }
+   }   
 }



More information about the infinispan-commits mailing list