[jboss-cvs] JBoss Messaging SVN: r8404 - in branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms: tx and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 8 21:18:17 EDT 2011


Author: gaohoward
Date: 2011-08-08 21:18:17 -0400 (Mon, 08 Aug 2011)
New Revision: 8404

Added:
   branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/client/ConnectionCapabilities.java
Modified:
   branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/ClientTransaction.java
   branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/TransactionRequest.java
   branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java
Log:
port JBMESSAGING-1884


Added: branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/client/ConnectionCapabilities.java
===================================================================
--- branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/client/ConnectionCapabilities.java	                        (rev 0)
+++ branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/client/ConnectionCapabilities.java	2011-08-09 01:18:17 UTC (rev 8404)
@@ -0,0 +1,58 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.jms.client;
+
+/**
+ * Information about server capabilities.
+ */
+public class ConnectionCapabilities
+{
+   // Constants -----------------------------------------------------
+
+   public static final byte RECOVERY_ROLLBACK_VERSION = 39 ;
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
+   // Constructors --------------------------------------------------
+   
+   // Connection implementation --------------------------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   public static boolean doesConnectionSupportRecoveryRollback(final byte version)
+   {
+      return (version >= RECOVERY_ROLLBACK_VERSION) ;
+   }
+   
+   // Object overrides ----------------------------------------------
+
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+   // Private -------------------------------------------------------
+   
+   // Inner classes -------------------------------------------------
+  
+}

Modified: branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/ClientTransaction.java
===================================================================
--- branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/ClientTransaction.java	2011-08-08 03:27:01 UTC (rev 8403)
+++ branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/ClientTransaction.java	2011-08-09 01:18:17 UTC (rev 8404)
@@ -68,6 +68,9 @@
    
    private boolean rollbackOnly = false;
 
+   /* Not sent over the wire, this is for differentiating between incompatible versions */
+   protected boolean supportsRecovered ;
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -235,7 +238,16 @@
       recovered = b;
    }
 
+   public void setSupportsRecovered(final boolean supportsRecovered)
+   {
+      this.supportsRecovered = supportsRecovered ;
+   }
 
+   public boolean getSupportsRecovered()
+   {
+      return supportsRecovered ;
+   }
+
    // Streamable implementation ---------------------------------
 
    public void write(DataOutputStream out) throws Exception
@@ -293,7 +305,11 @@
             out.writeLong(Long.MIN_VALUE);
          }
       }
-      out.writeBoolean(recovered);
+
+      if (supportsRecovered)
+      {
+         out.writeBoolean(recovered);
+      }
    }
 
 
@@ -338,7 +354,10 @@
          }
       }
       
-      recovered = in.readBoolean();
+      if (supportsRecovered)
+      {
+         recovered = in.readBoolean();
+      }
    }
 
    // Protected -----------------------------------------------------

Modified: branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/TransactionRequest.java
===================================================================
--- branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/TransactionRequest.java	2011-08-08 03:27:01 UTC (rev 8403)
+++ branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/tx/TransactionRequest.java	2011-08-09 01:18:17 UTC (rev 8404)
@@ -67,6 +67,9 @@
 
    protected ClientTransaction state;
    
+   /* Not send over the wire, this is for differentiating between incompatible versions of ClientTransaction */
+   protected boolean supportsRecovered ;
+   
    // Static --------------------------------------------------------
    
    // Constructors --------------------------------------------------
@@ -109,7 +112,8 @@
       
       if (state != null)
       {
-         out.write(PRESENT);      
+         out.write(PRESENT);  
+         state.setSupportsRecovered(supportsRecovered);
          state.write(out);
       }
       else
@@ -153,6 +157,7 @@
      else
      {
         state = new ClientTransaction();
+        state.setSupportsRecovered(supportsRecovered);
      
         state.read(in);
      }
@@ -175,6 +180,16 @@
       return requestType;
    }
 
+   public void setSupportsRecovered(final boolean supportsRecovered)
+   {
+      this.supportsRecovered = supportsRecovered ;
+   }
+
+   public boolean getSupportsRecovered()
+   {
+      return supportsRecovered ;
+   }
+
    public String toString()
    {
       return "TransactionRequest[" +

Modified: branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java
===================================================================
--- branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java	2011-08-08 03:27:01 UTC (rev 8403)
+++ branches/JBM_patch_1884_on_148sp1/src/main/org/jboss/jms/wireformat/ConnectionSendTransactionRequest.java	2011-08-09 01:18:17 UTC (rev 8404)
@@ -24,6 +24,7 @@
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 
+import org.jboss.jms.client.ConnectionCapabilities;
 import org.jboss.jms.delegate.ConnectionEndpoint;
 import org.jboss.jms.tx.TransactionRequest;
 
@@ -63,7 +64,10 @@
       super.read(is);
       
       req = new TransactionRequest();
-      
+
+      final boolean supportsRecovered = ConnectionCapabilities.doesConnectionSupportRecoveryRollback(version) ;
+      req.setSupportsRecovered(supportsRecovered) ;
+
       req.read(is);
 
       checkForDuplicates = is.readBoolean();
@@ -88,6 +92,9 @@
    {
       super.write(os);
       
+      final boolean supportsRecovered = ConnectionCapabilities.doesConnectionSupportRecoveryRollback(version) ;
+      req.setSupportsRecovered(supportsRecovered) ;
+      
       req.write(os); 
 
       os.writeBoolean(checkForDuplicates);



More information about the jboss-cvs-commits mailing list