ARTEMIS-4576 ServerSessionImpl#updateProducerMetrics access large messages after being routed
This commit is contained in:
parent
3dd50f8ff1
commit
6f6c5723d5
|
@ -2357,11 +2357,15 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
routingContext.setAddress(art.getName());
|
||||
routingContext.setRoutingType(art.getRoutingType());
|
||||
|
||||
// Retrieve message size for metrics update before routing,
|
||||
// since large message backing files may be closed once routing completes
|
||||
int mSize = msg instanceof LargeServerMessageImpl ? ((LargeServerMessageImpl)msg).getBodyBufferSize() : msg.getEncodeSize();
|
||||
|
||||
result = postOffice.route(msg, routingContext, direct);
|
||||
|
||||
logger.debug("Routing result for {} = {}", msg, result);
|
||||
|
||||
updateProducerMetrics(msg, senderName);
|
||||
updateProducerMetrics(msg, senderName, mSize);
|
||||
} finally {
|
||||
if (!routingContext.isReusable()) {
|
||||
routingContext.clear();
|
||||
|
@ -2520,10 +2524,10 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
|
|||
return "ServerSession [id=" + getConnectionID() + ":" + getName() + "]";
|
||||
}
|
||||
|
||||
private void updateProducerMetrics(Message msg, String senderName) {
|
||||
private void updateProducerMetrics(Message msg, String senderName, int mSize) {
|
||||
ServerProducer serverProducer = serverProducers.getServerProducer(senderName, msg, this);
|
||||
if (serverProducer != null) {
|
||||
serverProducer.updateMetrics(msg.getUserID(), msg instanceof LargeServerMessageImpl ? ((LargeServerMessageImpl)msg).getBodyBufferSize() : msg.getEncodeSize());
|
||||
serverProducer.updateMetrics(msg.getUserID(), mSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue