QPID-8091: [Broker-J] Transaction timeout - move idle/open warning message from channel to connection
(cherry picked from commit 876bcb7af979dbf6a4c128d762d2fc507e1580f2) Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/2cd03738 Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/2cd03738 Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/2cd03738 Branch: refs/heads/7.0.x Commit: 2cd03738c4ff09f8306678e89ac061032012c26b Parents: 8ee099a Author: Keith Wall <kw...@apache.org> Authored: Fri Feb 9 12:56:41 2018 +0000 Committer: Alex Rudyy <oru...@apache.org> Committed: Mon Feb 19 23:19:57 2018 +0000 ---------------------------------------------------------------------- .../logging/messages/ChannelMessages.java | 124 ------------------- .../messages/Channel_logmessages.properties | 4 - .../logging/messages/ConnectionMessages.java | 124 +++++++++++++++++++ .../messages/Connection_logmessages.properties | 3 +- .../transport/AbstractAMQPConnection.java | 5 +- 5 files changed, 128 insertions(+), 132 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2cd03738/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java ---------------------------------------------------------------------- diff --git a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java index 2acac26..9907a4c 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java +++ b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ChannelMessages.java @@ -73,8 +73,6 @@ public class ChannelMessages public static final String FLOW_CONTROL_IGNORED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_control_ignored"; public static final String FLOW_ENFORCED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_enforced"; public static final String FLOW_REMOVED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.flow_removed"; - public static final String IDLE_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.idle_txn"; - public static final String OPEN_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.open_txn"; public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.operation"; public static final String PREFETCH_SIZE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "channel.prefetch_size"; @@ -91,8 +89,6 @@ public class ChannelMessages LoggerFactory.getLogger(FLOW_CONTROL_IGNORED_LOG_HIERARCHY); LoggerFactory.getLogger(FLOW_ENFORCED_LOG_HIERARCHY); LoggerFactory.getLogger(FLOW_REMOVED_LOG_HIERARCHY); - LoggerFactory.getLogger(IDLE_TXN_LOG_HIERARCHY); - LoggerFactory.getLogger(OPEN_TXN_LOG_HIERARCHY); LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); LoggerFactory.getLogger(PREFETCH_SIZE_LOG_HIERARCHY); @@ -681,126 +677,6 @@ public class ChannelMessages /** * Log a Channel message of the Format: - * <pre>CHN-1008 : Idle Transaction : {0,number} ms</pre> - * Optional values are contained in [square brackets] and are numbered - * sequentially in the method call. - * - */ - public static LogMessage IDLE_TXN(Number param1) - { - String rawMessage = _messages.getString("IDLE_TXN"); - - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); - - final String message = formatter.format(messageArguments); - - return new LogMessage() - { - @Override - public String toString() - { - return message; - } - - @Override - public String getLogHierarchy() - { - return IDLE_TXN_LOG_HIERARCHY; - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final LogMessage that = (LogMessage) o; - - return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); - - } - - @Override - public int hashCode() - { - int result = toString().hashCode(); - result = 31 * result + getLogHierarchy().hashCode(); - return result; - } - }; - } - - /** - * Log a Channel message of the Format: - * <pre>CHN-1007 : Open Transaction : {0,number} ms</pre> - * Optional values are contained in [square brackets] and are numbered - * sequentially in the method call. - * - */ - public static LogMessage OPEN_TXN(Number param1) - { - String rawMessage = _messages.getString("OPEN_TXN"); - - final Object[] messageArguments = {param1}; - // Create a new MessageFormat to ensure thread safety. - // Sharing a MessageFormat and using applyPattern is not thread safe - MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); - - final String message = formatter.format(messageArguments); - - return new LogMessage() - { - @Override - public String toString() - { - return message; - } - - @Override - public String getLogHierarchy() - { - return OPEN_TXN_LOG_HIERARCHY; - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final LogMessage that = (LogMessage) o; - - return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); - - } - - @Override - public int hashCode() - { - int result = toString().hashCode(); - result = 31 * result + getLogHierarchy().hashCode(); - return result; - } - }; - } - - /** - * Log a Channel message of the Format: * <pre>CHN-1014 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2cd03738/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties ---------------------------------------------------------------------- diff --git a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties index fda86b7..cfef211 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties +++ b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Channel_logmessages.properties @@ -30,10 +30,6 @@ PREFETCH_SIZE = CHN-1004 : Prefetch Size (bytes) {0,number} : Count {1,number} # 0 - queue causing flow control FLOW_ENFORCED = CHN-1005 : Flow Control Enforced (Queue {0}) FLOW_REMOVED = CHN-1006 : Flow Control Removed -# Channel Transactions -# 0 - time in milliseconds -OPEN_TXN = CHN-1007 : Open Transaction : {0,number} ms -IDLE_TXN = CHN-1008 : Idle Transaction : {0,number} ms DISCARDMSG_NOALTEXCH = CHN-1009 : Discarded message : {0,number} as no alternate binding configured for queue : {1} routing key : {2} DISCARDMSG_NOROUTE = CHN-1010 : Discarded message : {0,number} as alternate binding yields no routes : {1} http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2cd03738/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java ---------------------------------------------------------------------- diff --git a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java index 6b2ef11..7b5d404 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java +++ b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java @@ -68,9 +68,11 @@ public class ConnectionMessages public static final String CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.close"; public static final String DROPPED_CONNECTION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.dropped_connection"; public static final String IDLE_CLOSE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.idle_close"; + public static final String IDLE_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.idle_txn"; public static final String LARGE_TRANSACTION_WARN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.large_transaction_warn"; public static final String MODEL_DELETE_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.model_delete"; public static final String OPEN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.open"; + public static final String OPEN_TXN_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.open_txn"; public static final String OPERATION_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "connection.operation"; static @@ -81,9 +83,11 @@ public class ConnectionMessages LoggerFactory.getLogger(CLOSE_LOG_HIERARCHY); LoggerFactory.getLogger(DROPPED_CONNECTION_LOG_HIERARCHY); LoggerFactory.getLogger(IDLE_CLOSE_LOG_HIERARCHY); + LoggerFactory.getLogger(IDLE_TXN_LOG_HIERARCHY); LoggerFactory.getLogger(LARGE_TRANSACTION_WARN_LOG_HIERARCHY); LoggerFactory.getLogger(MODEL_DELETE_LOG_HIERARCHY); LoggerFactory.getLogger(OPEN_LOG_HIERARCHY); + LoggerFactory.getLogger(OPEN_TXN_LOG_HIERARCHY); LoggerFactory.getLogger(OPERATION_LOG_HIERARCHY); _messages = ResourceBundle.getBundle("org.apache.qpid.server.logging.messages.Connection_logmessages", _currentLocale); @@ -432,6 +436,66 @@ public class ConnectionMessages /** * Log a Connection message of the Format: + * <pre>CHN-1011 : Idle Transaction : {0,number} ms</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage IDLE_TXN(Number param1) + { + String rawMessage = _messages.getString("IDLE_TXN"); + + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); + + return new LogMessage() + { + @Override + public String toString() + { + return message; + } + + @Override + public String getLogHierarchy() + { + return IDLE_TXN_LOG_HIERARCHY; + } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } + + /** + * Log a Connection message of the Format: * <pre>CON-1009 : Uncommitted transaction(s) contains {0,number} bytes of incoming message data exceeding {1,number} bytes limit. Messages will be flowed to disk.</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. @@ -660,6 +724,66 @@ public class ConnectionMessages /** * Log a Connection message of the Format: + * <pre>CON-1010 : Open Transaction : {0,number} ms</pre> + * Optional values are contained in [square brackets] and are numbered + * sequentially in the method call. + * + */ + public static LogMessage OPEN_TXN(Number param1) + { + String rawMessage = _messages.getString("OPEN_TXN"); + + final Object[] messageArguments = {param1}; + // Create a new MessageFormat to ensure thread safety. + // Sharing a MessageFormat and using applyPattern is not thread safe + MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); + + final String message = formatter.format(messageArguments); + + return new LogMessage() + { + @Override + public String toString() + { + return message; + } + + @Override + public String getLogHierarchy() + { + return OPEN_TXN_LOG_HIERARCHY; + } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } + }; + } + + /** + * Log a Connection message of the Format: * <pre>CON-1008 : Operation : {0}</pre> * Optional values are contained in [square brackets] and are numbered * sequentially in the method call. http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2cd03738/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties ---------------------------------------------------------------------- diff --git a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties index f66a04c..a2c6e6a 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties +++ b/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties @@ -28,4 +28,5 @@ MODEL_DELETE = CON-1007 : Connection close initiated by operator # 0 - operation name OPERATION = CON-1008 : Operation : {0} LARGE_TRANSACTION_WARN = CON-1009 : Uncommitted transaction(s) contains {0,number} bytes of incoming message data exceeding {1,number} bytes limit. Messages will be flowed to disk. - +OPEN_TXN = CON-1010 : Open Transaction : {0,number} ms +IDLE_TXN = CHN-1011 : Idle Transaction : {0,number} ms \ No newline at end of file http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/2cd03738/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java ---------------------------------------------------------------------- diff --git a/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java b/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java index ab4fcd9..eefefc7 100644 --- a/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java +++ b/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java @@ -54,7 +54,6 @@ import org.apache.qpid.server.connection.ConnectionPrincipal; import org.apache.qpid.server.logging.EventLogger; import org.apache.qpid.server.logging.EventLoggerProvider; import org.apache.qpid.server.logging.LogSubject; -import org.apache.qpid.server.logging.messages.ChannelMessages; import org.apache.qpid.server.logging.messages.ConnectionMessages; import org.apache.qpid.server.logging.subjects.ConnectionLogSubject; import org.apache.qpid.server.model.AbstractConfiguredObject; @@ -920,7 +919,7 @@ public abstract class AbstractAMQPConnection<C extends AbstractAMQPConnection<C, tickers.add(new TransactionTimeoutTicker( virtualhost.getStoreTransactionOpenTimeoutWarn(), notificationRepeatPeriod, serverTransaction::getTransactionStartTime, - age -> eventLogger.message(getLogSubject(), ChannelMessages.OPEN_TXN(age)) + age -> eventLogger.message(getLogSubject(), ConnectionMessages.OPEN_TXN(age)) )); } if (virtualhost.getStoreTransactionOpenTimeoutClose() > 0) @@ -935,7 +934,7 @@ public abstract class AbstractAMQPConnection<C extends AbstractAMQPConnection<C, tickers.add(new TransactionTimeoutTicker( virtualhost.getStoreTransactionIdleTimeoutWarn(), notificationRepeatPeriod, serverTransaction::getTransactionUpdateTime, - age -> eventLogger.message(getLogSubject(), ChannelMessages.IDLE_TXN(age)) + age -> eventLogger.message(getLogSubject(), ConnectionMessages.IDLE_TXN(age)) )); } if (virtualhost.getStoreTransactionIdleTimeoutClose() > 0) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org