[jboss-cvs] JBoss Messaging SVN: r4727 - in branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core: persistence/impl/journal and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 24 12:05:49 EDT 2008
Author: jmesnil
Date: 2008-07-24 12:05:48 -0400 (Thu, 24 Jul 2008)
New Revision: 4727
Added:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java
Modified:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
Log:
JBMESSAGING-1303: Revisit management interfaces
* by default, use a Null Object for the managementRegistration of JournalStorageManager & PostOfficeImpl
Added: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java (rev 0)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/NullManagementRegistration.java 2008-07-24 16:05:48 UTC (rev 4727)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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 org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.MessagingServerManagement;
+import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class NullManagementRegistration implements ManagementRegistration
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public NullManagementRegistration()
+ {
+ }
+
+ // Public --------------------------------------------------------
+
+ // ManagementRegistration implementation -------------------------
+
+ public void setPostOffice(PostOffice postOffice)
+ {
+ }
+
+ public void setQueueSettingsRepository(
+ HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ {
+ }
+
+ public void registerServer(MessagingServerManagement server)
+ throws Exception
+ {
+ }
+
+ public void unregisterServer() throws Exception
+ {
+ }
+
+ public void registerAddress(String address) throws Exception
+ {
+ }
+
+ public void unregisterAddress(String address) throws Exception
+ {
+ }
+
+ public void registerQueue(Queue queue, SimpleString address,
+ StorageManager storageManager) throws Exception
+ {
+ }
+
+ public void unregisterQueue(SimpleString name, SimpleString address)
+ throws Exception
+ {
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-07-24 15:53:05 UTC (rev 4726)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-07-24 16:05:48 UTC (rev 4727)
@@ -48,6 +48,7 @@
import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.impl.NullManagementRegistration;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.PostOffice;
@@ -111,7 +112,7 @@
private volatile boolean started;
- private ManagementRegistration managementRegistration;
+ private ManagementRegistration managementRegistration = new NullManagementRegistration();
public JournalStorageManager(final Configuration config)
{
@@ -527,10 +528,7 @@
Binding binding = new BindingImpl(address, queue);
- if (managementRegistration != null)
- {
- managementRegistration.registerQueue(queue, address, this);
- }
+ managementRegistration.registerQueue(queue, address, this);
bindings.add(binding);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-07-24 15:53:05 UTC (rev 4726)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2008-07-24 16:05:48 UTC (rev 4727)
@@ -37,6 +37,7 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.ManagementRegistration;
+import org.jboss.messaging.core.management.impl.NullManagementRegistration;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.Binding;
import org.jboss.messaging.core.postoffice.FlowController;
@@ -76,7 +77,7 @@
private volatile boolean started;
- private ManagementRegistration managementRegistration;
+ private ManagementRegistration managementRegistration = new NullManagementRegistration();
public PostOfficeImpl(final StorageManager storageManager,
final QueueFactory queueFactory, final boolean checkAllowable)
@@ -185,10 +186,7 @@
storageManager.deleteBinding(binding);
}
- if (managementRegistration != null)
- {
- managementRegistration.unregisterQueue(queueName, binding.getAddress());
- }
+ managementRegistration.unregisterQueue(queueName, binding.getAddress());
return binding;
}
@@ -293,16 +291,13 @@
Binding binding = new BindingImpl(address, queue);
- if (managementRegistration != null)
+ try
{
- try
- {
- managementRegistration.registerQueue(queue, address, storageManager);
- } catch (Exception e)
- {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
+ managementRegistration.registerQueue(queue, address, storageManager);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new IllegalStateException(e);
}
return binding;
@@ -319,10 +314,7 @@
bindings = prevBindings;
} else
{
- if (managementRegistration != null)
- {
- managementRegistration.registerAddress(binding.getAddress().toString());
- }
+ managementRegistration.registerAddress(binding.getAddress().toString());
}
bindings.add(binding);
@@ -371,10 +363,7 @@
{
mappings.remove(binding.getAddress());
- if (managementRegistration != null)
- {
- managementRegistration.unregisterAddress(binding.getAddress().toString());
- }
+ managementRegistration.unregisterAddress(binding.getAddress().toString());
binding.getQueue().setFlowController(null);
}
More information about the jboss-cvs-commits
mailing list