From 8443bd188a4d45779b6b9385611203e5a8e7dfc5 Mon Sep 17 00:00:00 2001 From: Gary Tully Date: Mon, 28 Mar 2011 15:41:18 +0000 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-3236 - preserve store compatability with new ack attribute. Only use version 7 openwire on the wire, persist using version 6 format. New ack cause attribute does not need to persist as it gets set in a DLQ message property. resolve regression - org.apache.activemq.store.amq.reader.AMQReaderTest.testIterateArchive git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1086277 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/activemq/command/CommandTypes.java | 4 ++++ .../java/org/apache/activemq/openwire/OpenWireFormat.java | 2 +- .../org/apache/activemq/openwire/OpenWireFormatFactory.java | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java b/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java index a3e88981b8..bc2f5ce111 100755 --- a/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java +++ b/activemq-core/src/main/java/org/apache/activemq/command/CommandTypes.java @@ -26,6 +26,10 @@ public interface CommandTypes { // What is the latest version of the openwire protocol byte PROTOCOL_VERSION = 7; + // What is the latest version of the openwire protocol used in the stores + byte PROTOCOL_STORE_VERSION = 6; + + // A marshaling layer can use this type to specify a null object. byte NULL = 0; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java index 6c0d0c6b95..d9375ba32e 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormat.java @@ -38,7 +38,7 @@ import org.apache.activemq.wireformat.WireFormat; */ public final class OpenWireFormat implements WireFormat { - public static final int DEFAULT_VERSION = CommandTypes.PROTOCOL_VERSION; + public static final int DEFAULT_VERSION = CommandTypes.PROTOCOL_STORE_VERSION; static final byte NULL_TYPE = CommandTypes.NULL; private static final int MARSHAL_CACHE_SIZE = Short.MAX_VALUE / 2; diff --git a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java index cfb4e40355..083c155484 100755 --- a/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/openwire/OpenWireFormatFactory.java @@ -16,6 +16,7 @@ */ package org.apache.activemq.openwire; +import org.apache.activemq.command.CommandTypes; import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.wireformat.WireFormat; import org.apache.activemq.wireformat.WireFormatFactory; @@ -30,7 +31,7 @@ public class OpenWireFormatFactory implements WireFormatFactory { // default negotiation. // - private int version = OpenWireFormat.DEFAULT_VERSION; + private int version = CommandTypes.PROTOCOL_VERSION; private boolean stackTraceEnabled = true; private boolean tcpNoDelayEnabled = true; private boolean cacheEnabled = true; @@ -59,7 +60,7 @@ public class OpenWireFormatFactory implements WireFormatFactory { throw ise; } - OpenWireFormat f = new OpenWireFormat(); + OpenWireFormat f = new OpenWireFormat(version); f.setPreferedWireFormatInfo(info); return f; }