You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2014/08/25 17:15:32 UTC
svn commit: r1620339 [1/2] - in /qpid/branches/0.30/qpid/java: ./
amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/
amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/
bdbstore/src/main/java/org/apache/qpid/server/logging/...
Author: rgodfrey
Date: Mon Aug 25 15:15:31 2014
New Revision: 1620339
URL: http://svn.apache.org/r1620339
Log:
Merging from trunk r1617822:1618206 in the Java tree
Added:
qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/
- copied from r1618086, qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/logging/
qpid/branches/0.30/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/UnacknowledgedMessageMapTest.java
- copied unchanged from r1618082, qpid/trunk/qpid/java/broker-plugins/amqp-0-8-protocol/src/test/java/org/apache/qpid/server/protocol/v0_8/UnacknowledgedMessageMapTest.java
qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java
- copied unchanged from r1618077, qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/UnsupportedAddressSyntaxException.java
Removed:
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/VirtualHostNodeLogSubject.java
qpid/branches/0.30/qpid/java/systests/src/test/java/org/apache/qpid/server/util/AveragedRun.java
qpid/branches/0.30/qpid/java/systests/src/test/java/org/apache/qpid/server/util/RunStats.java
qpid/branches/0.30/qpid/java/systests/src/test/java/org/apache/qpid/server/util/TimedRun.java
qpid/branches/0.30/qpid/java/systests/src/test/java/org/apache/qpid/test/utils/ConversationFactory.java
qpid/branches/0.30/qpid/java/systests/src/test/java/org/apache/qpid/util/ClasspathScanner.java
Modified:
qpid/branches/0.30/qpid/java/ (props changed)
qpid/branches/0.30/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ConnectionErrorException.java
qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java
qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java
qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java
qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java
qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java
qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java
qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/queue/AbstractQueue.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/AbstractVirtualHostNode.java
qpid/branches/0.30/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQChannel.java
qpid/branches/0.30/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/UnacknowledgedMessageMapImpl.java
qpid/branches/0.30/qpid/java/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_from_1_0.java
qpid/branches/0.30/qpid/java/broker-plugins/amqp-msg-conv-0-10-to-1-0/src/main/java/org/apache/qpid/server/protocol/converter/v0_10_v1_0/MessageConverter_1_0_to_v0_10.java
qpid/branches/0.30/qpid/java/broker-plugins/amqp-msg-conv-0-8-to-1-0/src/main/java/org/apache/qpid/server/protocol/converter/v0_8_v1_0/MessageConverter_1_0_to_v0_8.java
qpid/branches/0.30/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java
qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession_0_8.java
qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer_0_8.java
qpid/branches/0.30/qpid/java/client/src/main/java/org/apache/qpid/jms/BrokerDetails.java
qpid/branches/0.30/qpid/java/common/src/main/java/org/apache/qpid/filter/ConstantExpression.java
qpid/branches/0.30/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/PlainSaslClient.java
qpid/branches/0.30/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UserPasswordCallbackHandler.java
qpid/branches/0.30/qpid/java/management/common/src/main/java/org/apache/qpid/management/common/sasl/UsernameHashedPasswordCallbackHandler.java
qpid/branches/0.30/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/client/property/NumericGeneratedPropertySupport.java
qpid/branches/0.30/qpid/java/pom.xml
qpid/branches/0.30/qpid/java/qpid-test-utils/src/main/java/org/apache/qpid/test/utils/QpidTestCase.java
qpid/branches/0.30/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java
Propchange: qpid/branches/0.30/qpid/java/
------------------------------------------------------------------------------
Merged /qpid/trunk/qpid/java:r1617822,1617847,1617894-1617895,1617908,1618073,1618077,1618079,1618082,1618086,1618139,1618168,1618176,1618206
Modified: qpid/branches/0.30/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java (original)
+++ qpid/branches/0.30/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java Mon Aug 25 15:15:31 2014
@@ -173,7 +173,10 @@ public class MessageConsumerImpl impleme
}
else
{
- throw new JMSException(e.getMessage(), error.getCondition().getValue().toString());
+ JMSException jmsException =
+ new JMSException(e.getMessage(), error.getCondition().getValue().toString());
+ jmsException.initCause(e);
+ throw jmsException;
}
}
Modified: qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ConnectionErrorException.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ConnectionErrorException.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ConnectionErrorException.java (original)
+++ qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/ConnectionErrorException.java Mon Aug 25 15:15:31 2014
@@ -34,7 +34,7 @@ public class ConnectionErrorException ex
public ConnectionErrorException(Error remoteError)
{
- super(remoteError.getDescription());
+ super(remoteError.getDescription() == null ? remoteError.toString() : remoteError.getDescription());
_remoteError = remoteError;
}
Modified: qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java (original)
+++ qpid/branches/0.30/qpid/java/amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/client/Receiver.java Mon Aug 25 15:15:31 2014
@@ -194,9 +194,14 @@ public class Receiver implements Deliver
}
catch (InterruptedException e)
{
- throw new ConnectionErrorException(AmqpError.INTERNAL_ERROR,"Interrupted whil waiting for detach following failed attach");
+ throw new ConnectionErrorException(AmqpError.INTERNAL_ERROR,"Interrupted while waiting for detach following failed attach");
}
- throw new ConnectionErrorException(getError());
+ throw new ConnectionErrorException(getError().getCondition(),
+ getError().getDescription() == null
+ ? "AMQP error: '" + getError().getCondition().toString()
+ + "' when attempting to create a receiver"
+ + (source != null ? " from: '" + source.getAddress() +"'" : "")
+ : getError().getDescription());
}
else
{
Modified: qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java Mon Aug 25 15:15:31 2014
@@ -1333,7 +1333,7 @@ public abstract class AbstractBDBMessage
data = new byte[0];
}
}
- return ByteBuffer.wrap(data,offsetInMessage,size);
+ return ByteBuffer.wrap(data,offsetInMessage,Math.min(size,data.length-offsetInMessage));
}
Modified: qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeImpl.java Mon Aug 25 15:15:31 2014
@@ -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.Ille
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 BDBHARemoteReplicationNodeI
private volatile long _joinTime;
private volatile long _lastTransactionId;
+ private volatile String _lastReplicatedEnvironmentState = ReplicatedEnvironment.State.UNKNOWN.name();
@ManagedAttributeField(afterSet="afterSetRole")
- private volatile String _role;
+ private volatile String _role = ReplicatedEnvironment.State.UNKNOWN.name();
private final AtomicReference<State> _state;
private final boolean _isMonitor;
private boolean _detached;
+ private BDBHAVirtualHostNodeLogSubject _virtualHostNodeLogSubject;
+ private GroupLogSubject _groupLogSubject;
public BDBHARemoteReplicationNodeImpl(BDBHAVirtualHostNode<?> virtualHostNode, Map<String, Object> attributes, ReplicatedEnvironmentFacade replicatedEnvironmentFacade)
{
@@ -92,7 +102,7 @@ public class BDBHARemoteReplicationNodeI
@Override
public String getRole()
{
- return _role;
+ return _lastReplicatedEnvironmentState;
}
@Override
@@ -152,10 +162,7 @@ public class BDBHARemoteReplicationNodeI
{
String nodeName = getName();
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug("Deleting node '" + nodeName + "' from group '" + getGroupName() + "'");
- }
+ getEventLogger().message(_virtualHostNodeLogSubject, HighAvailabilityMessages.DELETED());
try
{
@@ -178,19 +185,11 @@ public class BDBHARemoteReplicationNodeI
try
{
String nodeName = getName();
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug("Trying to transfer master to '" + nodeName + "'");
- }
+ getEventLogger().message(_groupLogSubject, HighAvailabilityMessages.TRANSFER_MASTER(getName(), getAddress()));
_replicatedEnvironmentFacade.transferMasterAsynchronously(nodeName);
-
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug("The transfer of mastership to node '" + nodeName + "' has been initiated.");
- }
}
- catch(Exception e)
+ catch (Exception e)
{
throw new IllegalConfigurationException("Cannot transfer mastership to '" + getName() + "'", e);
}
@@ -227,10 +226,7 @@ public class BDBHARemoteReplicationNodeI
void setRole(String role)
{
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug(this + " updating role to : " + role);
- }
+ _lastReplicatedEnvironmentState = role;
_role = role;
updateModelStateFromRole(role);
}
@@ -266,4 +262,17 @@ public class BDBHARemoteReplicationNodeI
{
this._detached = detached;
}
+
+ @Override
+ public void onValidate()
+ {
+ super.onValidate();
+ _virtualHostNodeLogSubject = new BDBHAVirtualHostNodeLogSubject(getGroupName(), getName());
+ _groupLogSubject = new GroupLogSubject(getGroupName());
+ }
+
+ private EventLogger getEventLogger()
+ {
+ return ((SystemConfig)getParent(VirtualHostNode.class).getParent(Broker.class).getParent(SystemConfig.class)).getEventLogger();
+ }
}
Modified: qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java Mon Aug 25 15:15:31 2014
@@ -22,6 +22,7 @@ package org.apache.qpid.server.virtualho
import java.net.InetSocketAddress;
import java.security.PrivilegedAction;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -49,6 +50,8 @@ import org.apache.qpid.server.configurat
import org.apache.qpid.server.configuration.updater.Task;
import org.apache.qpid.server.logging.messages.ConfigStoreMessages;
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.Broker;
import org.apache.qpid.server.model.BrokerModel;
import org.apache.qpid.server.model.ConfiguredObject;
@@ -75,6 +78,7 @@ public class BDBHAVirtualHostNodeImpl ex
BDBHAVirtualHostNode<BDBHAVirtualHostNodeImpl>
{
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 ex
private final AtomicReference<ReplicatedEnvironmentFacade> _environmentFacade = new AtomicReference<>();
private final AtomicReference<ReplicatedEnvironment.State> _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 ex
}
}
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ADDED(getName(), getGroupName()));
+ getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.CREATED());
}
protected ReplicatedEnvironmentFacade getReplicatedEnvironmentFacade()
@@ -291,8 +298,6 @@ public class BDBHAVirtualHostNodeImpl ex
getConfigurationStore().openConfigurationStore(this, false);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ATTACHED(getName(), getGroupName(), getRole()));
-
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.CREATED());
getEventLogger().message(getConfigurationStoreLogSubject(), ConfigStoreMessages.STORE_LOCATION(getStorePath()));
@@ -325,23 +330,6 @@ public class BDBHAVirtualHostNodeImpl ex
ReplicatedEnvironment.State detached = ReplicatedEnvironment.State.DETACHED;
_lastReplicatedEnvironmentState.set(detached);
attributeSet(ROLE, _role, detached);
-
- //Perhaps, having STOPPED operational logging could be sufficient. However, on START we still will be seeing 2 logs: ATTACHED and STARTED
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DETACHED(getName(), getGroupName()));
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.STOPPED(getName(), getGroupName()));
- }
- }
-
- @StateTransition( currentState = { State.UNINITIALIZED, State.STOPPED, State.ERRORED }, desiredState = State.ACTIVE )
- protected void doActivate()
- {
- try
- {
- super.doActivate();
- }
- finally
- {
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.STARTED(getName(), getGroupName()));
}
}
@@ -359,7 +347,7 @@ public class BDBHAVirtualHostNodeImpl ex
{
Set<InetSocketAddress> 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 ex
finally
{
closeEnvironment();
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DETACHED(getName(), getGroupName()));
}
}
+ @Override
+ public void onValidate()
+ {
+ super.onValidate();
+ _virtualHostNodeLogSubject = new BDBHAVirtualHostNodeLogSubject(getGroupName(), getName());
+ _groupLogSubject = new GroupLogSubject(getGroupName());
+ _virtualHostNodePrincipalName = MessageFormat.format(VIRTUAL_HOST_PRINCIPAL_NAME_FORMAT, getGroupName(), getName());
+ }
+
private void onMaster()
{
try
@@ -550,7 +546,7 @@ public class BDBHAVirtualHostNodeImpl ex
{
LOGGER.info("Received BDB event indicating transition to state " + state);
}
-
+ String previousRole = getRole();
try
{
switch (state)
@@ -573,10 +569,9 @@ public class BDBHAVirtualHostNodeImpl ex
finally
{
_lastReplicatedEnvironmentState.set(state);
- String previousRole = _role;
attributeSet(ROLE, _role, state.name());
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ROLE_CHANGED(getName(),
- getGroupName(), previousRole, state.name()));
+ getEventLogger().message(getGroupLogSubject(),
+ HighAvailabilityMessages.ROLE_CHANGED(getName(), getAddress(), previousRole, state.name()));
}
}
}
@@ -591,8 +586,8 @@ public class BDBHAVirtualHostNodeImpl ex
try
{
environmentFacade.setPriority(_priority).get(MUTATE_JE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.PRIORITY_CHANGED(getName(),
- getGroupName(), String.valueOf(_priority)));
+ getEventLogger().message(getVirtualHostNodeLogSubject(),
+ HighAvailabilityMessages.PRIORITY_CHANGED(String.valueOf(_priority)));
}
catch (TimeoutException e)
{
@@ -619,8 +614,8 @@ public class BDBHAVirtualHostNodeImpl ex
try
{
environmentFacade.setDesignatedPrimary(_designatedPrimary).get(MUTATE_JE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED(getName(),
- getGroupName(), String.valueOf(_designatedPrimary)));
+ getEventLogger().message(getVirtualHostNodeLogSubject(),
+ HighAvailabilityMessages.DESIGNATED_PRIMARY_CHANGED(String.valueOf(_designatedPrimary)));
}
catch (TimeoutException e)
{
@@ -647,8 +642,8 @@ public class BDBHAVirtualHostNodeImpl ex
try
{
environmentFacade.setElectableGroupSizeOverride(_quorumOverride).get(MUTATE_JE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.QUORUM_OVERRIDE_CHANGED(getName(),
- getGroupName(), String.valueOf(_quorumOverride)));
+ getEventLogger().message(getVirtualHostNodeLogSubject(),
+ HighAvailabilityMessages.QUORUM_OVERRIDE_CHANGED(String.valueOf(_quorumOverride)));
}
catch (TimeoutException e)
{
@@ -674,8 +669,8 @@ public class BDBHAVirtualHostNodeImpl ex
{
try
{
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.TRANSFER_MASTER(getName(), getAddress()));
environmentFacade.transferMasterToSelfAsynchronously().get(MUTATE_JE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.TRANSFER_MASTER(getName(), getName(), getGroupName()));
}
catch (TimeoutException e)
{
@@ -701,18 +696,27 @@ public class BDBHAVirtualHostNodeImpl ex
return getAddress().equals(getHelperAddress());
}
+ BDBHAVirtualHostNodeLogSubject getVirtualHostNodeLogSubject()
+ {
+ return _virtualHostNodeLogSubject;
+ }
+
+ GroupLogSubject getGroupLogSubject()
+ {
+ return _groupLogSubject;
+ }
+
private class RemoteNodesDiscoverer implements ReplicationGroupListener
{
@Override
public void onReplicationNodeAddedToGroup(final ReplicationNode node)
{
- getTaskExecutor().submit(new Task<Void>()
+ getTaskExecutor().submit(new VirtualHostNodeGroupTask()
{
@Override
- public Void execute()
+ public void perform()
{
addRemoteReplicationNode(node);
- return null;
}
});
}
@@ -722,19 +726,18 @@ public class BDBHAVirtualHostNodeImpl ex
BDBHARemoteReplicationNodeImpl remoteNode = new BDBHARemoteReplicationNodeImpl(BDBHAVirtualHostNodeImpl.this, nodeToAttributes(node), getReplicatedEnvironmentFacade());
remoteNode.create();
childAdded(remoteNode);
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ADDED(remoteNode.getName(), getGroupName()));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.ADDED(remoteNode.getName(), remoteNode.getAddress()));
}
@Override
public void onReplicationNodeRecovered(final ReplicationNode node)
{
- getTaskExecutor().submit(new Task<Void>()
+ getTaskExecutor().submit(new VirtualHostNodeGroupTask()
{
@Override
- public Void execute()
+ public void perform()
{
recoverRemoteReplicationNode(node);
- return null;
}
});
}
@@ -745,19 +748,18 @@ public class BDBHAVirtualHostNodeImpl ex
remoteNode.registerWithParents();
remoteNode.open();
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ATTACHED(remoteNode.getName(), getGroupName(), String.valueOf(remoteNode.getState())));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.JOINED(remoteNode.getName(), remoteNode.getAddress()));
}
@Override
public void onReplicationNodeRemovedFromGroup(final ReplicationNode node)
{
- getTaskExecutor().submit(new Task<Void>()
+ getTaskExecutor().submit(new VirtualHostNodeGroupTask()
{
@Override
- public Void execute()
+ public void perform()
{
removeRemoteReplicationNode(node);
- return null;
}
});
}
@@ -768,12 +770,25 @@ public class BDBHAVirtualHostNodeImpl ex
if (remoteNode != null)
{
remoteNode.deleted();
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DELETED(remoteNode.getName(), getGroupName()));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.REMOVED(remoteNode.getName(), remoteNode.getAddress()));
}
}
@Override
- public void onNodeState(ReplicationNode node, NodeState nodeState)
+ public void onNodeState(final ReplicationNode node, final NodeState nodeState)
+ {
+ Subject.doAs(SecurityManager.getSystemTaskSubject(_virtualHostNodePrincipalName), new PrivilegedAction<Void>()
+ {
+ @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 ex
remoteNode.setLastTransactionId(-1);
if (!remoteNode.isDetached())
{
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.DETACHED(remoteNode.getName(), getGroupName()));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.LEFT(remoteNode.getName(), remoteNode.getAddress()));
remoteNode.setDetached(true);
}
}
@@ -796,7 +811,7 @@ public class BDBHAVirtualHostNodeImpl ex
remoteNode.setRole(nodeState.getNodeState().name());
if (remoteNode.isDetached())
{
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ATTACHED(remoteNode.getName(), getGroupName(), remoteNode.getRole() ));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.JOINED(remoteNode.getName(), remoteNode.getAddress()));
remoteNode.setDetached(false);
}
}
@@ -804,17 +819,29 @@ public class BDBHAVirtualHostNodeImpl ex
String newRole = remoteNode.getRole();
if (!newRole.equals(currentRole))
{
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.ROLE_CHANGED(remoteNode.getName(),
- getGroupName(), currentRole, newRole));
+ getEventLogger().message(getGroupLogSubject(), HighAvailabilityMessages.ROLE_CHANGED(remoteNode.getName(), remoteNode.getAddress(), currentRole, newRole));
}
}
}
@Override
- public void onIntruderNode(ReplicationNode node)
+ public void onIntruderNode(final ReplicationNode node)
+ {
+ Subject.doAs(SecurityManager.getSystemTaskSubject(_virtualHostNodePrincipalName), new PrivilegedAction<Void>()
+ {
+ @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 ex
@Override
public void onNoMajority()
{
- getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.MAJORITY_LOST(getName(), getGroupName()));
+ getEventLogger().message(getVirtualHostNodeLogSubject(), HighAvailabilityMessages.QUORUM_LOST());
}
private Map<String, Object> nodeToAttributes(ReplicationNode replicationNode)
@@ -872,4 +899,23 @@ public class BDBHAVirtualHostNodeImpl ex
}
}
+ private abstract class VirtualHostNodeGroupTask implements Task<Void>
+ {
+ @Override
+ public Void execute()
+ {
+ return Subject.doAs(SecurityManager.getSystemTaskSubject(_virtualHostNodePrincipalName), new PrivilegedAction<Void>()
+ {
+ @Override
+ public Void run()
+ {
+ perform();
+ return null;
+ }
+ });
+ }
+
+ abstract void perform();
+ }
+
}
Modified: qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHARemoteReplicationNodeTest.java Mon Aug 25 15:15:31 2014
@@ -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.configurat
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 BDBHARemoteReplicationNodeT
// 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 BDBHARemoteReplicationNodeT
String remoteReplicationName = getName();
BDBHARemoteReplicationNode remoteReplicationNode = createRemoteReplicationNode(remoteReplicationName);
- remoteReplicationNode.setAttribute(BDBHARemoteReplicationNode.ROLE, null, "MASTER");
+ remoteReplicationNode.setAttribute(BDBHARemoteReplicationNode.ROLE, "UNKNOWN", "MASTER");
verify(_facade).transferMasterAsynchronously(remoteReplicationName);
}
Modified: qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeOperationalLoggingTest.java Mon Aug 25 15:15:31 2014
@@ -78,67 +78,18 @@ public class BDBHAVirtualHostNodeOperati
_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<String, Object> 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<String, Object> 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 BDBHAVirtualHostNodeOperati
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 BDBHAVirtualHostNodeOperati
// 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 BDBHAVirtualHostNodeOperati
// 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 BDBHAVirtualHostNodeOperati
// 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 BDBHAVirtualHostNodeOperati
// 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 BDBHAVirtualHostNodeOperati
// 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 BDBHAVirtualHostNodeOperati
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 BDBHAVirtualHostNodeOperati
_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<LogMessage> matcher = new ArgumentMatcher<LogMessage>()
- {
- 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 {
Modified: qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/GroupCreator.java Mon Aug 25 15:15:31 2014
@@ -75,9 +75,9 @@ public class GroupCreator
private static final String MANY_BROKER_URL_FORMAT = "amqp://guest:guest@/%s?brokerlist='%s'&failover='roundrobin?cyclecount='%d''";
private static final String BROKER_PORTION_FORMAT = "tcp://localhost:%d?connectdelay='%d',retries='%d'";
- private static final int FAILOVER_CYCLECOUNT = 10;
- private static final int FAILOVER_RETRIES = 1;
- private static final int FAILOVER_CONNECTDELAY = 1000;
+ private static final int FAILOVER_CYCLECOUNT = 20;
+ private static final int FAILOVER_RETRIES = 0;
+ private static final int FAILOVER_CONNECTDELAY = 500;
private static final String SINGLE_BROKER_URL_WITH_RETRY_FORMAT = "amqp://guest:guest@/%s?brokerlist='tcp://localhost:%d?connectdelay='%d',retries='%d''";
private static final String SINGLE_BROKER_URL_WITHOUT_RETRY_FORMAT = "amqp://guest:guest@/%s?brokerlist='tcp://localhost:%d'";
Modified: qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/JMXManagementTest.java Mon Aug 25 15:15:31 2014
@@ -206,20 +206,6 @@ public class JMXManagementTest extends Q
}
}
- public void testSetDesignatedPrimary() throws Exception
- {
- int brokerPort = _clusterCreator.getBrokerPortNumbersForNodes().iterator().next();
- final ManagedBDBHAMessageStore storeBean = getStoreBeanForNodeAtBrokerPort(brokerPort);
- assertFalse("Unexpected designated primary before change", storeBean.getDesignatedPrimary());
- storeBean.setDesignatedPrimary(true);
- long limit = System.currentTimeMillis() + 5000;
- while(!storeBean.getDesignatedPrimary() && System.currentTimeMillis() < limit)
- {
- Thread.sleep(100l);
- }
- assertTrue("Unexpected designated primary after change", storeBean.getDesignatedPrimary());
- }
-
public void testVirtualHostMbeanOnMasterTransfer() throws Exception
{
Connection connection = getConnection(_brokerFailoverUrl);
Modified: qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java (original)
+++ qpid/branches/0.30/qpid/java/bdbstore/systests/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TwoNodeTest.java Mon Aug 25 15:15:31 2014
@@ -20,27 +20,29 @@
package org.apache.qpid.server.store.berkeleydb.replication;
import java.io.File;
+import java.util.Collections;
+import java.util.Map;
import javax.jms.Connection;
import javax.jms.JMSException;
-import javax.management.ObjectName;
import org.apache.qpid.jms.ConnectionURL;
-import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore;
-import org.apache.qpid.test.utils.JMXTestUtils;
+import org.apache.qpid.server.virtualhostnode.berkeleydb.BDBHAVirtualHostNode;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
public class TwoNodeTest extends QpidBrokerTestCase
{
private static final String VIRTUAL_HOST = "test";
- private static final String MANAGED_OBJECT_QUERY = "org.apache.qpid:type=BDBHAMessageStore,name=" + ObjectName.quote(VIRTUAL_HOST);
private static final int NUMBER_OF_NODES = 2;
private final GroupCreator _groupCreator = new GroupCreator(this, VIRTUAL_HOST, NUMBER_OF_NODES);
- private final JMXTestUtils _jmxUtils = new JMXTestUtils(this);
- private ConnectionURL _brokerFailoverUrl;
+ /** Used when expectation is client will not (re)-connect */
+ private ConnectionURL _positiveFailoverUrl;
+
+ /** Used when expectation is client will not (re)-connect */
+ private ConnectionURL _negativeFailoverUrl;
@Override
protected void setUp() throws Exception
@@ -54,19 +56,6 @@ public class TwoNodeTest extends QpidBro
}
@Override
- protected void tearDown() throws Exception
- {
- try
- {
- _jmxUtils.close();
- }
- finally
- {
- super.tearDown();
- }
- }
-
- @Override
public void startBroker() throws Exception
{
// Don't start default broker provided by QBTC.
@@ -77,20 +66,21 @@ public class TwoNodeTest extends QpidBro
setSystemProperty("java.util.logging.config.file", "etc" + File.separator + "log.properties");
_groupCreator.configureClusterNodes();
_groupCreator.setDesignatedPrimaryOnFirstBroker(designedPrimary);
- _brokerFailoverUrl = _groupCreator.getConnectionUrlForAllClusterNodes();
+ _positiveFailoverUrl = _groupCreator.getConnectionUrlForAllClusterNodes();
+ _negativeFailoverUrl = _groupCreator.getConnectionUrlForAllClusterNodes(200, 0, 2);
_groupCreator.startCluster();
}
public void testMasterDesignatedPrimaryCanBeRestartedWithoutReplica() throws Exception
{
startCluster(true);
- final Connection initialConnection = getConnection(_brokerFailoverUrl);
+ final Connection initialConnection = getConnection(_positiveFailoverUrl);
int masterPort = _groupCreator.getBrokerPortNumberFromConnection(initialConnection);
assertProducingConsuming(initialConnection);
initialConnection.close();
_groupCreator.stopCluster();
_groupCreator.startNode(masterPort);
- final Connection secondConnection = getConnection(_brokerFailoverUrl);
+ final Connection secondConnection = getConnection(_positiveFailoverUrl);
assertProducingConsuming(secondConnection);
secondConnection.close();
}
@@ -98,12 +88,12 @@ public class TwoNodeTest extends QpidBro
public void testClusterRestartWithoutDesignatedPrimary() throws Exception
{
startCluster(false);
- final Connection initialConnection = getConnection(_brokerFailoverUrl);
+ final Connection initialConnection = getConnection(_positiveFailoverUrl);
assertProducingConsuming(initialConnection);
initialConnection.close();
_groupCreator.stopCluster();
_groupCreator.startClusterParallel();
- final Connection secondConnection = getConnection(_brokerFailoverUrl);
+ final Connection secondConnection = getConnection(_positiveFailoverUrl);
assertProducingConsuming(secondConnection);
secondConnection.close();
}
@@ -112,7 +102,7 @@ public class TwoNodeTest extends QpidBro
{
startCluster(true);
_groupCreator.stopNode(_groupCreator.getBrokerPortNumberOfSecondaryNode());
- final Connection connection = getConnection(_brokerFailoverUrl);
+ final Connection connection = getConnection(_positiveFailoverUrl);
assertNotNull("Expected to get a valid connection to primary", connection);
assertProducingConsuming(connection);
}
@@ -124,7 +114,7 @@ public class TwoNodeTest extends QpidBro
try
{
- Connection connection = getConnection(_brokerFailoverUrl);
+ Connection connection = getConnection(_negativeFailoverUrl);
assertProducingConsuming(connection);
fail("Exception not thrown");
}
@@ -143,7 +133,7 @@ public class TwoNodeTest extends QpidBro
try
{
- getConnection(_brokerFailoverUrl);
+ getConnection(_negativeFailoverUrl);
fail("Connection not expected");
}
catch (JMSException e)
@@ -155,41 +145,39 @@ public class TwoNodeTest extends QpidBro
public void testInitialDesignatedPrimaryStateOfNodes() throws Exception
{
startCluster(true);
- final ManagedBDBHAMessageStore primaryStoreBean = getStoreBeanForNodeAtBrokerPort(_groupCreator.getBrokerPortNumberOfPrimary());
- assertTrue("Expected primary node to be set as designated primary", primaryStoreBean.getDesignatedPrimary());
- final ManagedBDBHAMessageStore secondaryStoreBean = getStoreBeanForNodeAtBrokerPort(_groupCreator.getBrokerPortNumberOfSecondaryNode());
- assertFalse("Expected secondary node to NOT be set as designated primary", secondaryStoreBean.getDesignatedPrimary());
+ Map<String, Object> primaryNodeAttributes = _groupCreator.getNodeAttributes(_groupCreator.getBrokerPortNumberOfPrimary());
+ assertTrue("Expected primary node to be set as designated primary",
+ (Boolean) primaryNodeAttributes.get(BDBHAVirtualHostNode.DESIGNATED_PRIMARY));
+
+ Map<String, Object> secondaryNodeAttributes = _groupCreator.getNodeAttributes(_groupCreator.getBrokerPortNumberOfSecondaryNode());
+ assertFalse("Expected secondary node to NOT be set as designated primary",
+ (Boolean) secondaryNodeAttributes.get(BDBHAVirtualHostNode.DESIGNATED_PRIMARY));
}
public void testSecondaryDesignatedAsPrimaryAfterOriginalPrimaryStopped() throws Exception
{
startCluster(true);
- final ManagedBDBHAMessageStore storeBean = getStoreBeanForNodeAtBrokerPort(_groupCreator.getBrokerPortNumberOfSecondaryNode());
+
_groupCreator.stopNode(_groupCreator.getBrokerPortNumberOfPrimary());
- assertFalse("Expected node to NOT be set as designated primary", storeBean.getDesignatedPrimary());
- storeBean.setDesignatedPrimary(true);
+ Map<String, Object> secondaryNodeAttributes = _groupCreator.getNodeAttributes(_groupCreator.getBrokerPortNumberOfSecondaryNode());
+ assertFalse("Expected node to NOT be set as designated primary", (Boolean) secondaryNodeAttributes.get(BDBHAVirtualHostNode.DESIGNATED_PRIMARY));
+
+ _groupCreator.setNodeAttributes(_groupCreator.getBrokerPortNumberOfSecondaryNode(), Collections.<String, Object>singletonMap(BDBHAVirtualHostNode.DESIGNATED_PRIMARY, true));
- long limit = System.currentTimeMillis() + 5000;
- while( !storeBean.getDesignatedPrimary() && System.currentTimeMillis() < limit)
+ int timeout = 5000;
+ long limit = System.currentTimeMillis() + timeout;
+ while( !((Boolean)secondaryNodeAttributes.get(BDBHAVirtualHostNode.DESIGNATED_PRIMARY)) && System.currentTimeMillis() < limit)
{
Thread.sleep(100);
+ secondaryNodeAttributes = _groupCreator.getNodeAttributes(_groupCreator.getBrokerPortNumberOfSecondaryNode());
}
- assertTrue("Expected node to now be set as designated primary", storeBean.getDesignatedPrimary());
+ assertTrue("Expected secondary to transition to primary within " + timeout, (Boolean) secondaryNodeAttributes.get(BDBHAVirtualHostNode.DESIGNATED_PRIMARY));
- final Connection connection = getConnection(_brokerFailoverUrl);
+ final Connection connection = getConnection(_positiveFailoverUrl);
assertNotNull("Expected to get a valid connection to new primary", connection);
assertProducingConsuming(connection);
}
- private ManagedBDBHAMessageStore getStoreBeanForNodeAtBrokerPort(
- final int activeBrokerPortNumber) throws Exception
- {
- _jmxUtils.open(activeBrokerPortNumber);
-
- ManagedBDBHAMessageStore storeBean = _jmxUtils.getManagedObject(ManagedBDBHAMessageStore.class, MANAGED_OBJECT_QUERY);
- return storeBean;
- }
-
}
Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/exchange/HeadersBinding.java Mon Aug 25 15:15:31 2014
@@ -281,4 +281,10 @@ class HeadersBinding
return true;
}
+
+ @Override
+ public int hashCode()
+ {
+ return _binding == null ? 0 : _binding.hashCode();
+ }
}
Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailabilityMessages.java Mon Aug 25 15:15:31 2014
@@ -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:
- * <pre>HA-1012 : The node ''{0}'' from the replication group ''{1}'' is stopped.</pre>
+ * <pre>HA-1008 : Intruder detected : Node ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1007: Intruder node ''{0}'' from ''{1}'' is detected in replication group ''{2}''</pre>
+ * <pre>HA-1007 : Master transfer requested : to ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1013 : The node ''{0}'' from the replication group ''{1}'' is started.</pre>
+ * <pre>HA-1011 : Minimum group : {0}</pre>
* 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:
- * <pre>HA-1014 : Transfer master to ''{0}'' is requested on node ''{1}'' from the replication group ''{2}''.</pre>
+ * <pre>HA-1004 : Removed : Node : ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1009 : The quorum override attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.</pre>
+ * <pre>HA-1006 : Left : Node : ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1003 : The node ''{0}'' detached from the replication group ''{1}''.</pre>
+ * <pre>HA-1005 : Joined : Node : ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1006 : A majority of nodes from replication group ''{0}'' is not available for node ''{1}''.</pre>
+ * <pre>HA-1001 : Created</pre>
* 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:
- * <pre>HA-1008 : The priority attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.</pre>
+ * <pre>HA-1009 : Insufficient replicas contactable</pre>
* 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:
- * <pre>HA-1004 : The node ''{0}'' attached to the replication group ''{1}'' with role ''{2}''.</pre>
+ * <pre>HA-1012 : Priority : {0}</pre>
* 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:
- * <pre>HA-1001 : A new node ''{0}'' is added into a replication group ''{1}''.</pre>
+ * <pre>HA-1003 : Added : Node : ''{0}'' ({1})</pre>
* 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:
- * <pre>HA-1002 : An existing node ''{0}'' is removed from the replication group ''{1}''.</pre>
+ * <pre>HA-1002 : Deleted</pre>
* 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:
- * <pre>HA-1005 : The role of the node ''{0}'' from the replication group ''{1}'' has changed from ''{2}'' to ''{3}''.</pre>
+ * <pre>HA-1010 : Role change reported: Node : ''{0}'' ({1}) : from ''{2}'' to ''{3}''</pre>
* 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:
- * <pre>HA-1010 : The designated primary attribute of node ''{0}'' from the replication group ''{1}'' is set to ''{2}''.</pre>
+ * <pre>HA-1013 : Designated primary : {0}</pre>
* 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);
Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/messages/HighAvailability_logmessages.properties Mon Aug 25 15:15:31 2014
@@ -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}
Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/LogSubjectFormat.java Mon Aug 25 15:15:31 2014
@@ -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}))";
}
Modified: qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java?rev=1620339&r1=1620338&r2=1620339&view=diff
==============================================================================
--- qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java (original)
+++ qpid/branches/0.30/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java Mon Aug 25 15:15:31 2014
@@ -318,7 +318,7 @@ public abstract class AbstractConfigured
checkCandidate((Class<? extends ConfiguredObject>) interfaceClass, candidates);
}
}
- if(clazz.getSuperclass() != null & ConfiguredObject.class.isAssignableFrom(clazz.getSuperclass()))
+ if(clazz.getSuperclass() != null && ConfiguredObject.class.isAssignableFrom(clazz.getSuperclass()))
{
findBestFitInterface((Class<? extends ConfiguredObject>) clazz.getSuperclass(), candidates);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org