Search in sources :

Example 66 with LogMessage

use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.

the class ManagementConsoleMessages method READY.

/**
 * Log a ManagementConsole message of the Format:
 * <pre>MNG-1004 : {0} Management Ready</pre>
 * Optional values are contained in [square brackets] and are numbered
 * sequentially in the method call.
 */
public static LogMessage READY(String param1) {
    String rawMessage = _messages.getString("READY");
    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 READY_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;
        }
    };
}
Also used : MessageFormat(java.text.MessageFormat) LogMessage(org.apache.qpid.server.logging.LogMessage)

Example 67 with LogMessage

use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.

the class ManagementConsoleMessages method STOPPED.

/**
 * Log a ManagementConsole message of the Format:
 * <pre>MNG-1005 : {0} Management Stopped</pre>
 * Optional values are contained in [square brackets] and are numbered
 * sequentially in the method call.
 */
public static LogMessage STOPPED(String param1) {
    String rawMessage = _messages.getString("STOPPED");
    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 STOPPED_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;
        }
    };
}
Also used : MessageFormat(java.text.MessageFormat) LogMessage(org.apache.qpid.server.logging.LogMessage)

Example 68 with LogMessage

use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.

the class MessageStoreMessages method RECOVERED.

/**
 * Log a MessageStore message of the Format:
 * <pre>MST-1005 : Recovered {0,number} messages</pre>
 * Optional values are contained in [square brackets] and are numbered
 * sequentially in the method call.
 */
public static LogMessage RECOVERED(Number param1) {
    String rawMessage = _messages.getString("RECOVERED");
    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 RECOVERED_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;
        }
    };
}
Also used : MessageFormat(java.text.MessageFormat) LogMessage(org.apache.qpid.server.logging.LogMessage)

Example 69 with LogMessage

use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.

the class MessageStoreMessages method OVERFULL.

/**
 * Log a MessageStore message of the Format:
 * <pre>MST-1008 : Store overfull, flow control will be enforced</pre>
 * Optional values are contained in [square brackets] and are numbered
 * sequentially in the method call.
 */
public static LogMessage OVERFULL() {
    String rawMessage = _messages.getString("OVERFULL");
    final String message = rawMessage;
    return new LogMessage() {

        @Override
        public String toString() {
            return message;
        }

        @Override
        public String getLogHierarchy() {
            return OVERFULL_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;
        }
    };
}
Also used : LogMessage(org.apache.qpid.server.logging.LogMessage)

Example 70 with LogMessage

use of org.apache.qpid.server.logging.LogMessage in project qpid-broker-j by apache.

the class AMQChannel method close.

public void close(int cause, String message) {
    if (!_closing.compareAndSet(false, true)) {
        // Channel is already closing
        return;
    }
    try {
        unsubscribeAllConsumers();
        setDefaultQueue(null);
        for (Action<? super AMQChannel> task : _taskList) {
            task.performAction(this);
        }
        if (_transaction instanceof LocalTransaction) {
            if (((LocalTransaction) _transaction).hasOutstandingWork()) {
                _connection.incrementTransactionRollbackCounter();
            }
            _connection.decrementTransactionOpenCounter();
            _connection.unregisterTransactionTickers(_transaction);
        }
        _transaction.rollback();
        requeue();
    } finally {
        dispose();
        LogMessage operationalLogMessage = cause == 0 ? ChannelMessages.CLOSE() : ChannelMessages.CLOSE_FORCED(cause, message);
        messageWithSubject(operationalLogMessage);
    }
}
Also used : LocalTransaction(org.apache.qpid.server.txn.LocalTransaction) LogMessage(org.apache.qpid.server.logging.LogMessage)

Aggregations

LogMessage (org.apache.qpid.server.logging.LogMessage)152 MessageFormat (java.text.MessageFormat)105 LogMessageMatcher (org.apache.qpid.server.queue.ProducerFlowControlOverflowPolicyHandlerTest.LogMessageMatcher)2 LocalTransaction (org.apache.qpid.server.txn.LocalTransaction)2 Subject (javax.security.auth.Subject)1 ConnectionPrincipal (org.apache.qpid.server.connection.ConnectionPrincipal)1 EventLogger (org.apache.qpid.server.logging.EventLogger)1 LogSubject (org.apache.qpid.server.logging.LogSubject)1 UnitTestMessageLogger (org.apache.qpid.server.logging.UnitTestMessageLogger)1 AuthenticationResult (org.apache.qpid.server.security.auth.AuthenticationResult)1 SubjectAuthenticationResult (org.apache.qpid.server.security.auth.SubjectAuthenticationResult)1 DistributedTransaction (org.apache.qpid.server.txn.DistributedTransaction)1