ARTEMIS-3061 AMQPMessage::getDuplicateProperty can save key comparisons and class checks
This commit is contained in:
parent
cfc56a84ad
commit
dc68d2e08f
|
@ -1018,7 +1018,7 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
||||||
return null;
|
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
|
@Override
|
||||||
|
@ -1382,20 +1382,26 @@ public abstract class AMQPMessage extends RefCountMessage implements org.apache.
|
||||||
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Object value = getApplicationPropertiesMap(false).get(key);
|
return getApplicationObjectProperty(key);
|
||||||
if (value instanceof UnsignedInteger ||
|
|
||||||
value instanceof UnsignedByte ||
|
|
||||||
value instanceof UnsignedLong ||
|
|
||||||
value instanceof UnsignedShort) {
|
|
||||||
return ((Number)value).longValue();
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Short getShortProperty(String key) throws ActiveMQPropertyConversionException {
|
public final Short getShortProperty(String key) throws ActiveMQPropertyConversionException {
|
||||||
return (Short) getApplicationPropertiesMap(false).get(key);
|
return (Short) getApplicationPropertiesMap(false).get(key);
|
||||||
|
|
Loading…
Reference in New Issue