diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2009-08-03 13:19:45 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2009-08-03 13:19:45 +0000 |
| commit | 51d6a9b674fce5be467e67681f9198ead2b5f5b8 (patch) | |
| tree | f6a5cc824ae95980bedc593affeab5c0d6ba514a /qpid/java | |
| parent | cef7932c4e2adfa3a0c71a2baecb2661c236a632 (diff) | |
| download | qpid-python-51d6a9b674fce5be467e67681f9198ead2b5f5b8.tar.gz | |
QPID-2001 : Update based on feedback from Marnie to be mindful of the impact of message creation.
Messages that do not need a message formatter now nolonger use the message formater.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@800358 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm b/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm index 917901a18b..10be2299e9 100644 --- a/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm +++ b/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm @@ -106,14 +106,26 @@ public class ${type.name}Messages public static LogMessage ${message.methodName}(#foreach($parameter in ${message.parameters})${parameter.type} ${parameter.name}#if (${velocityCount} != ${message.parameters.size()} ), #end #end#if(${message.parameters.size()} > 0 && ${message.options.size()} > 0), #end#foreach($option in ${message.options})boolean ${option.name}#if (${velocityCount} != ${message.options.size()} ), #end#end) { +## +## If we don't have any parameters then we don't need the overhead of using the +## message formatter so we can just set our return message to the retreived +## fixed string. +## So we don't need to update the _formatter with the new pattern. +## +## Here we setup rawMessage to be the formatted message ready for direct return +## with the message.name or further processing to remove options. +## +#if(${message.parameters.size()} > 0) final Object[] messageArguments = {#foreach($parameter in ${message.parameters})${parameter.name}#if (${velocityCount} != ${message.parameters.size()} ), #end#end}; _formatter.applyPattern(_messages.getString("${message.name}")); - - ## If we have some options then we need to build the message based - ## on those values so only provide that logic if we need it. -#if(${message.options.size()} > 0) String rawMessage = _formatter.format(messageArguments); +#else + String rawMessage = _messages.getString("${message.name}"); +#end +## If we have some options then we need to build the message based +## on those values so only provide that logic if we need it. +#if(${message.options.size()} > 0) StringBuffer msg =new StringBuffer("${message.name} : "); // Split the formatted message up on the option values so we can @@ -124,8 +136,8 @@ public class ${type.name}Messages int end; if (parts.length > 1) { - ## For Each Optional value check if it has been enabled and then - ## append it to the log. +## For Each Optional value check if it has been enabled and then +## append it to the log. #foreach($option in ${message.options}) // Add Option : ${option.value} @@ -142,8 +154,8 @@ public class ${type.name}Messages final String message = msg.toString(); #else - ## If we have no options then we can just format and set the log - final String message = "${message.name} : " + _formatter.format(messageArguments); +## If we have no options then we can just format and set the log + final String message = "${message.name} : " + rawMessage; #end return new LogMessage() |
