diff --git a/.RELEASING.md.swp b/.RELEASING.md.swp deleted file mode 100644 index 9e088753f2..0000000000 Binary files a/.RELEASING.md.swp and /dev/null differ diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageSymbolSearch.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageSymbolSearch.java index 71b9880c71..eaf05ca972 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageSymbolSearch.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessageSymbolSearch.java @@ -37,15 +37,22 @@ import org.apache.qpid.proton.codec.TypeConstructor; final class AMQPMessageSymbolSearch { // used to quick search for MessageAnnotations - private static final IdentityHashMap, Boolean> MSG_BODY_TYPES; + private static final IdentityHashMap, Boolean> MSG_ANNOTATIONS_STOPSET; + private static final IdentityHashMap, Boolean> APPLICATION_PROPERTIES_STOPSET; static { // we're including MessageAnnotations here because it will still cause termination - final List> classList = Arrays.asList(MessageAnnotations.class, Properties.class, - ApplicationProperties.class, Data.class, - AmqpSequence.class, AmqpValue.class, Footer.class); - MSG_BODY_TYPES = new IdentityHashMap<>(classList.size()); - classList.forEach(clazz -> MSG_BODY_TYPES.put(clazz, Boolean.TRUE)); + List> classList = Arrays.asList(MessageAnnotations.class, Properties.class, + ApplicationProperties.class, Data.class, + AmqpSequence.class, AmqpValue.class, Footer.class); + MSG_ANNOTATIONS_STOPSET = new IdentityHashMap<>(classList.size()); + classList.forEach(clazz -> MSG_ANNOTATIONS_STOPSET.put(clazz, Boolean.TRUE)); + + // we're including ApplicationProperties here because it will still cause termination + classList = Arrays.asList(ApplicationProperties.class, Data.class, + AmqpSequence.class, AmqpValue.class, Footer.class); + APPLICATION_PROPERTIES_STOPSET = new IdentityHashMap<>(classList.size()); + classList.forEach(clazz -> APPLICATION_PROPERTIES_STOPSET.put(clazz, Boolean.TRUE)); } public static KMPNeedle kmpNeedleOf(Symbol symbol) { @@ -58,14 +65,14 @@ final class AMQPMessageSymbolSearch { public static boolean anyMessageAnnotations(final ReadableBuffer data, final KMPNeedle[] needles) { - return lookupOnSection(MessageAnnotations.class, data, needles, 0); + return lookupOnSection(MSG_ANNOTATIONS_STOPSET, MessageAnnotations.class, data, needles, 0); } public static boolean anyApplicationProperties(final ReadableBuffer data, final KMPNeedle[] needles, int startAt) { - return lookupOnSection(ApplicationProperties.class, data, needles, startAt); + return lookupOnSection(APPLICATION_PROPERTIES_STOPSET, ApplicationProperties.class, data, needles, startAt); } - private static boolean lookupOnSection(final Class section, final ReadableBuffer data, final KMPNeedle[] needles, final int startAt) { + private static boolean lookupOnSection(IdentityHashMap, Boolean> stopSet, final Class section, final ReadableBuffer data, final KMPNeedle[] needles, final int startAt) { DecoderImpl decoder = TLSEncode.getDecoder(); final int position = data.position(); decoder.setBuffer(data.position(startAt)); @@ -73,7 +80,7 @@ final class AMQPMessageSymbolSearch { while (data.hasRemaining()) { TypeConstructor constructor = decoder.readConstructor(); final Class typeClass = constructor.getTypeClass(); - if (MSG_BODY_TYPES.containsKey(typeClass)) { + if (MSG_ANNOTATIONS_STOPSET.containsKey(typeClass)) { if (section.equals(typeClass)) { final int start = data.position(); constructor.skipValue();