From 6e9e80facaff2c5ae97f669c10092680adaccff2 Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Fri, 15 Aug 2014 00:49:26 +0000 Subject: QPID-5998: Fix HA operational logging git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1618086 13f79535-47bb-0310-9956-ffa450edef68 --- .../subjects/BDBHAVirtualHostNodeLogSubject.java | 32 +++++ .../server/logging/subjects/GroupLogSubject.java | 32 +++++ .../berkeleydb/BDBHARemoteReplicationNodeImpl.java | 49 ++++--- .../berkeleydb/BDBHAVirtualHostNodeImpl.java | 152 ++++++++++++++------- .../berkeleydb/BDBHARemoteReplicationNodeTest.java | 6 +- ...BDBHAVirtualHostNodeOperationalLoggingTest.java | 140 +++---------------- .../logging/messages/HighAvailabilityMessages.java | 137 +++++++++---------- .../HighAvailability_logmessages.properties | 55 ++++++-- .../server/logging/subjects/LogSubjectFormat.java | 1 - .../subjects/VirtualHostNodeLogSubject.java | 33 ----- .../virtualhostnode/AbstractVirtualHostNode.java | 7 - 11 files changed, 321 insertions(+), 323 deletions(-) create mode 100644 qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/BDBHAVirtualHostNodeLogSubject.java create mode 100644 qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/GroupLogSubject.java delete mode 100644 qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/VirtualHostNodeLogSubject.java (limited to 'qpid/java') diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/BDBHAVirtualHostNodeLogSubject.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/BDBHAVirtualHostNodeLogSubject.java new file mode 100644 index 0000000000..a209062993 --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/BDBHAVirtualHostNodeLogSubject.java @@ -0,0 +1,32 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.logging.subjects; + + +public class BDBHAVirtualHostNodeLogSubject extends AbstractLogSubject +{ + public static final String VIRTUAL_HOST_NODE_FORMAT = "grp(/{0})/vhn(/{1})"; + + public BDBHAVirtualHostNodeLogSubject(String groupName, String nodeName) + { + setLogStringWithFormat(VIRTUAL_HOST_NODE_FORMAT, groupName, nodeName); + } +} diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/GroupLogSubject.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/GroupLogSubject.java new file mode 100644 index 0000000000..51fd1fc2dc --- /dev/null +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/subjects/GroupLogSubject.java @@ -0,0 +1,32 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.logging.subjects; + + +public class GroupLogSubject extends AbstractLogSubject +{ + public static final String GROUP_FORMAT = "grp(/{0})"; + + public GroupLogSubject(String groupName) + { + setLogStringWithFormat(GROUP_FORMAT, groupName); + } +} diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java index 5263f5942f..06671998ec 100644 --- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java +++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java @@ -30,9 +30,14 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import com.sleepycat.je.rep.MasterStateException; +import com.sleepycat.je.rep.ReplicatedEnvironment; import org.apache.log4j.Logger; import org.apache.qpid.server.configuration.IllegalConfigurationException; +import org.apache.qpid.server.logging.EventLogger; +import org.apache.qpid.server.logging.messages.HighAvailabilityMessages; +import org.apache.qpid.server.logging.subjects.BDBHAVirtualHostNodeLogSubject; +import org.apache.qpid.server.logging.subjects.GroupLogSubject; import org.apache.qpid.server.model.AbstractConfiguredObject; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ConfiguredObject; @@ -40,6 +45,8 @@ import org.apache.qpid.server.model.IllegalStateTransitionException; import org.apache.qpid.server.model.ManagedAttributeField; import org.apache.qpid.server.model.State; import org.apache.qpid.server.model.StateTransition; +import org.apache.qpid.server.model.SystemConfig; +import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.security.access.Operation; import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade; @@ -53,13 +60,16 @@ public class BDBHARemoteReplicationNodeImpl extends AbstractConfiguredObject _state; private final boolean _isMonitor; private boolean _detached; + private BDBHAVirtualHostNodeLogSubject _virtualHostNodeLogSubject; + private GroupLogSubject _groupLogSubject; public BDBHARemoteReplicationNodeImpl(BDBHAVirtualHostNode virtualHostNode, Map attributes, ReplicatedEnvironmentFacade replicatedEnvironmentFacade) { @@ -92,7 +102,7 @@ public class BDBHARemoteReplicationNodeImpl extends AbstractConfiguredObject { public static final String VIRTUAL_HOST_NODE_TYPE = "BDB_HA"; + public static final String VIRTUAL_HOST_PRINCIPAL_NAME_FORMAT = "grp(/{0})/vhn(/{1})"; /** * Length of time we synchronously await the a JE mutation to complete. It is not considered an error if we exceed this timeout, although a @@ -87,6 +91,9 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode _environmentFacade = new AtomicReference<>(); private final AtomicReference _lastReplicatedEnvironmentState = new AtomicReference<>(ReplicatedEnvironment.State.UNKNOWN); + private BDBHAVirtualHostNodeLogSubject _virtualHostNodeLogSubject; + private GroupLogSubject _groupLogSubject; + private String _virtualHostNodePrincipalName; @ManagedAttributeField private String _storePath; @@ -267,7 +274,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode helpers = getRemoteNodeAddresses(); super.doDelete(); - getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DELETED(getName(), getGroupName())); + getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DELETED()); if (getState() == State.DELETED && !helpers.isEmpty()) { try @@ -413,10 +401,18 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode() + getTaskExecutor().submit(new VirtualHostNodeGroupTask() { @Override - public Void execute() + public void perform() { addRemoteReplicationNode(node); - return null; } }); } @@ -722,19 +726,18 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode() + getTaskExecutor().submit(new VirtualHostNodeGroupTask() { @Override - public Void execute() + public void perform() { recoverRemoteReplicationNode(node); - return null; } }); } @@ -745,19 +748,18 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode() + getTaskExecutor().submit(new VirtualHostNodeGroupTask() { @Override - public Void execute() + public void perform() { removeRemoteReplicationNode(node); - return null; } }); } @@ -768,12 +770,25 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode() + { + @Override + public Void run() + { + processNodeState(node, nodeState); + return null; + } + }); + } + + private void processNodeState(ReplicationNode node, NodeState nodeState) { BDBHARemoteReplicationNodeImpl remoteNode = getChildByName(BDBHARemoteReplicationNodeImpl.class, node.getName()); if (remoteNode != null) @@ -785,7 +800,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode() + { + @Override + public Void run() + { + processIntruderNode(node); + return null; + } + }); + } + + private void processIntruderNode(ReplicationNode node) { String hostAndPort = node.getHostName() + ":" + node.getPort(); - getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), hostAndPort, getGroupName())); + getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.INTRUDER_DETECTED(node.getName(), hostAndPort)); boolean inManagementMode = getParent(Broker.class).isManagementMode(); if (inManagementMode) @@ -858,7 +885,7 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode nodeToAttributes(ReplicationNode replicationNode) @@ -872,4 +899,23 @@ public class BDBHAVirtualHostNodeImpl extends AbstractVirtualHostNode + { + @Override + public Void execute() + { + return Subject.doAs(SecurityManager.getSystemTaskSubject(_virtualHostNodePrincipalName), new PrivilegedAction() + { + @Override + public Void run() + { + perform(); + return null; + } + }); + } + + abstract void perform(); + } + } diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java index 6259b49d61..0d64d87aef 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java @@ -19,6 +19,7 @@ package org.apache.qpid.server.virtualhostnode.berkeleydb; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; @@ -33,6 +34,7 @@ import org.apache.qpid.server.configuration.updater.TaskExecutor; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ConfiguredObjectFactory; import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.server.model.VirtualHostNode; import org.apache.qpid.server.security.SecurityManager; import org.apache.qpid.server.security.access.Operation; import org.apache.qpid.server.store.DurableConfigurationStore; @@ -69,7 +71,7 @@ public class BDBHARemoteReplicationNodeTest extends QpidTestCase // Virtualhost needs the EventLogger from the SystemContext. when(_virtualHostNode.getParent(Broker.class)).thenReturn(_broker); - + doReturn(VirtualHostNode.class).when(_virtualHostNode).getCategoryClass(); ConfiguredObjectFactory objectFactory = _broker.getObjectFactory(); when(_virtualHostNode.getModel()).thenReturn(objectFactory.getModel()); when(_virtualHostNode.getTaskExecutor()).thenReturn(_taskExecutor); @@ -80,7 +82,7 @@ public class BDBHARemoteReplicationNodeTest extends QpidTestCase String remoteReplicationName = getName(); BDBHARemoteReplicationNode remoteReplicationNode = createRemoteReplicationNode(remoteReplicationName); - remoteReplicationNode.setAttribute(BDBHARemoteReplicationNode.ROLE, null, "MASTER"); + remoteReplicationNode.setAttribute(BDBHARemoteReplicationNode.ROLE, "UNKNOWN", "MASTER"); verify(_facade).transferMasterAsynchronously(remoteReplicationName); } diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java index ef1021160c..ea7d74090d 100644 --- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java +++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java @@ -78,67 +78,18 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase _helper.assertNodeRole(node1, "MASTER"); - String expectedMessage = HighAvailabilityMessages.ADDED(node1.getName(), node1.getGroupName()).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.ADDED_LOG_HIERARCHY))); - - expectedMessage = HighAvailabilityMessages.ATTACHED(node1.getName(), node1.getGroupName(), "UNKNOWN").toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.ATTACHED_LOG_HIERARCHY))); + assertEquals("Unexpected VHN log subject", "[grp(/group)/vhn(/node1)] ", node1.getVirtualHostNodeLogSubject().getLogString()); + assertEquals("Unexpected group log subject", "[grp(/group)] ", node1.getGroupLogSubject().getLogString()); - - expectedMessage = HighAvailabilityMessages.STARTED(node1.getName(), node1.getGroupName()).toString(); + String expectedMessage = HighAvailabilityMessages.CREATED().toString(); verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.STARTED_LOG_HIERARCHY))); + argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.CREATED_LOG_HIERARCHY))); - expectedMessage = HighAvailabilityMessages.ROLE_CHANGED(node1.getName(), node1.getGroupName(), "UNKNOWN", "MASTER").toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), + expectedMessage = HighAvailabilityMessages.ROLE_CHANGED(node1.getName(), node1.getAddress(), "UNKNOWN", "MASTER").toString(); + verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getGroupLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.ROLE_CHANGED_LOG_HIERARCHY))); } - public void testStop() throws Exception - { - int node1PortNumber = findFreePort(); - String helperAddress = "localhost:" + node1PortNumber; - String groupName = "group"; - String nodeName = "node1"; - - Map node1Attributes = _helper.createNodeAttributes(nodeName, groupName, helperAddress, helperAddress, nodeName, node1PortNumber); - BDBHAVirtualHostNodeImpl node1 = (BDBHAVirtualHostNodeImpl)_helper.createHaVHN(node1Attributes); - _helper.assertNodeRole(node1, "MASTER"); - reset(_eventLogger); - - node1.stop(); - - String expectedMessage = HighAvailabilityMessages.DETACHED(node1.getName(), node1.getGroupName()).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DETACHED_LOG_HIERARCHY))); - - expectedMessage = HighAvailabilityMessages.STOPPED(node1.getName(), node1.getGroupName()).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.STOPPED_LOG_HIERARCHY))); - } - - public void testClose() throws Exception - { - int node1PortNumber = findFreePort(); - String helperAddress = "localhost:" + node1PortNumber; - String groupName = "group"; - String nodeName = "node1"; - - Map node1Attributes = _helper.createNodeAttributes(nodeName, groupName, helperAddress, helperAddress, nodeName, node1PortNumber); - BDBHAVirtualHostNodeImpl node1 = (BDBHAVirtualHostNodeImpl)_helper.createHaVHN(node1Attributes); - _helper.assertNodeRole(node1, "MASTER"); - - reset(_eventLogger); - - node1.close(); - - String expectedMessage = HighAvailabilityMessages.DETACHED(node1.getName(), node1.getGroupName()).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DETACHED_LOG_HIERARCHY))); - } - public void testDelete() throws Exception { int node1PortNumber = findFreePort(); @@ -154,13 +105,10 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase node1.delete(); - String expectedMessage = HighAvailabilityMessages.DETACHED(node1.getName(), node1.getGroupName()).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DETACHED_LOG_HIERARCHY))); - - expectedMessage = HighAvailabilityMessages.DELETED(node1.getName(), node1.getGroupName()).toString(); + String expectedMessage = HighAvailabilityMessages.DELETED().toString(); verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DELETED_LOG_HIERARCHY))); + } public void testSetPriority() throws Exception @@ -181,7 +129,7 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase // make sure that task executor thread finishes all scheduled tasks node1.stop(); - String expectedMessage = HighAvailabilityMessages.PRIORITY_CHANGED(node1.getName(), node1.getGroupName(), "10").toString(); + String expectedMessage = HighAvailabilityMessages.PRIORITY_CHANGED("10").toString(); verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.PRIORITY_CHANGED_LOG_HIERARCHY))); } @@ -204,7 +152,7 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase // make sure that task executor thread finishes all scheduled tasks node1.stop(); - String expectedMessage = HighAvailabilityMessages.QUORUM_OVERRIDE_CHANGED(node1.getName(), node1.getGroupName(), "1").toString(); + String expectedMessage = HighAvailabilityMessages.QUORUM_OVERRIDE_CHANGED("1").toString(); verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY))); } @@ -227,7 +175,7 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase // make sure that task executor thread finishes all scheduled tasks node1.stop(); - String expectedMessage = HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED(node1.getName(), node1.getGroupName(), "true").toString(); + String expectedMessage = HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED("true").toString(); verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED_LOG_HIERARCHY))); } @@ -254,14 +202,9 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase // make sure that task executor thread finishes all scheduled tasks node2.stop(); - // Verify ADDED message from node2 when its created - String expectedMessage = HighAvailabilityMessages.ADDED(node2.getName(), groupName).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node2.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.ADDED_LOG_HIERARCHY))); - // Verify ADDED message from node1 when it discovers node2 has been added - expectedMessage = HighAvailabilityMessages.ADDED(node2.getName(), groupName).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), + String expectedMessage = HighAvailabilityMessages.ADDED(node2.getName(), node2.getAddress()).toString(); + verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getGroupLogSubject())), argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.ADDED_LOG_HIERARCHY))); } @@ -292,9 +235,9 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase // make sure that task executor thread finishes all scheduled tasks node1.stop(); - String expectedMessage = HighAvailabilityMessages.DELETED(node2.getName(), groupName).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DELETED_LOG_HIERARCHY))); + String expectedMessage = HighAvailabilityMessages.REMOVED(node2.getName(), node2.getAddress()).toString(); + verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getGroupLogSubject())), + argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.REMOVED_LOG_HIERARCHY))); } public void testRemoteNodeDetached() throws Exception @@ -324,9 +267,9 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase waitForNodeDetachedField(remoteNode, true); // verify that remaining node issues the DETACHED operational logging for remote node - String expectedMessage = HighAvailabilityMessages.DETACHED(node2.getName(), groupName).toString(); - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.DETACHED_LOG_HIERARCHY))); + String expectedMessage = HighAvailabilityMessages.LEFT(node2.getName(), node2.getAddress()).toString(); + verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getGroupLogSubject())), + argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.LEFT_LOG_HIERARCHY))); } @@ -361,48 +304,9 @@ public class BDBHAVirtualHostNodeOperationalLoggingTest extends QpidTestCase _helper.assertNodeRole(node2, "REPLICA", "MASTER"); waitForNodeDetachedField(remoteNode, false); - final String expectedMessage = HighAvailabilityMessages.ATTACHED(node2.getName(), groupName, "REPLICA").toString(); - final String expectedMessage2 = HighAvailabilityMessages.ATTACHED(node2.getName(), groupName, "UNKNOWN").toString(); - final String expectedMessage3 = HighAvailabilityMessages.ATTACHED(node2.getName(), groupName, "MASTER").toString(); - ArgumentMatcher matcher = new ArgumentMatcher() - { - private String _messageErrorDescription = null; - private String _hierarchyErrorDescription = null; - - @Override - public boolean matches(Object argument) - { - LogMessage logMessage = (LogMessage)argument; - String actualMessage = logMessage.toString(); - boolean expectedMessageMatches = expectedMessage.equals(actualMessage) - || expectedMessage2.equals(actualMessage) || expectedMessage3.equals(actualMessage); - if (!expectedMessageMatches) - { - _messageErrorDescription = "Actual message does not match any expected: " + actualMessage; - } - boolean expectedHierarchyMatches = HighAvailabilityMessages.ATTACHED_LOG_HIERARCHY.equals(logMessage.getLogHierarchy()); - if (!expectedHierarchyMatches) - { - _hierarchyErrorDescription = "Actual hierarchy does not match expected: " + logMessage.getLogHierarchy(); - } - return expectedMessageMatches && expectedHierarchyMatches; - } - - @Override - public void describeTo(Description description) - { - if (_messageErrorDescription != null) - { - description.appendText(_messageErrorDescription); - } - if (_hierarchyErrorDescription != null) - { - description.appendText(_hierarchyErrorDescription); - } - } - }; - verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getVirtualHostNodeLogSubject())), - argThat(matcher)); + final String expectedMessage = HighAvailabilityMessages.JOINED(node2.getName(), node2.getAddress()).toString(); + verify(_eventLogger).message(argThat(new LogSubjectMatcher(node1.getGroupLogSubject())), + argThat(new LogMessageMatcher(expectedMessage, HighAvailabilityMessages.JOINED_LOG_HIERARCHY))); } private void waitForNodeDetachedField(BDBHARemoteReplicationNodeImpl remoteNode, boolean expectedDetached) throws InterruptedException { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java index 9e497efcd2..b864a8c095 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java @@ -44,15 +44,15 @@ public class HighAvailabilityMessages private static Locale _currentLocale = BrokerProperties.getLocale(); public static final String HIGHAVAILABILITY_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability"; - public static final String STOPPED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.stopped"; public static final String INTRUDER_DETECTED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.intruder_detected"; - public static final String STARTED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.started"; public static final String TRANSFER_MASTER_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.transfer_master"; public static final String QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_override_changed"; - public static final String DETACHED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.detached"; - public static final String MAJORITY_LOST_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.majority_lost"; + public static final String REMOVED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.removed"; + public static final String LEFT_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.left"; + public static final String JOINED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.joined"; + public static final String CREATED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.created"; + public static final String QUORUM_LOST_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.quorum_lost"; public static final String PRIORITY_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.priority_changed"; - public static final String ATTACHED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.attached"; public static final String ADDED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.added"; public static final String DELETED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.deleted"; public static final String ROLE_CHANGED_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX + "highavailability.role_changed"; @@ -61,15 +61,15 @@ public class HighAvailabilityMessages static { Logger.getLogger(HIGHAVAILABILITY_LOG_HIERARCHY); - Logger.getLogger(STOPPED_LOG_HIERARCHY); Logger.getLogger(INTRUDER_DETECTED_LOG_HIERARCHY); - Logger.getLogger(STARTED_LOG_HIERARCHY); Logger.getLogger(TRANSFER_MASTER_LOG_HIERARCHY); Logger.getLogger(QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY); - Logger.getLogger(DETACHED_LOG_HIERARCHY); - Logger.getLogger(MAJORITY_LOST_LOG_HIERARCHY); + Logger.getLogger(REMOVED_LOG_HIERARCHY); + Logger.getLogger(LEFT_LOG_HIERARCHY); + Logger.getLogger(JOINED_LOG_HIERARCHY); + Logger.getLogger(CREATED_LOG_HIERARCHY); + Logger.getLogger(QUORUM_LOST_LOG_HIERARCHY); Logger.getLogger(PRIORITY_CHANGED_LOG_HIERARCHY); - Logger.getLogger(ATTACHED_LOG_HIERARCHY); Logger.getLogger(ADDED_LOG_HIERARCHY); Logger.getLogger(DELETED_LOG_HIERARCHY); Logger.getLogger(ROLE_CHANGED_LOG_HIERARCHY); @@ -80,14 +80,14 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - *
HA-1012 : The node ''{0}'' from the replication group ''{1}'' is stopped.
+ *
HA-1008 : Intruder detected : Node ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage STOPPED(String param1, String param2) + public static LogMessage INTRUDER_DETECTED(String param1, String param2) { - String rawMessage = _messages.getString("STOPPED"); + String rawMessage = _messages.getString("INTRUDER_DETECTED"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -105,23 +105,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return STOPPED_LOG_HIERARCHY; + return INTRUDER_DETECTED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1007: Intruder node ''{0}'' from ''{1}'' is detected in replication group ''{2}''
+ *
HA-1007 : Master transfer requested : to ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage INTRUDER_DETECTED(String param1, String param2, String param3) + public static LogMessage TRANSFER_MASTER(String param1, String param2) { - String rawMessage = _messages.getString("INTRUDER_DETECTED"); + String rawMessage = _messages.getString("TRANSFER_MASTER"); - final Object[] messageArguments = {param1, param2, param3}; + final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -137,23 +137,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return INTRUDER_DETECTED_LOG_HIERARCHY; + return TRANSFER_MASTER_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1013 : The node ''{0}'' from the replication group ''{1}'' is started.
+ *
HA-1011 : Minimum group  : {0}
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage STARTED(String param1, String param2) + public static LogMessage QUORUM_OVERRIDE_CHANGED(String param1) { - String rawMessage = _messages.getString("STARTED"); + String rawMessage = _messages.getString("QUORUM_OVERRIDE_CHANGED"); - final Object[] messageArguments = {param1, param2}; + 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); @@ -169,23 +169,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return STARTED_LOG_HIERARCHY; + return QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1014 : Transfer master to ''{0}'' is requested on node ''{1}'' from the replication group ''{2}''.
+ *
HA-1004 : Removed : Node : ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage TRANSFER_MASTER(String param1, String param2, String param3) + public static LogMessage REMOVED(String param1, String param2) { - String rawMessage = _messages.getString("TRANSFER_MASTER"); + String rawMessage = _messages.getString("REMOVED"); - final Object[] messageArguments = {param1, param2, param3}; + final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -201,23 +201,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return TRANSFER_MASTER_LOG_HIERARCHY; + return REMOVED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1009 : The quorum override attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.
+ *
HA-1006 : Left : Node : ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage QUORUM_OVERRIDE_CHANGED(String param1, String param2, String param3) + public static LogMessage LEFT(String param1, String param2) { - String rawMessage = _messages.getString("QUORUM_OVERRIDE_CHANGED"); + String rawMessage = _messages.getString("LEFT"); - final Object[] messageArguments = {param1, param2, param3}; + final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. // Sharing a MessageFormat and using applyPattern is not thread safe MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale); @@ -233,21 +233,21 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return QUORUM_OVERRIDE_CHANGED_LOG_HIERARCHY; + return LEFT_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1003 : The node ''{0}'' detached from the replication group ''{1}''.
+ *
HA-1005 : Joined : Node : ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DETACHED(String param1, String param2) + public static LogMessage JOINED(String param1, String param2) { - String rawMessage = _messages.getString("DETACHED"); + String rawMessage = _messages.getString("JOINED"); final Object[] messageArguments = {param1, param2}; // Create a new MessageFormat to ensure thread safety. @@ -265,28 +265,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return DETACHED_LOG_HIERARCHY; + return JOINED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1006 : A majority of nodes from replication group ''{0}'' is not available for node ''{1}''.
+ *
HA-1001 : Created
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage MAJORITY_LOST(String param1, String param2) + public static LogMessage CREATED() { - String rawMessage = _messages.getString("MAJORITY_LOST"); + String rawMessage = _messages.getString("CREATED"); - final Object[] messageArguments = {param1, param2}; - // 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); + final String message = rawMessage; return new LogMessage() { @@ -297,28 +292,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return MAJORITY_LOST_LOG_HIERARCHY; + return CREATED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1008 : The priority attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.
+ *
HA-1009 : Insufficient replicas contactable
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage PRIORITY_CHANGED(String param1, String param2, String param3) + public static LogMessage QUORUM_LOST() { - String rawMessage = _messages.getString("PRIORITY_CHANGED"); + String rawMessage = _messages.getString("QUORUM_LOST"); - final Object[] messageArguments = {param1, param2, param3}; - // 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); + final String message = rawMessage; return new LogMessage() { @@ -329,23 +319,23 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return PRIORITY_CHANGED_LOG_HIERARCHY; + return QUORUM_LOST_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1004 : The node ''{0}'' attached to the replication group ''{1}'' with role ''{2}''.
+ *
HA-1012 : Priority  : {0}
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage ATTACHED(String param1, String param2, String param3) + public static LogMessage PRIORITY_CHANGED(String param1) { - String rawMessage = _messages.getString("ATTACHED"); + String rawMessage = _messages.getString("PRIORITY_CHANGED"); - final Object[] messageArguments = {param1, param2, param3}; + 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); @@ -361,14 +351,14 @@ public class HighAvailabilityMessages public String getLogHierarchy() { - return ATTACHED_LOG_HIERARCHY; + return PRIORITY_CHANGED_LOG_HIERARCHY; } }; } /** * Log a HighAvailability message of the Format: - *
HA-1001 : A new node ''{0}'' is added into a replication group ''{1}''.
+ *
HA-1003 : Added : Node : ''{0}'' ({1})
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * @@ -400,21 +390,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - *
HA-1002 : An existing node ''{0}'' is removed from the replication group ''{1}''.
+ *
HA-1002 : Deleted
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DELETED(String param1, String param2) + public static LogMessage DELETED() { String rawMessage = _messages.getString("DELETED"); - final Object[] messageArguments = {param1, param2}; - // 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); + final String message = rawMessage; return new LogMessage() { @@ -432,7 +417,7 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - *
HA-1005 : The role of the node ''{0}'' from the replication group ''{1}'' has changed from ''{2}'' to ''{3}''.
+ *
HA-1010 : Role change reported: Node : ''{0}'' ({1}) : from ''{2}'' to ''{3}''
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * @@ -464,16 +449,16 @@ public class HighAvailabilityMessages /** * Log a HighAvailability message of the Format: - *
HA-1010 : The designated primary attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.
+ *
HA-1013 : Designated primary : {0}
* Optional values are contained in [square brackets] and are numbered * sequentially in the method call. * */ - public static LogMessage DESIGNATED_PRIMARY_CHANGED(String param1, String param2, String param3) + public static LogMessage DESIGNATED_PRIMARY_CHANGED(String param1) { String rawMessage = _messages.getString("DESIGNATED_PRIMARY_CHANGED"); - final Object[] messageArguments = {param1, param2, param3}; + 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); diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties index 94df7cc38b..3c5b0d260f 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties @@ -18,18 +18,47 @@ # # HA logging message i18n strings. -ADDED=HA-1001 : A new node ''{0}'' is added into a replication group ''{1}''. -DELETED=HA-1002 : An existing node ''{0}'' is removed from the replication group ''{1}''. -DETACHED=HA-1003 : The node ''{0}'' detached from the replication group ''{1}''. -ATTACHED=HA-1004 : The node ''{0}'' attached to the replication group ''{1}'' with role ''{2}''. -ROLE_CHANGED=HA-1005 : The role of the node ''{0}'' from the replication group ''{1}'' has changed from ''{2}'' to ''{3}''. -MAJORITY_LOST=HA-1006 : A majority of nodes from replication group ''{0}'' is not available for node ''{1}''. -INTRUDER_DETECTED=HA-1007: Intruder node ''{0}'' from ''{1}'' is detected in replication group ''{2}'' -PRIORITY_CHANGED=HA-1008 : The priority attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''. -QUORUM_OVERRIDE_CHANGED=HA-1009 : The quorum override attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''. -DESIGNATED_PRIMARY_CHANGED=HA-1010 : The designated primary attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''. -STOPPED=HA-1011 : The node ''{0}'' from the replication group ''{1}'' is stopped. -STARTED=HA-1012 : The node ''{0}'' from the replication group ''{1}'' is started. -TRANSFER_MASTER=HA-1013 : Transfer master to ''{0}'' is requested on node ''{1}'' from the replication group ''{2}''. +CREATED = HA-1001 : Created +DELETED = HA-1002 : Deleted + +# 0 - Node name +# 1 - Node address +ADDED = HA-1003 : Added : Node : ''{0}'' ({1}) + +# 0 - Node name +# 1 - Node address +REMOVED = HA-1004 : Removed : Node : ''{0}'' ({1}) + +# 0 - Node name +# 1 - Node address +JOINED = HA-1005 : Joined : Node : ''{0}'' ({1}) + +# 0 - Node name +# 1 - Node address +LEFT = HA-1006 : Left : Node : ''{0}'' ({1}) + +# 0 - Node name +# 1 - Node address +TRANSFER_MASTER = HA-1007 : Master transfer requested : to ''{0}'' ({1}) + +# 0 - Node name +# 1 - Node address +INTRUDER_DETECTED = HA-1008 : Intruder detected : Node ''{0}'' ({1}) +QUORUM_LOST = HA-1009 : Insufficient replicas contactable + +# 0 - Node name +# 1 - Node address +# 2 - Previous role value +# 3 - New role value +ROLE_CHANGED = HA-1010 : Role change reported: Node : ''{0}'' ({1}) : from ''{2}'' to ''{3}'' + +# 0 - new value +QUORUM_OVERRIDE_CHANGED = HA-1011 : Minimum group : {0} + +# 0 - new value +PRIORITY_CHANGED = HA-1012 : Priority : {0} + +# 0 - new value +DESIGNATED_PRIMARY_CHANGED = HA-1013 : Designated primary : {0} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java index edb78369ae..d59a09fce9 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java @@ -116,5 +116,4 @@ public class LogSubjectFormat */ public static final String QUEUE_FORMAT = "vh(/{0})/qu({1})"; - public static final String VIRTUAL_HOST_NODE_FORMAT = "vhn(/{0}))"; } diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/VirtualHostNodeLogSubject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/VirtualHostNodeLogSubject.java deleted file mode 100644 index fad9a91841..0000000000 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/VirtualHostNodeLogSubject.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.logging.subjects; - -import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.VIRTUAL_HOST_NODE_FORMAT; - -import org.apache.qpid.server.model.VirtualHostNode; - -public class VirtualHostNodeLogSubject extends AbstractLogSubject -{ - public VirtualHostNodeLogSubject(String nodeName) - { - setLogStringWithFormat(VIRTUAL_HOST_NODE_FORMAT, nodeName); - } -} diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java index 38101525cd..ad9df793c8 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java @@ -24,7 +24,6 @@ import org.apache.log4j.Logger; import org.apache.qpid.server.logging.EventLogger; import org.apache.qpid.server.logging.messages.ConfigStoreMessages; import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject; -import org.apache.qpid.server.logging.subjects.VirtualHostNodeLogSubject; import org.apache.qpid.server.model.AbstractConfiguredObject; import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.ConfiguredObject; @@ -54,7 +53,6 @@ public abstract class AbstractVirtualHostNode _broker; private final AtomicReference _state = new AtomicReference(State.UNINITIALIZED); private final EventLogger _eventLogger; - private final VirtualHostNodeLogSubject _virtualHostNodeLogSubject; private DurableConfigurationStore _durableConfigurationStore; @@ -67,7 +65,6 @@ public abstract class AbstractVirtualHostNode systemConfig = _broker.getParent(SystemConfig.class); _eventLogger = systemConfig.getEventLogger(); - _virtualHostNodeLogSubject = new VirtualHostNodeLogSubject(getName()); } @@ -248,8 +245,4 @@ public abstract class AbstractVirtualHostNode