ARTEMIS-3061 AMQPMessage::getDuplicateProperty can save key comparisons and class checks

This commit is contained in:
franz1981 2021-01-11 17:59:33 +01:00 committed by Clebert Suconic
parent cfc56a84ad
commit dc68d2e08f
1 changed files with 16 additions and 10 deletions

View File

@ -1018,7 +1018,7 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
return null;
}
}
return getObjectProperty(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID);
return getApplicationObjectProperty(org.apache.activemq.artemis.api.core.Message.HDR_DUPLICATE_DETECTION_ID.toString());
}
@Override
@ -1382,19 +1382,25 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
}
} else {
return getApplicationObjectProperty(key);
}
return null;
}
private Object getApplicationObjectProperty(String key) {
Object value = getApplicationPropertiesMap(false).get(key);
if (value instanceof Number) {
// slow path
if (value instanceof UnsignedInteger ||
value instanceof UnsignedByte ||
value instanceof UnsignedLong ||
value instanceof UnsignedShort) {
return ((Number) value).longValue();
} else {
}
}
return value;
}
}
return null;
}
@Override
public final Short getShortProperty(String key) throws ActiveMQPropertyConversionException {