[jboss-cvs] JBoss Messaging SVN: r5897 - in trunk: src/main/org/jboss/messaging/core/management/impl and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 18 12:31:32 EST 2009
Author: jmesnil
Date: 2009-02-18 12:31:32 -0500 (Wed, 18 Feb 2009)
New Revision: 5897
Added:
trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java
trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
Modified:
trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java
trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
Log:
refactored code sending management messages from JMX MBeans
* added ReplicationOperationInvoker class
* use a single ReplicationOperationInvoker from the management services for all the MBeans requiring replication of management operations
* the same ReplicationOperationInvoker (and its underlying ClientRequestor and ClientSession) is used for all the duration of the management service life
Modified: trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -77,10 +77,10 @@
void setManagementNotificationAddress(SimpleString managementNotificationAddress);
- long getManagementRequestTimeout();
-
void setManagementRequestTimeout(long timeout);
+ ReplicationOperationInvoker getReplicationOperationInvoker();
+
// Resource Registration
MessagingServerControlMBean registerServer(PostOffice postOffice,
Added: trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/ReplicationOperationInvoker.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.management;
+
+import javax.management.ObjectName;
+
+/**
+ * A ReplicationOperationInvoker
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public interface ReplicationOperationInvoker
+{
+
+ Object invoke(ObjectName objectName, String operationName, Object... parameters) throws Exception;
+
+ void stop();
+}
\ No newline at end of file
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -35,6 +35,8 @@
import java.util.Map;
import java.util.Set;
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
import javax.management.MBeanServer;
import javax.management.NotificationBroadcasterSupport;
import javax.management.ObjectName;
@@ -60,6 +62,7 @@
import org.jboss.messaging.core.management.NotificationListener;
import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareAddressControlWrapper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareMessagingServerControlWrapper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareQueueControlWrapper;
@@ -133,6 +136,8 @@
private final Set<NotificationListener> listeners = new ConcurrentHashSet<NotificationListener>();
+ private ReplicationOperationInvokerImpl replicationInvoker;
+
// Constructor ----------------------------------------------------
public ManagementServiceImpl(final MBeanServer mbeanServer, final boolean jmxManagementEnabled)
@@ -179,9 +184,7 @@
ObjectName objectName = ObjectNames.getMessagingServerObjectName();
registerInJMX(objectName, new ReplicationAwareMessagingServerControlWrapper(objectName,
managedServer,
- managementClusterPassword,
- managementAddress,
- managementRequestTimeout));
+ replicationInvoker));
registerInRegistry(objectName, managedServer);
return managedServer;
@@ -200,9 +203,7 @@
registerInJMX(objectName, new ReplicationAwareAddressControlWrapper(objectName,
addressControl,
- managementClusterPassword,
- managementAddress,
- managementRequestTimeout));
+ replicationInvoker));
registerInRegistry(objectName, addressControl);
@@ -243,9 +244,7 @@
QueueControl queueControl = new QueueControl(queue, postOffice, addressSettingsRepository, counter);
registerInJMX(objectName, new ReplicationAwareQueueControlWrapper(objectName,
queueControl,
- managementClusterPassword,
- managementAddress,
- managementRequestTimeout));
+ replicationInvoker));
registerInRegistry(objectName, queueControl);
if (log.isDebugEnabled())
@@ -468,11 +467,16 @@
this.managementRequestTimeout = timeout;
}
+ public ReplicationOperationInvoker getReplicationOperationInvoker()
+ {
+ return replicationInvoker;
+ }
// MessagingComponent implementation -----------------------------
public void start() throws Exception
{
+ replicationInvoker = new ReplicationOperationInvokerImpl(managementClusterPassword, managementAddress, managementRequestTimeout);
started = true;
}
@@ -484,6 +488,12 @@
{
unregisterResource(objectName);
}
+
+ //FIXME the replicationInvoker should be properly stopped.
+ // the code is commented since stopping the invoker will interact
+ // with the remoting service which is stopped first when stopping the server
+ // replicationInvoker.stop();
+
started = false;
}
Added: trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ReplicationOperationInvokerImpl.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -0,0 +1,142 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.core.management.impl;
+
+import static org.jboss.messaging.core.security.impl.SecurityStoreImpl.CLUSTER_ADMIN_USER;
+
+import javax.management.ObjectName;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientRequestor;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * A ReplicationOperationInvoker
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ReplicationOperationInvokerImpl implements ReplicationOperationInvoker
+{
+
+ // Constants -----------------------------------------------------
+
+ private static final Logger log = Logger.getLogger(ReplicationOperationInvokerImpl.class);
+
+ // Attributes ----------------------------------------------------
+
+ private final long timeout;
+
+ private final String clusterPassword;
+
+ private final SimpleString managementAddress;
+
+ private final ClientSessionFactory sf;
+
+ private ClientSession clientSession;
+
+ private ClientRequestor requestor;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationOperationInvokerImpl(final String clusterPassword,
+ final SimpleString managementAddress,
+ final long managementRequestTimeout) throws Exception
+ {
+ this.timeout = managementRequestTimeout;
+ this.clusterPassword = clusterPassword;
+ this.managementAddress = managementAddress;
+ sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ }
+
+ // Public --------------------------------------------------------
+
+ public Object invoke(final ObjectName objectName,
+ final String operationName,
+ final Object... parameters) throws Exception
+ {
+ if (clientSession == null)
+ {
+ clientSession = sf.createSession(CLUSTER_ADMIN_USER, clusterPassword, false, true, true, false, 1);
+ requestor = new ClientRequestor(clientSession, managementAddress);
+ clientSession.start();
+ }
+
+ ClientMessage mngmntMessage = clientSession.createClientMessage(false);
+ ManagementHelper.putOperationInvocation(mngmntMessage, objectName, operationName, parameters);
+ ClientMessage reply = requestor.request(mngmntMessage, timeout);
+
+ if (reply == null)
+ {
+ throw new Exception("did not receive reply for message " + mngmntMessage);
+ }
+ if (ManagementHelper.hasOperationSucceeded(reply))
+ {
+ return reply.getProperty(new SimpleString(operationName));
+ }
+ else
+ {
+ throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
+ }
+ }
+
+ public void stop()
+ {
+ if (requestor != null && !clientSession.isClosed())
+ {
+ try
+ {
+ {
+ requestor.close();
+ }
+ }
+ catch (Exception e)
+ {
+ // this will happen if the remoting service is stopped before this method is called
+ log.warn("Got Exception while closing requestor", e);
+ }
+ }
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareAddressControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -27,10 +27,10 @@
import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.management.AddressControlMBean;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.RoleInfo;
import org.jboss.messaging.core.management.impl.AddressControl;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareAddressControlWrapper
@@ -53,11 +53,9 @@
public ReplicationAwareAddressControlWrapper(final ObjectName objectName,
final AddressControl localAddressControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, AddressControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, AddressControlMBean.class, replicationInvoker);
this.localAddressControl = localAddressControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -30,9 +30,9 @@
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.impl.MessagingServerControl;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareMessagingServerControlWrapper
@@ -56,11 +56,9 @@
public ReplicationAwareMessagingServerControlWrapper(final ObjectName objectName,
final MessagingServerControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, MessagingServerControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, MessagingServerControlMBean.class, replicationInvoker);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareQueueControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -28,9 +28,9 @@
import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.management.QueueControlMBean;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.impl.QueueControl;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareQueueControlWrapper
@@ -53,11 +53,9 @@
public ReplicationAwareQueueControlWrapper(final ObjectName objectName,
final QueueControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, QueueControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, QueueControlMBean.class, replicationInvoker);
this.localQueueControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/core/management/jmx/impl/ReplicationAwareStandardMBeanWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -22,20 +22,10 @@
package org.jboss.messaging.core.management.jmx.impl;
-import static org.jboss.messaging.core.security.impl.SecurityStoreImpl.CLUSTER_ADMIN_USER;
-
-import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import javax.management.StandardMBean;
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientRequestor;
-import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
-import org.jboss.messaging.core.client.management.impl.ManagementHelper;
-import org.jboss.messaging.core.config.TransportConfiguration;
-import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
-import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
/**
* A ReplicationAwareStandardMBeanWrapper
@@ -55,31 +45,20 @@
private final ObjectName objectName;
- private final ClientSessionFactoryImpl sessionFactory;
+ private final ReplicationOperationInvoker replicationInvoker;
- private final long timeout;
-
- private final SimpleString managementAddress;
-
- private final String clusterPassword;
-
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
- protected ReplicationAwareStandardMBeanWrapper(final ObjectName objectName,
- final Class mbeanInterface,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws NotCompliantMBeanException
+ protected ReplicationAwareStandardMBeanWrapper(final ObjectName objectName,
+ final Class mbeanInterface,
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
super(mbeanInterface);
this.objectName = objectName;
- this.sessionFactory = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()));
- this.clusterPassword = clusterPassword;
- this.managementAddress = managementAddress;
- this.timeout = managementRequestTimeout;
+ this.replicationInvoker = replicationInvoker;
}
// Public --------------------------------------------------------
@@ -90,35 +69,9 @@
protected Object replicationAwareInvoke(final String operationName, final Object... parameters) throws Exception
{
- ClientSession clientSession = sessionFactory.createSession(CLUSTER_ADMIN_USER, clusterPassword, false, true, true, false, 1);
- ClientRequestor requestor = new ClientRequestor(clientSession, managementAddress);
- clientSession.start();
-
- ClientMessage mngmntMessage = clientSession.createClientMessage(false);
- ManagementHelper.putOperationInvocation(mngmntMessage, objectName, operationName, parameters);
- ClientMessage reply = requestor.request(mngmntMessage, timeout);
-
- try
- {
- if (reply == null)
- {
- throw new Exception("did not receive reply for message " + mngmntMessage);
- }
- if (ManagementHelper.hasOperationSucceeded(reply))
- {
- return reply.getProperty(new SimpleString(operationName));
- }
- else
- {
- throw new Exception(ManagementHelper.getOperationExceptionMessage(reply));
- }
- }
- finally
- {
- requestor.close();
- }
+ return replicationInvoker.invoke(objectName, operationName, parameters);
}
-
+
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementServiceImpl.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -78,9 +78,7 @@
managementService.registerInJMX(objectName,
new ReplicationAwareJMSServerControlWrapper(objectName,
control,
- managementService.getClusterPassword(),
- managementService.getManagementAddress(),
- managementService.getManagementRequestTimeout()));
+ managementService.getReplicationOperationInvoker()));
managementService.registerInRegistry(objectName, control);
}
@@ -115,9 +113,7 @@
managementService.registerInJMX(objectName,
new ReplicationAwareJMSQueueControlWrapper(objectName,
control,
- managementService.getClusterPassword(),
- managementService.getManagementAddress(),
- managementService.getManagementRequestTimeout()));
+ managementService.getReplicationOperationInvoker()));
managementService.registerInRegistry(objectName, control);
}
@@ -137,9 +133,7 @@
TopicControl control = new TopicControl(topic, jndiBinding, postOffice);
managementService.registerInJMX(objectName, new ReplicationAwareTopicControlWrapper(objectName,
control,
- managementService.getClusterPassword(),
- managementService.getManagementAddress(),
- managementService.getManagementRequestTimeout()));
+ managementService.getReplicationOperationInvoker()));
managementService.registerInRegistry(objectName, control);
}
@@ -158,9 +152,7 @@
managementService.registerInJMX(objectName,
new ReplicationAwareConnectionFactoryControlWrapper(objectName,
control,
- managementService.getClusterPassword(),
- managementService.getManagementAddress(),
- managementService.getManagementRequestTimeout()));
+ managementService.getReplicationOperationInvoker()));
managementService.registerInRegistry(objectName, control);
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareConnectionFactoryControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -27,11 +27,11 @@
import javax.management.MBeanInfo;
import javax.management.ObjectName;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.ConnectionFactoryControlMBean;
import org.jboss.messaging.jms.server.management.impl.ConnectionFactoryControl;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareConnectionFactoryControlWrapper
@@ -54,11 +54,9 @@
public ReplicationAwareConnectionFactoryControlWrapper(final ObjectName objectName,
final ConnectionFactoryControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, ConnectionFactoryControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, ConnectionFactoryControlMBean.class, replicationInvoker);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSQueueControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -27,11 +27,11 @@
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.TabularData;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.JMSQueueControlMBean;
import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareJMSQueueControlWrapper
@@ -54,11 +54,9 @@
public ReplicationAwareJMSQueueControlWrapper(final ObjectName objectName,
final JMSQueueControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, JMSQueueControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, JMSQueueControlMBean.class, replicationInvoker);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -28,12 +28,12 @@
import javax.management.ObjectName;
import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
import org.jboss.messaging.jms.server.management.impl.JMSServerControl;
import org.jboss.messaging.util.Pair;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareJMSServerControlWrapper
@@ -56,11 +56,9 @@
public ReplicationAwareJMSServerControlWrapper(final ObjectName objectName,
final JMSServerControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, JMSServerControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, JMSServerControlMBean.class, replicationInvoker);
this.localControl = localControl;
}
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareTopicControlWrapper.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -26,12 +26,12 @@
import javax.management.ObjectName;
import javax.management.openmbean.TabularData;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.impl.MBeanInfoHelper;
import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareStandardMBeanWrapper;
import org.jboss.messaging.jms.server.management.SubscriptionInfo;
import org.jboss.messaging.jms.server.management.TopicControlMBean;
import org.jboss.messaging.jms.server.management.impl.TopicControl;
-import org.jboss.messaging.util.SimpleString;
/**
* A ReplicationAwareTopicControlWrapper
@@ -54,11 +54,10 @@
public ReplicationAwareTopicControlWrapper(final ObjectName objectName,
final TopicControl localControl,
- final String clusterPassword,
- final SimpleString managementAddress,
- final long managementRequestTimeout) throws Exception
+ final ReplicationOperationInvoker replicationInvoker) throws Exception
{
- super(objectName, TopicControlMBean.class, clusterPassword, managementAddress, managementRequestTimeout);
+ super(objectName, TopicControlMBean.class, replicationInvoker);
+
this.localControl = localControl;
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementServiceImplTest.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -83,6 +83,7 @@
MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
ManagementService managementService = new ManagementServiceImpl(mbeanServer, false);
assertNotNull(managementService);
+ managementService.start();
SimpleString address = RandomUtil.randomSimpleString();
managementService.registerAddress(address);
@@ -107,6 +108,7 @@
MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
ManagementService managementService = new ManagementServiceImpl(mbeanServer, false);
assertNotNull(managementService);
+ managementService.start();
Role role = new Role(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
@@ -145,6 +147,7 @@
MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
ManagementService managementService = new ManagementServiceImpl(mbeanServer, false);
assertNotNull(managementService);
+ managementService.start();
Role role = new Role(randomString(), randomBoolean(), randomBoolean(), randomBoolean());
@@ -189,6 +192,7 @@
ManagementService managementService = new ManagementServiceImpl(mbeanServer, true);
assertNotNull(managementService);
+ managementService.start();
managementService.registerAddress(randomSimpleString());
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-02-18 17:12:47 UTC (rev 5896)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-02-18 17:31:32 UTC (rev 5897)
@@ -28,8 +28,6 @@
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
import java.util.ArrayList;
@@ -42,6 +40,7 @@
import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.messagecounter.MessageCounter;
import org.jboss.messaging.core.messagecounter.MessageCounterManager;
import org.jboss.messaging.core.persistence.StorageManager;
@@ -59,7 +58,6 @@
import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
import org.jboss.messaging.jms.server.management.impl.TopicControl;
-import org.jboss.messaging.tests.util.RandomUtil;
/*
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
@@ -83,19 +81,18 @@
ObjectName objectName = ObjectNames.getJMSServerObjectName();
JMSServerManager server = createMock(JMSServerManager.class);
-
+
ManagementService managementService = createMock(ManagementService.class);
- expect(managementService.getClusterPassword()).andReturn(randomString());
- expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
- expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
+ ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
+ expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(JMSServerControlMBean.class));
- replay(managementService, server);
+ replay(managementService, server, invoker);
JMSManagementService service = new JMSManagementServiceImpl(managementService);
service.registerJMSServer(server);
- verify(managementService, server);
+ verify(managementService, server, invoker);
}
public void testRegisterQueue() throws Exception
@@ -115,19 +112,18 @@
MessageCounterManager messageCounterManager = createMock(MessageCounterManager.class);
expect(managementService.getMessageCounterManager()).andReturn(messageCounterManager );
expect(messageCounterManager.getMaxDayCount()).andReturn(randomPositiveInt());
- expect(managementService.getClusterPassword()).andReturn(randomString());
- expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
- expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
+ ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
+ expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
messageCounterManager.registerMessageCounter(eq(name), isA(MessageCounter.class));
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(JMSQueueControl.class));
- replay(managementService, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
+ replay(managementService, invoker, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
JMSManagementService service = new JMSManagementServiceImpl(managementService);
service.registerQueue(queue, coreQueue, jndiBinding, postOffice, storageManager, addressSettingsRepository);
- verify(managementService, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
+ verify(managementService, invoker, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
}
public void testRegisterTopic() throws Exception
@@ -142,18 +138,17 @@
HierarchicalRepository<AddressSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
ManagementService managementService = createMock(ManagementService.class);
- expect(managementService.getClusterPassword()).andReturn(randomString());
- expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
- expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
+ ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
+ expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(TopicControl.class));
- replay(managementService, postOffice, storageManager);
+ replay(managementService, invoker, postOffice, storageManager);
JMSManagementService service = new JMSManagementServiceImpl(managementService);
service.registerTopic(topic, jndiBinding, postOffice, storageManager, addressSettingsRepository);
- verify(managementService, postOffice, storageManager);
+ verify(managementService, invoker, postOffice, storageManager);
}
public void testRegisterConnectionFactory() throws Exception
@@ -167,18 +162,17 @@
JBossConnectionFactory connectionFactory = createMock(JBossConnectionFactory.class);
ManagementService managementService = createMock(ManagementService.class);
- expect(managementService.getClusterPassword()).andReturn(randomString());
- expect(managementService.getManagementAddress()).andReturn(randomSimpleString());
- expect(managementService.getManagementRequestTimeout()).andReturn(randomPositiveLong());
+ ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
+ expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
managementService.registerInRegistry(eq(objectName), isA(ConnectionFactoryControl.class));
- replay(managementService, connectionFactory);
+ replay(managementService, invoker, connectionFactory);
JMSManagementService service = new JMSManagementServiceImpl(managementService);
service.registerConnectionFactory(name, connectionFactory, bindings);
- verify(managementService, connectionFactory);
+ verify(managementService, invoker, connectionFactory);
}
// Package protected ---------------------------------------------
More information about the jboss-cvs-commits
mailing list