[jboss-cvs] JBoss Messaging SVN: r4765 - in branches/Branch_JBMESSAGING-1303/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
Fri Aug 1 11:15:29 EDT 2008
Author: jmesnil
Date: 2008-08-01 11:15:29 -0400 (Fri, 01 Aug 2008)
New Revision: 4765
Modified:
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessageInfo.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/PropertiesInfo.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MBeanInfoHelper.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/QueueControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/SubscriberInfo.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
Log:
code cleanup
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessageInfo.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessageInfo.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessageInfo.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -98,7 +98,7 @@
// Static --------------------------------------------------------
- public static TabularData toTabularData(MessageInfo[] infos)
+ public static TabularData toTabularData(final MessageInfo[] infos)
throws OpenDataException
{
TabularData data = new TabularDataSupport(TABULAR_TYPE);
@@ -111,9 +111,10 @@
// Constructors --------------------------------------------------
- public MessageInfo(long id, String destination, boolean durable,
- long timestamp, byte type, int size, byte priority, boolean expired,
- long expiration)
+ public MessageInfo(final long id, final String destination,
+ final boolean durable, final long timestamp, final byte type,
+ final int size, final byte priority, final boolean expired,
+ final long expiration)
{
this.id = id;
this.destination = destination;
@@ -174,7 +175,7 @@
return expiration;
}
- public void putProperty(String key, String value)
+ public void putProperty(final String key, final String value)
{
properties.put(key, value);
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/MessagingServerManagement.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -38,6 +38,7 @@
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
* @author <a href="tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
*/
public interface MessagingServerManagement
{
@@ -122,170 +123,6 @@
void setQueueAttributes(String queueName, QueueSettings settings) throws Exception;
- /**
- * remove all the messages for a specific binding
- * @param name the name of the binding
- * @throws Exception if a problem occurred
- */
- //void removeAllMessagesForBinding(SimpleString name) throws Exception;
-
- /**
- * List all messages in a queue that match the filter provided
- * @param queue the name of the queue
- * @param filter the filter
- * @return the messages
- * @throws Exception if a problem occurred
- */
- //List<Message> listMessages(SimpleString queue, Filter filter) throws Exception;
-
- /**
- * remove the messages for a specific binding that match the specified filter
- * @param binding the name of the binding
- * @param filter the filter
- * @throws Exception if a problem occurred
- */
- /// void removeMessageForBinding(String binding, Filter filter) throws Exception;
-
- /**
- * remove the messages for a specific address that match the specified filter
- * @param address the address
- * @param filter the filter
- * @throws Exception if a problem occurred
- */
- // void removeMessageForAddress(String address, Filter filter) throws Exception;
-
- /**
- * count the number of messages in a queue
- * @param queue the name of the queue
- * @return the number of messages in a queue
- * @throws Exception if a problem occurred
- */
- int getMessageCountForQueue(SimpleString queue) throws Exception;
-
- /**
- * register a message counter with a specific queue
- * @param queue the name of the queue
- * @throws Exception if a problem occurred
- */
- //void registerMessageCounter(SimpleString queue) throws Exception;
-
- /**
- * unregister a message counter from a specific queue
- * @param queue the name of the queue
- * @throws Exception if a problem occurred
- */
- //void unregisterMessageCounter(SimpleString queue) throws Exception;
-
- /**
- * start collection statistics on a message counter. The message counter must have been registered first.
- * @param queue the name of the queue
- * @param duration how long to take a sample for in seconds. 0 means indefinitely.
- * @throws Exception if a problem occurred
- */
- //void startMessageCounter(SimpleString queue, long duration) throws Exception;
-
- /**
- * stop a message counter on a specific queue. The message counter must be started to call this.
- * @param queue the name of the queue
- * @return the message counter stopped
- * @throws Exception if a problem occurred
- */
- //MessageCounter stopMessageCounter(SimpleString queue) throws Exception;
-
- /**
- * get a message counter for a specific queue
- * @param queue the name of the queue
- * @return the message counter
- */
- //MessageCounter getMessageCounter(SimpleString queue);
-//
- /**
- * get all message counters
- * @return the message counters
- */
- //Collection<MessageCounter> getMessageCounters();
-
- /**
- * reset a message counter for a specific queue
- * @param queue the name of the queue
- */
- //void resetMessageCounter(SimpleString queue);
-
- /**
- * reset all message counters registered
- */
- //void resetMessageCounters();
-
- /**
- * reset the history for a message counter for a queue
- * @param queue the name of the queue
- */
- //void resetMessageCounterHistory(SimpleString queue);
-
- /**
- * reset all message counter histories
- */
- //void resetMessageCounterHistories();
-
- /**
- * stop all message counters
- * @return all message counters
- * @throws Exception if a problem occurred
- */
- //List<MessageCounter> stopAllMessageCounters() throws Exception;
-
- /**
- * unregister all message counters
- * @throws Exception if a problem occurred
- */
- //void unregisterAllMessageCounters() throws Exception;
-
- /**
- * get the number of consumers for a specific queue
- * @param queue the name of the queue
- * @return the count
- * @throws Exception if a problem occurred
- */
- //public int getConsumerCountForQueue(SimpleString queue) throws Exception;
-
- /**
- * return all the active connections
- * @return all connections
- */
- //List<ServerConnection> getActiveConnections();
-
- /**
- * move a set of messages from one queue to another
- * @param toQueue the source queue
- * @param fromQueue the destination queue
- * @param filter the filter to use
- * @throws Exception if a problem occurred
- */
- //void moveMessages(String toQueue, String fromQueue, String filter) throws Exception;
-
- /**
- * expire a set of messages for a specific queue
- * @param queue the name of the queue
- * @param filter the filter to use
- * @throws Exception if a problem occurred
- */
- //void expireMessages(SimpleString queue,String filter) throws Exception;
-
- /**
- * change the message priority for a set of messages
- * @param queue the name of the queue
- * @param filter the filter to use
- * @param priority the priority to change to
- * @throws Exception if a problem occurred
- */
- //void changeMessagePriority(String queue, String filter, int priority) throws Exception;
-
- /**
- * list all available addresses
- * @return the addresses
- */
- //Set<SimpleString> listAvailableAddresses();
-
Configuration getConfiguration();
/**
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/PropertiesInfo.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/PropertiesInfo.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/PropertiesInfo.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -18,7 +18,7 @@
* 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;
@@ -36,13 +36,21 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
-class PropertiesInfo
+/**
+ * Info for a Message property.
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public class PropertiesInfo
{
+ // Constants -----------------------------------------------------
+
public static final TabularType TABULAR_TYPE;
private static CompositeType ROW_TYPE;
- private final Map<String, String> properties = new HashMap<String, String>();
-
static
{
try
@@ -59,33 +67,35 @@
}
}
- PropertiesInfo()
- {
- }
+ // Attributes ----------------------------------------------------
- /**
- * @return
- */
+ private final Map<String, String> properties = new HashMap<String, String>();
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
public Map<String, String> entries()
{
return properties;
}
- void put(String key, String value)
+ public void put(final String key, final String value)
{
properties.put(key, value);
}
- TabularData toTabularData()
+ public TabularData toTabularData()
{
try
{
TabularDataSupport data = new TabularDataSupport(TABULAR_TYPE);
for (Entry<String, String> entry : properties.entrySet())
{
- data.put(new CompositeDataSupport(ROW_TYPE, new String[] {
- "key", "value" }, new Object[] { entry.getKey(),
- entry.getValue() }));
+ data
+ .put(new CompositeDataSupport(ROW_TYPE, new String[] { "key",
+ "value" }, new Object[] { entry.getKey(),
+ entry.getValue() }));
}
return data;
} catch (OpenDataException e)
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/AddressControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/AddressControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/AddressControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -60,7 +60,8 @@
// Constructors --------------------------------------------------
- public AddressControl(String address, MessagingServerManagement server)
+ public AddressControl(final String address,
+ final MessagingServerManagement server)
throws NotCompliantMBeanException
{
super(AddressControlMBean.class);
@@ -81,8 +82,8 @@
{
try
{
- List<Queue> queues = server
- .getQueuesForAddress(new SimpleString(address));
+ List<Queue> queues = server.getQueuesForAddress(new SimpleString(
+ address));
String[] queueNames = new String[queues.size()];
for (int i = 0; i < queues.size(); i++)
{
@@ -115,8 +116,8 @@
return roleInfos;
}
- public void addRole(String name, boolean create, boolean read,
- boolean write) throws Exception
+ public void addRole(final String name, final boolean create,
+ final boolean read, final boolean write) throws Exception
{
Set<Role> roles = server.getSecurityForAddress(address);
Role newRole = new Role(name, read, write, create);
@@ -128,7 +129,7 @@
server.setSecurityForAddress(address, roles);
}
- public void removeRole(String role) throws Exception
+ public void removeRole(final String role) throws Exception
{
Set<Role> roles = server.getSecurityForAddress(address);
Iterator<Role> it = roles.iterator();
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MBeanInfoHelper.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MBeanInfoHelper.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MBeanInfoHelper.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -52,7 +52,7 @@
// Public --------------------------------------------------------
public static MBeanOperationInfo[] getMBeanOperationsInfo(
- Class mbeanInterface)
+ final Class mbeanInterface)
{
List<MBeanOperationInfo> operations = new ArrayList<MBeanOperationInfo>();
@@ -74,7 +74,7 @@
// Private -------------------------------------------------------
- private static boolean isGetterMethod(Method method)
+ private static boolean isGetterMethod(final Method method)
{
if (!(method.getName().equals("get"))
&& method.getName().startsWith("get")
@@ -87,7 +87,7 @@
return false;
}
- private static boolean isSetterMethod(Method method)
+ private static boolean isSetterMethod(final Method method)
{
if (!(method.getName().equals("set"))
&& method.getName().startsWith("set")
@@ -101,7 +101,7 @@
}
}
- private static boolean isIsBooleanMethod(Method method)
+ private static boolean isIsBooleanMethod(final Method method)
{
if (!(method.getName().equals("is")) && method.getName().startsWith("is")
&& method.getParameterTypes().length == 0
@@ -114,7 +114,7 @@
}
}
- private static MBeanOperationInfo getOperationInfo(Method operation)
+ private static MBeanOperationInfo getOperationInfo(final Method operation)
{
MBeanOperationInfo info = null;
Class<?> returnType = operation.getReturnType();
@@ -136,8 +136,8 @@
return info;
}
- private static MBeanParameterInfo[] getParametersInfo(Annotation[][] params,
- Class<?>[] paramTypes)
+ private static MBeanParameterInfo[] getParametersInfo(
+ final Annotation[][] params, final Class<?>[] paramTypes)
{
MBeanParameterInfo[] paramsInfo = new MBeanParameterInfo[params.length];
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -65,15 +65,15 @@
return ObjectName.getInstance(DOMAIN + ":module=Core,type=Server");
}
- public static ObjectName getAddressObjectName(String address)
+ public static ObjectName getAddressObjectName(final String address)
throws Exception
{
return ObjectName.getInstance(String.format(
"%s:module=Core,type=Address,name=%s", DOMAIN, address));
}
- public static ObjectName getQueueObjectName(SimpleString address,
- SimpleString name) throws Exception
+ public static ObjectName getQueueObjectName(final SimpleString address,
+ final SimpleString name) throws Exception
{
return ObjectName.getInstance(String.format(
"%s:module=Core,type=Queue,address=%s,name=%s", DOMAIN, address,
@@ -82,7 +82,7 @@
// Constructors --------------------------------------------------
- public ManagementServiceImpl(MBeanServer mbeanServer)
+ public ManagementServiceImpl(final MBeanServer mbeanServer)
{
this.mbeanServer = mbeanServer;
}
@@ -91,18 +91,18 @@
// ManagementRegistration implementation -------------------------
- public void setPostOffice(PostOffice postOffice)
+ public void setPostOffice(final PostOffice postOffice)
{
this.postOffice = postOffice;
}
public void setQueueSettingsRepository(
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
{
this.queueSettingsRepository = queueSettingsRepository;
}
- public void registerServer(MessagingServerManagement server)
+ public void registerServer(final MessagingServerManagement server)
throws Exception
{
ObjectName objectName = getMessagingServerObjectName();
@@ -129,7 +129,7 @@
}
}
- public void registerAddress(String address) throws Exception
+ public void registerAddress(final String address) throws Exception
{
ObjectName objectName = getAddressObjectName(address);
if (mbeanServer.isRegistered(objectName))
@@ -146,17 +146,17 @@
}
}
- public void unregisterAddress(String address) throws Exception
+ public void unregisterAddress(final String address) throws Exception
{
ObjectName objectName = getAddressObjectName(address);
if (mbeanServer.isRegistered(objectName))
{
- mbeanServer.unregisterMBean(objectName);
+ mbeanServer.unregisterMBean(objectName);
}
}
- public void registerQueue(Queue queue, SimpleString address,
- StorageManager storageManager) throws Exception
+ public void registerQueue(final Queue queue, final SimpleString address,
+ final StorageManager storageManager) throws Exception
{
ObjectName objectName = getQueueObjectName(address, queue.getName());
if (mbeanServer.isRegistered(objectName))
@@ -165,7 +165,8 @@
+ " is already registered. Unregister it");
mbeanServer.unregisterMBean(objectName);
}
- QueueControlMBean queueControl = new QueueControl(queue, storageManager, postOffice, queueSettingsRepository);
+ QueueControlMBean queueControl = new QueueControl(queue, storageManager,
+ postOffice, queueSettingsRepository);
mbeanServer.registerMBean(queueControl, objectName);
if (log.isDebugEnabled())
{
@@ -173,13 +174,13 @@
}
}
- public void unregisterQueue(SimpleString name, SimpleString address)
- throws Exception
+ public void unregisterQueue(final SimpleString name,
+ final SimpleString address) throws Exception
{
ObjectName objectName = getQueueObjectName(address, name);
if (mbeanServer.isRegistered(objectName))
{
- mbeanServer.unregisterMBean(objectName);
+ mbeanServer.unregisterMBean(objectName);
}
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -65,8 +65,8 @@
// Constructors --------------------------------------------------
- public MessagingServerControl(MessagingServerManagement server,
- Configuration configuration) throws NotCompliantMBeanException
+ public MessagingServerControl(final MessagingServerManagement server,
+ final Configuration configuration) throws NotCompliantMBeanException
{
super(MessagingServerControlMBean.class);
this.server = server;
@@ -78,13 +78,6 @@
// StandardMBean overrides ---------------------------------------
- /*
- * overrides getMBeanInfo to add operations info using annotations
- *
- * @see Operation
- *
- * @see Parameter
- */
@Override
public MBeanInfo getMBeanInfo()
{
@@ -227,27 +220,30 @@
return configuration.isSecurityEnabled();
}
- public boolean addAddress(String address) throws Exception
+ public boolean addAddress(final String address) throws Exception
{
sendNotification(NotificationType.ADDRESS_ADDED, address);
return server.addDestination(new SimpleString(address));
}
- public void createQueue(String address, String name) throws Exception
+ public void createQueue(final String address, final String name)
+ throws Exception
{
server.createQueue(new SimpleString(address), new SimpleString(name));
sendNotification(NotificationType.ADDRESS_ADDED, address);
sendNotification(NotificationType.QUEUE_CREATED, name);
}
- public void createQueue(String address, String name, String filter,
- boolean durable, boolean temporary) throws Exception
+ public void createQueue(final String address, final String name,
+ final String filter, final boolean durable, final boolean temporary)
+ throws Exception
{
if (temporary && durable)
{
- throw new IllegalArgumentException("A queue can not be both temporary and durable");
+ throw new IllegalArgumentException(
+ "A queue can not be both temporary and durable");
}
-
+
SimpleString simpleFilter = (filter == null || filter.length() == 0) ? null
: new SimpleString(filter);
server.createQueue(new SimpleString(address), new SimpleString(name),
@@ -256,7 +252,7 @@
sendNotification(NotificationType.QUEUE_CREATED, name);
}
- public void destroyQueue(String name) throws Exception
+ public void destroyQueue(final String name) throws Exception
{
server.destroyQueue(new SimpleString(name));
sendNotification(NotificationType.QUEUE_DESTROYED, name);
@@ -267,7 +263,7 @@
return server.getConnectionCount();
}
- public boolean removeAddress(String address) throws Exception
+ public boolean removeAddress(final String address) throws Exception
{
sendNotification(NotificationType.ADDRESS_REMOVED, address);
return server.removeDestination(new SimpleString(address));
@@ -275,21 +271,21 @@
// NotificationEmitter implementation ----------------------------
- public void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback)
+ public void removeNotificationListener(final NotificationListener listener,
+ final NotificationFilter filter, final Object handback)
throws ListenerNotFoundException
{
broadcaster.removeNotificationListener(listener, filter, handback);
}
- public void removeNotificationListener(NotificationListener listener)
+ public void removeNotificationListener(final NotificationListener listener)
throws ListenerNotFoundException
{
broadcaster.removeNotificationListener(listener);
}
- public void addNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback)
+ public void addNotificationListener(final NotificationListener listener,
+ final NotificationFilter filter, final Object handback)
throws IllegalArgumentException
{
broadcaster.addNotificationListener(listener, filter, handback);
@@ -313,7 +309,8 @@
// Private -------------------------------------------------------
- private void sendNotification(NotificationType type, String message)
+ private void sendNotification(final NotificationType type,
+ final String message)
{
Notification notif = new Notification(type.toString(), this, notifSeq
.incrementAndGet(), message);
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/MessagingServerManagementImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -50,24 +50,15 @@
* message count for queues and topics.
*
* @author <a href="mailto:ataylor at redhat.com>Andy Taylor</a>
- * @author <a href="mailto:ataylor at redhat.com>Andy Taylor</a>
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
*/
-// @JMX(name = "jboss.messaging:service=MessagingServerManagement",
-// exposedInterface = MessagingServerManagement.class)
public class MessagingServerManagementImpl implements MessagingServerManagement
{
- // private MessagingServer messagingServer;
- // private HashMap<String, MessageCounter> currentCounters = new
- // HashMap<String, MessageCounter>();
- //
- // private HashMap<String, ScheduledFuture> currentRunningCounters = new
- // HashMap<String, ScheduledFuture>();
- //
- // private ScheduledExecutorService scheduler;
- //
- // private int maxMessageCounters = 20;
+ // Constants -----------------------------------------------------
+ // Attributes ----------------------------------------------------
+
private final PostOffice postOffice;
private final StorageManager storageManager;
@@ -82,6 +73,10 @@
private HierarchicalRepository<QueueSettings> queueSettingsRepository;
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
public MessagingServerManagementImpl(final PostOffice postOffice,
final StorageManager storageManager,
final Configuration configuration,
@@ -105,6 +100,8 @@
this.queueSettingsRepository = queueSettingsRepository;
}
+ // MessagingServerManagement implementation ----------------------
+
public boolean isStarted()
{
return server.isStarted();
@@ -115,7 +112,7 @@
return server.getVersion().getFullVersion();
}
- public void createQueue(SimpleString address, SimpleString name)
+ public void createQueue(final SimpleString address, final SimpleString name)
throws Exception
{
if (postOffice.getBinding(name) == null)
@@ -124,9 +121,9 @@
}
}
- public void createQueue(SimpleString address, SimpleString name,
- SimpleString filterStr, boolean durable, boolean temporary)
- throws Exception
+ public void createQueue(final SimpleString address, final SimpleString name,
+ final SimpleString filterStr, final boolean durable,
+ final boolean temporary) throws Exception
{
if (postOffice.getBinding(name) == null)
{
@@ -144,7 +141,7 @@
return connectionManager.size();
}
- public void destroyQueue(SimpleString name) throws Exception
+ public void destroyQueue(final SimpleString name) throws Exception
{
Binding binding = postOffice.getBinding(name);
@@ -158,17 +155,18 @@
}
}
- public boolean addDestination(SimpleString address) throws Exception
+ public boolean addDestination(final SimpleString address) throws Exception
{
return postOffice.addDestination(address, false);
}
- public boolean removeDestination(SimpleString address) throws Exception
+ public boolean removeDestination(final SimpleString address)
+ throws Exception
{
return postOffice.removeDestination(address, false);
}
- public void removeAllMessagesForAddress(SimpleString address)
+ public void removeAllMessagesForAddress(final SimpleString address)
throws Exception
{
List<Binding> bindings = postOffice.getBindingsForAddress(address);
@@ -181,8 +179,8 @@
}
}
- public boolean removeMessageFromAddress(long messageID, SimpleString address)
- throws Exception
+ public boolean removeMessageFromAddress(final long messageID,
+ SimpleString address) throws Exception
{
Binding binding = postOffice.getBinding(address);
if (binding != null)
@@ -193,14 +191,7 @@
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.jboss.messaging.core.management.MessagingServerManagement#expireMessage
- * (long, org.jboss.messaging.util.SimpleString)
- */
- public boolean expireMessage(long messageID, SimpleString address)
+ public boolean expireMessage(final long messageID, final SimpleString address)
throws Exception
{
Binding binding = postOffice.getBinding(address);
@@ -213,16 +204,8 @@
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.jboss.messaging.core.management.MessagingServerManagement#expireMessages
- * (org.jboss.messaging.core.filter.Filter,
- * org.jboss.messaging.util.SimpleString)
- */
- public List<MessageReference> expireMessages(Filter filter,
- SimpleString address) throws Exception
+ public List<MessageReference> expireMessages(final Filter filter,
+ final SimpleString address) throws Exception
{
Binding binding = postOffice.getBinding(address);
if (binding != null)
@@ -239,8 +222,8 @@
return Collections.emptyList();
}
- public List<MessageReference> sendMessagesToDLQ(Filter filter,
- SimpleString address) throws Exception
+ public List<MessageReference> sendMessagesToDLQ(final Filter filter,
+ final SimpleString address) throws Exception
{
Binding binding = postOffice.getBinding(address);
if (binding != null)
@@ -257,8 +240,8 @@
return Collections.emptyList();
}
- public List<MessageReference> changeMessagesPriority(Filter filter,
- byte newPriority, SimpleString address) throws Exception
+ public List<MessageReference> changeMessagesPriority(final Filter filter,
+ final byte newPriority, final SimpleString address) throws Exception
{
Binding binding = postOffice.getBinding(address);
if (binding != null)
@@ -267,75 +250,21 @@
List<MessageReference> refs = queue.list(filter);
for (MessageReference ref : refs)
{
- queue.changeMessagePriority(ref.getMessage().getMessageID(), newPriority, storageManager, postOffice, queueSettingsRepository);
+ queue.changeMessagePriority(ref.getMessage().getMessageID(),
+ newPriority, storageManager, postOffice,
+ queueSettingsRepository);
}
return refs;
}
return Collections.emptyList();
}
-
- public QueueSettings getQueueSettings(SimpleString simpleAddress)
+
+ public QueueSettings getQueueSettings(final SimpleString simpleAddress)
{
return queueSettingsRepository.getMatch(simpleAddress.toString());
}
- //
- // public void removeAllMessagesForBinding(SimpleString name) throws
- // Exception
- // {
- // Binding binding = messagingServer.getPostOffice().getBinding(name);
- // if (binding != null)
- // {
- // Queue queue = binding.getQueue();
- //
- // queue.deleteAllReferences(messagingServer.getStorageManager());
- // }
- // }
- //
- // public List<Message> listMessages(SimpleString queueName, Filter filter)
- // throws Exception
- // {
- // List<Message> msgs = new ArrayList<Message>();
- // Queue queue = getQueue(queueName);
- // if (queue != null)
- // {
- // List<MessageReference> allRefs = queue.list(filter);
- // for (MessageReference allRef : allRefs)
- // {
- // msgs.add(allRef.getMessage());
- // }
- // }
- // return msgs;
- // }
-
- // public void removeMessageForBinding(String name, Filter filter) throws
- // Exception
- // {
- // Binding binding = messagingServer.getPostOffice().getBinding(name);
- // if (binding != null)
- // {
- // Queue queue = binding.getQueue();
- // List<MessageReference> allRefs = queue.list(filter);
- // for (MessageReference messageReference : allRefs)
- // {
- // messagingServer.getPersistenceManager().deleteReference(messageReference);
- // queue.removeReference(messageReference);
- // }
- // }
- // }
-
- // public void removeMessageForAddress(String binding, Filter filter) throws
- // Exception
- // {
- // List<Binding> bindings =
- // messagingServer.getPostOffice().getBindingsForAddress(binding);
- // for (Binding binding1 : bindings)
- // {
- // removeMessageForBinding(binding1.getQueue().getName(), filter);
- // }
- // }
-
- public List<Queue> getQueuesForAddress(SimpleString address)
+ public List<Queue> getQueuesForAddress(final SimpleString address)
throws Exception
{
List<Queue> queues = new ArrayList<Queue>();
@@ -349,270 +278,35 @@
return queues;
}
- public int getMessageCountForQueue(SimpleString queue) throws Exception
- {
- return getQueue(queue).getMessageCount();
- }
-
- public void setSecurityForAddress(String address, Set<Role> roles)
+ public void setSecurityForAddress(final String address, final Set<Role> roles)
throws Exception
{
this.securityRepository.addMatch(address, roles);
}
- public void removeSecurityForAddress(String address) throws Exception
+ public void removeSecurityForAddress(final String address) throws Exception
{
this.securityRepository.removeMatch(address);
}
- public Set<Role> getSecurityForAddress(String address) throws Exception
+ public Set<Role> getSecurityForAddress(final String address)
+ throws Exception
{
return this.securityRepository.getMatch(address);
}
- public void setQueueAttributes(String queueName, QueueSettings settings)
- throws Exception
+ public void setQueueAttributes(final String queueName,
+ final QueueSettings settings) throws Exception
{
this.queueSettingsRepository.addMatch(queueName, settings);
}
- //
- // public int getMaxMessageCounters()
- // {
- // return maxMessageCounters;
- // }
- //
- // public void setMaxMessageCounters(int maxMessageCounters)
- // {
- // this.maxMessageCounters = maxMessageCounters;
- // }
- //
- // public void registerMessageCounter(final SimpleString queueName) throws
- // Exception
- // {
- // if (currentCounters.get(queueName) != null)
- // {
- // throw new IllegalStateException("Message Counter Already Registered");
- // }
- // Binding binding = messagingServer.getPostOffice().getBinding(queueName);
- // if (binding == null)
- // {
- // throw new MessagingException(MessagingException.QUEUE_DOES_NOT_EXIST);
- // }
- // Queue queue = binding.getQueue();
- // currentCounters.put(queueName, new MessageCounter(queue.getName(), queue,
- // queue.isDurable(),
- // messagingServer.getQueueSettingsRepository().getMatch(queue.getName()).
- // getMessageCounterHistoryDayLimit()));
- // }
- //
- // public void unregisterMessageCounter(final SimpleString queueName) throws
- // Exception
- // {
- // if (currentCounters.get(queueName) == null)
- // {
- // throw new MessagingException(MessagingException.ILLEGAL_STATE,
- // "Counter is not registered");
- // }
- // currentCounters.remove(queueName);
- // if (currentRunningCounters.get(queueName) != null)
- // {
- // currentRunningCounters.get(queueName).cancel(true);
- // currentRunningCounters.remove(queueName);
- // }
- // }
- //
- // public void startMessageCounter(final String SimpleString, long duration)
- // throws Exception
- // {
- // MessageCounter messageCounter = currentCounters.get(queueName);
- // if (messageCounter == null)
- // {
- // Binding binding = messagingServer.getPostOffice().getBinding(queueName);
- // if (binding == null)
- // {
- // throw new MessagingException(MessagingException.QUEUE_DOES_NOT_EXIST);
- // }
- // Queue queue = binding.getQueue();
- // messageCounter = new MessageCounter(queue.getName(), queue,
- // queue.isDurable(),
- // messagingServer.getQueueSettingsRepository().getMatch(queue.getName()).
- // getMessageCounterHistoryDayLimit());
- // }
- // currentCounters.put(queueName, messageCounter);
- // messageCounter.resetCounter();
- // if (duration > 0)
- // {
- //
- // ScheduledFuture future = scheduler.schedule(new Runnable()
- // {
- // public void run()
- // {
- // currentCounters.get(queueName).sample();
- // }
- // }, duration, TimeUnit.SECONDS);
- // currentRunningCounters.put(queueName, future);
- // }
- // }
- //
- // public MessageCounter stopMessageCounter(SimpleString queueName) throws
- // Exception
- // {
- // MessageCounter messageCounter = currentCounters.get(queueName);
- // if (messageCounter == null)
- // {
- // throw new IllegalArgumentException(queueName + "counter not registered");
- // }
- // if (currentRunningCounters.get(queueName) != null)
- // {
- // currentRunningCounters.get(queueName).cancel(true);
- // currentRunningCounters.remove(queueName);
- // }
- // messageCounter.sample();
- // return messageCounter;
- // }
- //
- // public MessageCounter getMessageCounter(SimpleString queueName)
- // {
- // MessageCounter messageCounter = currentCounters.get(queueName);
- // if (messageCounter != null && currentRunningCounters.get(queueName) ==
- // null)
- // {
- // messageCounter.sample();
- // }
- // return messageCounter;
- // }
- //
- //
- // public Collection<MessageCounter> getMessageCounters()
- // {
- // for (String s : currentCounters.keySet())
- // {
- // currentCounters.get(s).sample();
- // }
- // return currentCounters.values();
- // }
- //
- // public void resetMessageCounter(SimpleString queue)
- // {
- // MessageCounter messageCounter = currentCounters.get(queue);
- // if (messageCounter != null)
- // {
- // messageCounter.resetCounter();
- // }
- // }
- //
- // public void resetMessageCounters()
- // {
- // Set<String> counterNames = currentCounters.keySet();
- // for (String counterName : counterNames)
- // {
- // resetMessageCounter(counterName);
- // }
- // }
- //
- // public void resetMessageCounterHistory(SimpleString queue)
- // {
- // MessageCounter messageCounter = currentCounters.get(queue);
- // if (messageCounter != null)
- // {
- // messageCounter.resetHistory();
- // }
- // }
- //
- // public void resetMessageCounterHistories()
- // {
- // Set<String> counterNames = currentCounters.keySet();
- // for (String counterName : counterNames)
- // {
- // resetMessageCounterHistory(counterName);
- // }
- // }
- //
- // public List<MessageCounter> stopAllMessageCounters() throws Exception
- // {
- // Set<String> counterNames = currentCounters.keySet();
- // List<MessageCounter> messageCounters = new ArrayList<MessageCounter>();
- // for (String counterName : counterNames)
- // {
- // messageCounters.add(stopMessageCounter(counterName));
- // }
- // return messageCounters;
- // }
- //
- // public void unregisterAllMessageCounters() throws Exception
- // {
- // Set<String> counterNames = currentCounters.keySet();
- // for (String counterName : counterNames)
- // {
- // unregisterMessageCounter(counterName);
- // }
- // }
- //
- // public int getConsumerCountForQueue(SimpleString queue) throws Exception
- // {
- // return getQueue(queue).getConsumerCount();
- // }
- //
- // public List<ServerConnection> getActiveConnections()
- // {
- // return messagingServer.getConnectionManager().getActiveConnections();
- // }
-
- // public void moveMessages(String fromQueue, String toQueue, String filter)
- // throws Exception
- // {
- // Filter actFilter = new FilterImpl(filter);
- // Queue from = getQueue(fromQueue);
- // Queue to = getQueue(toQueue);
- // List<MessageReference> messageReferences = from.list(actFilter);
- // for (MessageReference messageReference : messageReferences)
- // {
- // from.move(messageReference, to, messagingServer.getPersistenceManager());
- // }
- //
- // }
- //
- // public void expireMessages(SimpleString queue, SimpleString filter) throws
- // Exception
- // {
- // Filter actFilter = new FilterImpl(filter);
- // List<MessageReference> allRefs = getQueue(queue).list(actFilter);
- // for (MessageReference messageReference : allRefs)
- // {
- // messageReference.getMessage().setExpiration(System.currentTimeMillis());
- // }
- // }
-
- // public void changeMessagePriority(String queue, String filter, int
- // priority) throws Exception
- // {
- // Filter actFilter = new FilterImpl(filter);
- // List<MessageReference> allRefs = getQueue(queue).list(actFilter);
- // for (MessageReference messageReference : allRefs)
- // {
- // List<MessageReference> allRefsForMessage =
- // messageReference.getMessage().getReferences();
- // for (MessageReference reference : allRefsForMessage)
- // {
- // reference.getQueue().changePriority(reference, priority);
- // }
- // messageReference.getMessage().setPriority((byte) priority);
- // }
- //
- // }
- //
- // public Set<SimpleString> listAvailableAddresses()
- // {
- // return messagingServer.getPostOffice().listAllDestinations();
- // }
-
public Configuration getConfiguration()
{
return configuration;
}
- public Queue getQueue(SimpleString queueName) throws Exception
+ public Queue getQueue(final SimpleString queueName) throws Exception
{
Binding binding = postOffice.getBinding(queueName);
if (binding == null)
@@ -623,26 +317,11 @@
return binding.getQueue();
}
- // Private
- // --------------------------------------------------------------------
- // -------
+ // Package protected ---------------------------------------------
- // public void start() throws Exception
- // {
- // //scheduler = Executors.newScheduledThreadPool(maxMessageCounters);
- // }
- //
- // public void stop() throws Exception
- // {
- // // if (scheduler != null)
- // // {
- // // scheduler.shutdown();
- // // }
- // }
+ // Protected -----------------------------------------------------
- // protected void finalize() throws Throwable
- // {
- // super.finalize();
- //
- // }
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/QueueControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/QueueControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/management/impl/QueueControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -66,9 +66,9 @@
// Constructors --------------------------------------------------
- public QueueControl(Queue queue, StorageManager storageManager,
- PostOffice postOffice,
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ public QueueControl(final Queue queue, final StorageManager storageManager,
+ final PostOffice postOffice,
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
throws NotCompliantMBeanException
{
super(QueueControlMBean.class);
@@ -147,7 +147,7 @@
{
return queue.getSizeBytes();
}
-
+
public String getDLQ()
{
return queueSettingsRepository.getMatch(getName()).getDLQ().toString();
@@ -155,7 +155,8 @@
public String getExpiryQueue()
{
- return queueSettingsRepository.getMatch(getName()).getExpiryQueue().toString();
+ return queueSettingsRepository.getMatch(getName()).getExpiryQueue()
+ .toString();
}
public TabularData listAllMessages() throws Exception
@@ -163,7 +164,7 @@
return listMessages(null);
}
- public TabularData listMessages(String filterStr) throws Exception
+ public TabularData listMessages(final String filterStr) throws Exception
{
try
{
@@ -206,7 +207,7 @@
}
}
- public boolean removeMessage(long messageID) throws Exception
+ public boolean removeMessage(final long messageID) throws Exception
{
try
{
@@ -217,12 +218,13 @@
}
}
- public boolean expireMessage(long messageID) throws Exception
+ public boolean expireMessage(final long messageID) throws Exception
{
- return queue.expireMessage(messageID, storageManager, postOffice, queueSettingsRepository);
+ return queue.expireMessage(messageID, storageManager, postOffice,
+ queueSettingsRepository);
}
- public int expireMessages(String filterStr) throws Exception
+ public int expireMessages(final String filterStr) throws Exception
{
try
{
@@ -234,7 +236,8 @@
List<MessageReference> refs = queue.list(filter);
for (MessageReference ref : refs)
{
- queue.expireMessage(ref.getMessage().getMessageID(), storageManager, postOffice, queueSettingsRepository);
+ queue.expireMessage(ref.getMessage().getMessageID(),
+ storageManager, postOffice, queueSettingsRepository);
}
return refs.size();
} catch (MessagingException e)
@@ -243,7 +246,7 @@
}
}
- public boolean moveMessage(long messageID, String otherQueueName)
+ public boolean moveMessage(final long messageID, final String otherQueueName)
throws Exception
{
Binding binding = postOffice.getBinding(new SimpleString(otherQueueName));
@@ -256,20 +259,22 @@
return queue.moveMessage(messageID, binding, storageManager, postOffice);
}
- public boolean sendMessageToDLQ(long messageID) throws Exception
+ public boolean sendMessageToDLQ(final long messageID) throws Exception
{
- return queue.sendMessageToDLQ(messageID, storageManager, postOffice, queueSettingsRepository);
+ return queue.sendMessageToDLQ(messageID, storageManager, postOffice,
+ queueSettingsRepository);
}
- public boolean changeMessagePriority(long messageID, int newPriority)
- throws Exception
+ public boolean changeMessagePriority(final long messageID,
+ final int newPriority) throws Exception
{
if (newPriority < 0 || newPriority > 9)
{
throw new IllegalArgumentException("invalid newPriority value: "
+ newPriority + ". It must be between 0 and 9 (both included)");
}
- return queue.changeMessagePriority(messageID, (byte) newPriority, storageManager, postOffice, queueSettingsRepository);
+ return queue.changeMessagePriority(messageID, (byte) newPriority,
+ storageManager, postOffice, queueSettingsRepository);
}
// StandardMBean overrides ---------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/MessageReferenceImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -122,126 +122,140 @@
return queue;
}
- public boolean cancel(final StorageManager persistenceManager, final PostOffice postOffice,
- final HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception
- {
+ public boolean cancel(final StorageManager persistenceManager,
+ final PostOffice postOffice,
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ throws Exception
+ {
if (message.isDurable() && queue.isDurable())
{
persistenceManager.updateDeliveryCount(this);
}
-
- int maxDeliveries = queueSettingsRepository.getMatch(queue.getName().toString()).getMaxDeliveryAttempts();
-
+
+ int maxDeliveries = queueSettingsRepository.getMatch(
+ queue.getName().toString()).getMaxDeliveryAttempts();
+
if (maxDeliveries > 0 && deliveryCount >= maxDeliveries)
{
- SimpleString DLQ = queueSettingsRepository.getMatch(queue.getName().toString()).getDLQ();
-
+ SimpleString DLQ = queueSettingsRepository.getMatch(
+ queue.getName().toString()).getDLQ();
+
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
-
+
if (DLQ != null)
{
- Binding binding = postOffice.getBinding(DLQ);
-
- if (binding == null)
- {
- binding = postOffice.addBinding(DLQ, DLQ, null, true, false);
- }
-
- ServerMessage copyMessage = makeCopyForDLQOrExpiry(false, persistenceManager);
+ Binding binding = postOffice.getBinding(DLQ);
+
+ if (binding == null)
+ {
+ binding = postOffice.addBinding(DLQ, DLQ, null, true, false);
+ }
+
+ ServerMessage copyMessage = makeCopyForDLQOrExpiry(false,
+ persistenceManager);
copyMessage.setDestination(binding.getAddress());
-
+
tx.addMessage(copyMessage);
-
- tx.addAcknowledgement(this);
+
+ tx.addAcknowledgement(this);
+ } else
+ {
+ // No DLQ
+
+ log
+ .warn("Message has reached maximum delivery attempts, no DLQ is configured so dropping it");
+
+ tx.addAcknowledgement(this);
}
- else
- {
- //No DLQ
-
- log.warn("Message has reached maximum delivery attempts, no DLQ is configured so dropping it");
-
- tx.addAcknowledgement(this);
- }
-
+
tx.commit();
-
+
return false;
- }
- else
- {
- queue.referenceCancelled();
+ } else
+ {
+ queue.referenceCancelled();
return true;
}
}
-
- public void sendToDLQ(StorageManager persistenceManager,
- PostOffice postOffice,
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
+
+ public void sendToDLQ(final StorageManager persistenceManager,
+ final PostOffice postOffice,
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
throws Exception
{
- SimpleString dlq = queueSettingsRepository.getMatch(queue.getName().toString()).getDLQ();
-
+ SimpleString dlq = queueSettingsRepository.getMatch(
+ queue.getName().toString()).getDLQ();
+
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
-
+
if (dlq != null)
{
Binding binding = postOffice.getBinding(dlq);
-
+
if (binding == null)
{
binding = postOffice.addBinding(dlq, dlq, null, true, false);
}
-
- ServerMessage copyMessage = makeCopyForDLQOrExpiry(false, persistenceManager);
+
+ ServerMessage copyMessage = makeCopyForDLQOrExpiry(false,
+ persistenceManager);
copyMessage.setDestination(binding.getAddress());
-
+
tx.addMessage(copyMessage);
-
- tx.addAcknowledgement(this);
-
+
+ tx.addAcknowledgement(this);
+
tx.commit();
} else
{
- throw new IllegalStateException("No DLQ configured for queue " + queue.getName());
+ throw new IllegalStateException("No DLQ configured for queue "
+ + queue.getName());
}
}
- public void expire(final StorageManager persistenceManager, final PostOffice postOffice,
- final HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception
+ public void expire(final StorageManager persistenceManager,
+ final PostOffice postOffice,
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ throws Exception
{
- SimpleString expiryQueue = queueSettingsRepository.getMatch(queue.getName().toString()).getExpiryQueue();
-
+ SimpleString expiryQueue = queueSettingsRepository.getMatch(
+ queue.getName().toString()).getExpiryQueue();
+
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
-
+
if (expiryQueue != null)
{
- Binding binding = postOffice.getBinding(expiryQueue);
+ Binding binding = postOffice.getBinding(expiryQueue);
- if (binding == null)
- {
- binding = postOffice.addBinding(expiryQueue, expiryQueue, null, true, false);
- }
-
- ServerMessage copyMessage = makeCopyForDLQOrExpiry(true, persistenceManager);
-
+ if (binding == null)
+ {
+ binding = postOffice.addBinding(expiryQueue, expiryQueue, null,
+ true, false);
+ }
+
+ ServerMessage copyMessage = makeCopyForDLQOrExpiry(true,
+ persistenceManager);
+
copyMessage.setDestination(binding.getAddress());
-
+
tx.addMessage(copyMessage);
-
- tx.addAcknowledgement(this);
- }
- else
+
+ tx.addAcknowledgement(this);
+ } else
{
- log.warn("Message has expired, no expiry queue is configured so dropping it");
-
+ log
+ .warn("Message has expired, no expiry queue is configured so dropping it");
+
tx.addAcknowledgement(this);
}
-
+
tx.commit();
}
- public void move(final Binding otherBinding, final StorageManager persistenceManager, final PostOffice postOffice) throws Exception
+ public void move(final Binding otherBinding,
+ final StorageManager persistenceManager, final PostOffice postOffice)
+ throws Exception
{
Transaction tx = new TransactionImpl(persistenceManager, postOffice);
@@ -250,10 +264,9 @@
tx.addMessage(copyMessage);
- tx.addAcknowledgement(this);
+ tx.addAcknowledgement(this);
tx.commit();
-
}
// Public --------------------------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -491,7 +491,7 @@
tx.commit();
}
- public synchronized boolean deleteReference(long messageID, final StorageManager storageManager) throws Exception
+ public synchronized boolean deleteReference(final long messageID, final StorageManager storageManager) throws Exception
{
boolean deleted = false;
@@ -579,9 +579,9 @@
return false;
}
- public boolean changeMessagePriority(long messageID, byte newPriority,
- StorageManager storageManager, PostOffice postOffice,
- HierarchicalRepository<QueueSettings> queueSettingsRepository)
+ public boolean changeMessagePriority(final long messageID, final byte newPriority,
+ final StorageManager storageManager, final PostOffice postOffice,
+ final HierarchicalRepository<QueueSettings> queueSettingsRepository)
throws Exception
{
List<MessageReference> refs = list(null);
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/JMSServerManager.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -22,20 +22,19 @@
package org.jboss.messaging.jms.server;
-import java.io.Serializable;
import java.util.List;
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.settings.impl.QueueSettings;
import org.jboss.messaging.jms.JBossDestination;
-import org.jboss.messaging.jms.JBossQueue;
/**
* The JMS Management interface.
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
*/
-public interface JMSServerManager extends Serializable
+public interface JMSServerManager
{
String getVersion();
@@ -97,24 +96,6 @@
*/
boolean destroyTopic(String name) throws Exception;
- // /**
- // * returns a list of all the JMS queues
- // * @return all queues
- // */
- // Set<String> listAllQueues();
- //
- // /**
- // * returns a list of all the JMS topics
- // * @return all topics
- // */
- // Set<String> listAllTopics();
- //
- // /**
- // * returns all the temporary destinations
- // * @return all temporary destinations
- // */
- // Set<String> listTemporaryDestinations();
-
/**
* Creates a connection factory
*
@@ -188,67 +169,6 @@
*/
boolean destroyConnectionFactory(String name) throws Exception;
- // /**
- // * list all messages for a specific queue
- // * @param queue the queue to inspect
- // * @return all messages
- // * @throws Exception if a problem occurred
- // */
- // public List<Message> listMessagesForQueue(String queue) throws Exception;
- //
- // /**
- // * list the messages on a specific queue dependant on the ListType.
- // * ListType.ALL returns all messages
- // * ListType.DURABLE returns all durable messages
- // * ListType.NON_DURABLE returns all non durable messages
- // * @param queue the queue to inspect
- // * @param listType the list type.
- // * @return the messages
- // * @throws Exception if a problem occurred
- // */
- // public List<Message> listMessagesForQueue(String queue, ListType listType)
- // throws Exception;
- //
- // /**
- // * list all messages for a specific subscription
- // * @param subscription the subscription to inspect
- // * @return all messages
- // * @throws Exception if a problem occurred
- // */
- // public List<Message> listMessagesForSubscription(String subscription)
- // throws Exception;
- //
- // /**
- // * list the messages on a specific subscription dependant on the ListType.
- // * ListType.ALL returns all messages
- // * ListType.DURABLE returns all durable messages
- // * ListType.NON_DURABLE returns all non durable messages
- // * @param subscription the subscription to inspect
- // * @param listType the list type
- // * @return the messages
- // * @throws Exception if a problem occurred
- // */
- // public List<Message> listMessagesForSubscription(String subscription,
- // ListType listType) throws Exception;
- //
- // /**
- // * removes a particular message from a queue
- // * @param queue the name of the queue
- // * @param messageId the id of the message to remove
- // * @throws Exception if a problem occurred
- // */
- // // void removeMessageFromQueue(String queue, String messageId) throws
- // Exception;
- //
- // /**
- // * removes a particular message from a topic
- // * @param topic the name of the topic
- // * @param messageId the id of the message
- // * @throws Exception if a problem occurred
- // */
- // // void removeMessageFromTopic(String topic, String messageId) throws
- // Exception;
-
/**
* removes all messages from a particular destination
*
@@ -272,181 +192,4 @@
int changeMessagesPriority(Filter filter, byte newPriority,
JBossDestination destination) throws Exception;
-
- //
- // /**
- // * moves a message from one queue to another
- // * @param fromQueue the name of the queue to find the message
- // * @param toQueue the name of the queue to move the message to
- // * @param messageID the id of the message
- // * @throws Exception if a problem occurred
- // */
- // //void moveMessage(String fromQueue, String toQueue, String messageID)
- // throws Exception;
- //
- // /**
- // * expires a message
- // * @param queue the name of the queue
- // * @param messageId the message id
- // * @throws Exception if a problem occurred
- // */
- // void expireMessage(String queue, String messageId) throws Exception;
- //
- // /**
- // * changes the priority of a message.
- // * @param queue the name of the queue
- // * @param messageId the id of the message
- // * @param priority the priority to change the message to
- // * @throws Exception if a problem occurred
- // */
- // // void changeMessagePriority(String queue, String messageId, int
- // priority) throws Exception;
- //
- //
- // /**
- // * lists all the subscriptions for a specific topic for a specific
- // ListType.
- // * ListType.ALL returns all subscriptions
- // * ListType.DURABLE returns all durable subscriptions
- // * ListType.NON_DURABLE returns all non durable subscriptions
- // *
- // * @param topicName the name of the topic
- // * @param listType the list type
- // * @return the subscriptions
- // * @throws Exception if a problem occurred
- // */
- // List<SubscriptionInfo> listSubscriptions(String topicName, ListType
- // listType) throws Exception;
- //
- // /**
- // * count the subscriptions a topic currently has
- // * @param topic the name of the topic
- // * @return the number of subscriptions
- // * @throws Exception if a problem occurred
- // */
- // int getSubscriptionsCountForTopic(String topic) throws Exception;
- //
- // /**
- // * count the subscriptions a topic currently has of a specific type.
- // * ListType.ALL returns all subscriptions
- // * ListType.DURABLE returns all durable subscriptions
- // * ListType.NON_DURABLE returns all non durable subscriptions
- // *
- // * @param topic the name of the topic
- // * @param listType the list type
- // * @return the number of subscriptions
- // * @throws Exception if a problem occurred
- // */
- // int getSubscriptionsCountForTopic(String topic, ListType listType) throws
- // Exception;
- //
- // /**
- // * drops a particular subscription
- // *
- // * @param subscription the id of the subscription
- // * @throws Exception if a problem occurred
- // */
- // void dropSubscription(String subscription) throws Exception;
- //
- // /**
- // * count the consumers for a specific queue
- // * @param queue the name of the queue
- // * @return the number of consumers
- // * @throws Exception if a problem occurred
- // */
- // int getConsumerCountForQueue(String queue) throws Exception;
- //
- // /**
- // * returns info on all the current active connections
- // * @return the connections info
- // * @throws Exception if a problem occurred
- // */
- // List<ConnectionInfo> getConnections() throws Exception;
- //
- // /**
- // * return the connections info for a particular user.
- // * @param user the user
- // * @return the connections info
- // * @throws Exception if a problem occurred
- // */
- // List<ConnectionInfo> getConnectionsForUser(String user) throws Exception;
- //
- // /**
- // * drops the connection with the specified client id
- // * @param clientId the client id
- // * @throws Exception if a problem occurred
- // */
- // void dropConnection(long id) throws Exception;
- //
- // /**
- // * drop all the connections for a specific user
- // * @param user the user
- // * @throws Exception if a problem occurred
- // */
- // void dropConnectionsForUser(String user) throws Exception;
- //
- // /**
- // * list all the sessions info
- // * @return the session info
- // * @throws Exception if a problem occurred
- // */
- // //public List<SessionInfo> getSessions() throws Exception;
- //
- // /**
- // * get the session info for a particular connection with the specified
- // client id
- // * @param clientid the client id
- // * @return the session info
- // * @throws Exception if a problem occurred
- // */
- // // public List<SessionInfo> getSessionsForConnection(long id) throws
- // Exception;
- //
- // /**
- // * get the session info for a particular user
- // * @param user the user
- // * @return the session info
- // * @throws Exception if a problem occurred
- // */
- // // public List<SessionInfo> getSessionsForUser(String user) throws
- // Exception;
- //
- // /**
- // * Start gathering delivery statistics for all queues
- // * @throws Exception if a problem occurred
- // */
- // void startGatheringStatistics() throws Exception;
- //
- // /**
- // * Start gathering delivery statistics for a specified queue
- // * @param queue the name of the queue
- // * @throws Exception if a problem occurred
- // */
- // void startGatheringStatisticsForQueue(String queue) throws Exception;
- //
- // /**
- // * stop gathering delivery statistics for all queues
- // * @return the delivery statistics at the time of stopping gathering
- // * @throws Exception if a problem occurred
- // */
- // List<MessageStatistics> stopGatheringStatistics() throws Exception;
- //
- // /**
- // * stop gathering statistics for a specified queue
- // * @param queue the name of the queue
- // * @return the delivery statistics for that queue at the time of stopping
- // gathering
- // * @throws Exception if a problem occurred
- // */
- // MessageStatistics stopGatheringStatisticsForQueue(String queue) throws
- // Exception;
- //
- // /**
- // * list all message delivery statistics. This will include statistics up to
- // the point this method is called.
- // * The gathering of statistics will carry on.
- // * @return the delivery statistics
- // * @throws Exception if a problem occurred
- // */
- // List<MessageStatistics> getStatistics() throws Exception;
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/impl/JMSServerManagerImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -18,7 +18,7 @@
* 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.jms.server.impl;
@@ -47,14 +47,16 @@
import org.jboss.messaging.util.JNDIUtil;
/**
- * A Deployer used to create and add to JNDI queues, topics and connection factories. Typically this would only be used
- * in an app server env.
- *
+ * A Deployer used to create and add to JNDI queues, topics and connection
+ * factories. Typically this would only be used in an app server env.
+ *
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
*/
public class JMSServerManagerImpl implements JMSServerManager
{
- private static final Logger log = Logger.getLogger(JMSServerManagerImpl.class);
+ private static final Logger log = Logger
+ .getLogger(JMSServerManagerImpl.class);
/**
* the initial context to bind to
@@ -70,91 +72,58 @@
private final MessagingServerManagement messagingServerManagement;
private JMSManagementRegistration managementRegistration;
-
+
public JMSServerManagerImpl(final MessagingServerManagement serverManager)
{
messagingServerManagement = serverManager;
- managementRegistration = new JMSManagementRegistrationImpl(ManagementFactory.getPlatformMBeanServer());
+ managementRegistration = new JMSManagementRegistrationImpl(
+ ManagementFactory.getPlatformMBeanServer());
}
- /**
- * lifecycle method
- *
- * @throws Exception ex
- */
public void start() throws Exception
{
try
{
- initialContext = new InitialContext();
- }
- catch (NamingException e)
+ initialContext = new InitialContext();
+ } catch (NamingException e)
{
log.error("Unable to create Initial Context", e);
}
managementRegistration.registerJMSServer(this);
}
+ // JMSServerManager implementation -------------------------------
- private boolean bindToJndi(final String jndiName, final Object objectToBind) throws NamingException
- {
- String parentContext;
- String jndiNameInContext;
- int sepIndex = jndiName.lastIndexOf('/');
- if (sepIndex == -1)
- {
- parentContext = "";
- }
- else
- {
- parentContext = jndiName.substring(0, sepIndex);
- }
- jndiNameInContext = jndiName.substring(sepIndex + 1);
- try
- {
- initialContext.lookup(jndiName);
-
- log.warn("Binding for " + jndiName + " already exists");
- return false;
- }
- catch (Throwable e)
- {
- // OK
- }
-
- Context c = JNDIUtil.createContext(initialContext, parentContext);
-
- c.rebind(jndiNameInContext, objectToBind);
- return true;
- }
-
- // management operations
-
public boolean isStarted()
{
return messagingServerManagement.isStarted();
}
-
+
public String getVersion()
{
return messagingServerManagement.getVersion();
}
- public boolean createQueue(String queueName, String jndiBinding) throws Exception
+ public boolean createQueue(final String queueName, final String jndiBinding)
+ throws Exception
{
JBossQueue jBossQueue = new JBossQueue(queueName);
messagingServerManagement.addDestination(jBossQueue.getSimpleAddress());
- messagingServerManagement.createQueue(jBossQueue.getSimpleAddress(), jBossQueue.getSimpleAddress());
+ messagingServerManagement.createQueue(jBossQueue.getSimpleAddress(),
+ jBossQueue.getSimpleAddress());
boolean added = bindToJndi(jndiBinding, jBossQueue);
if (added)
{
addToDestinationBindings(queueName, jndiBinding);
}
- managementRegistration.registerQueue(jBossQueue, messagingServerManagement.getQueue(jBossQueue.getSimpleAddress()), jndiBinding, this);
+ managementRegistration.registerQueue(jBossQueue,
+ messagingServerManagement.getQueue(jBossQueue.getSimpleAddress()),
+ jndiBinding, this);
return added;
}
- public boolean createTopic(String topicName, String jndiBinding) throws Exception
+ public boolean createTopic(final String topicName, final String jndiBinding)
+ throws Exception
{
JBossTopic jBossTopic = new JBossTopic(topicName);
messagingServerManagement.addDestination(jBossTopic.getSimpleAddress());
@@ -163,11 +132,12 @@
{
addToDestinationBindings(topicName, jndiBinding);
}
- managementRegistration.registerTopic(jBossTopic, messagingServerManagement, jndiBinding);
+ managementRegistration.registerTopic(jBossTopic,
+ messagingServerManagement, jndiBinding);
return added;
}
- public boolean destroyQueue(String name) throws Exception
+ public boolean destroyQueue(final String name) throws Exception
{
List<String> jndiBindings = destinations.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
@@ -180,13 +150,15 @@
}
destinations.remove(name);
managementRegistration.unregisterQueue(name);
- messagingServerManagement.removeDestination(JBossQueue.createAddressFromName(name));
- messagingServerManagement.destroyQueue(JBossQueue.createAddressFromName(name));
-
+ messagingServerManagement.removeDestination(JBossQueue
+ .createAddressFromName(name));
+ messagingServerManagement.destroyQueue(JBossQueue
+ .createAddressFromName(name));
+
return true;
}
- public boolean destroyTopic(String name) throws Exception
+ public boolean destroyTopic(final String name) throws Exception
{
List<String> jndiBindings = destinations.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
@@ -199,75 +171,37 @@
}
destinations.remove(name);
managementRegistration.unregisterTopic(name);
- messagingServerManagement.removeDestination(JBossTopic.createAddressFromName(name));
-
+ messagingServerManagement.removeDestination(JBossTopic
+ .createAddressFromName(name));
+
return true;
}
- public QueueSettings getSettings(JBossDestination destination)
+ public QueueSettings getSettings(final JBossDestination destination)
{
- return messagingServerManagement.getQueueSettings(destination.getSimpleAddress());
+ return messagingServerManagement.getQueueSettings(destination
+ .getSimpleAddress());
}
-
-// public Set<String> listAllQueues()
-// {
-// Set<String> availableAddresses = messagingServerManagement.listAvailableAddresses();
-// Set<String> availableQueues = new HashSet<String>();
-// for (String address : availableAddresses)
-// {
-// if (address.startsWith(JBossQueue.JMS_QUEUE_ADDRESS_PREFIX))
-// {
-// availableQueues.add(address.replace(JBossQueue.JMS_QUEUE_ADDRESS_PREFIX, ""));
-// }
-// }
-// return availableQueues;
-// }
-//
-// public Set<String> listAllTopics()
-// {
-// Set<String> availableAddresses = messagingServerManagement.listAvailableAddresses();
-// Set<String> availableTopics = new HashSet<String>();
-// for (String address : availableAddresses)
-// {
-// if (address.startsWith(JBossTopic.JMS_TOPIC_ADDRESS_PREFIX))
-// {
-// availableTopics.add(address.replace(JBossTopic.JMS_TOPIC_ADDRESS_PREFIX, ""));
-// }
-// }
-// return availableTopics;
-// }
-//
-// public Set<String> listTemporaryDestinations()
-// {
-// Set<String> availableAddresses = messagingServerManagement.listAvailableAddresses();
-// Set<String> tempDests = new HashSet<String>();
-// for (String address : availableAddresses)
-// {
-// if (address.startsWith(JBossTemporaryTopic.JMS_TOPIC_ADDRESS_PREFIX) || address.startsWith(JBossTemporaryQueue.JMS_QUEUE_ADDRESS_PREFIX))
-// {
-// tempDests.add(address.replace(JBossTopic.JMS_TOPIC_ADDRESS_PREFIX, ""));
-// }
-// }
-// return tempDests;
-// }
- public boolean createConnectionFactory(String name, String clientID,
- int dupsOKBatchSize, int consumerWindowSize, int consumerMaxRate,
- int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking, boolean defaultSendPersistentMessagesBlocking,
- String jndiBinding) throws Exception
+ public boolean createConnectionFactory(final String name,
+ final String clientID, final int dupsOKBatchSize,
+ final int consumerWindowSize, final int consumerMaxRate,
+ final int producerWindowSize, final int producerMaxRate,
+ final boolean blockOnAcknowledge,
+ final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking,
+ final String jndiBinding) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = new JBossConnectionFactory( clientID, dupsOKBatchSize,
- messagingServerManagement.getConfiguration().getLocation(),
- messagingServerManagement.getConfiguration().getConnectionParams(),
- consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
- blockOnAcknowledge,
- defaultSendNonPersistentMessagesBlocking,
- defaultSendPersistentMessagesBlocking
- );
+ cf = new JBossConnectionFactory(clientID, dupsOKBatchSize,
+ messagingServerManagement.getConfiguration().getLocation(),
+ messagingServerManagement.getConfiguration()
+ .getConnectionParams(), consumerWindowSize,
+ consumerMaxRate, producerWindowSize, producerMaxRate,
+ blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking);
connectionFactories.put(name, cf);
}
if (!bindToJndi(jndiBinding, cf))
@@ -279,32 +213,33 @@
connectionFactoryBindings.put(name, new ArrayList<String>());
}
connectionFactoryBindings.get(name).add(jndiBinding);
-
+
List<String> bindings = new ArrayList<String>();
bindings.add(jndiBinding);
-
+
managementRegistration.registerConnectionFactory(name, cf, bindings);
return true;
}
-
- public boolean createConnectionFactory(String name, String clientID, int dupsOKBatchSize,
- int consumerWindowSize, int consumerMaxRate,
- int producerWindowSize, int producerMaxRate, boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking,
- boolean defaultSendPersistentMessagesBlocking,
- List<String> jndiBindings) throws Exception
+ public boolean createConnectionFactory(final String name,
+ final String clientID, final int dupsOKBatchSize,
+ final int consumerWindowSize, final int consumerMaxRate,
+ final int producerWindowSize, final int producerMaxRate,
+ final boolean blockOnAcknowledge,
+ final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking,
+ final List<String> jndiBindings) throws Exception
{
JBossConnectionFactory cf = connectionFactories.get(name);
if (cf == null)
{
- cf = new JBossConnectionFactory( clientID, dupsOKBatchSize,
- messagingServerManagement.getConfiguration().getLocation(),
- messagingServerManagement.getConfiguration().getConnectionParams(),
- consumerWindowSize, consumerMaxRate, producerWindowSize, producerMaxRate,
- blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
- defaultSendPersistentMessagesBlocking
- );
+ cf = new JBossConnectionFactory(clientID, dupsOKBatchSize,
+ messagingServerManagement.getConfiguration().getLocation(),
+ messagingServerManagement.getConfiguration()
+ .getConnectionParams(), consumerWindowSize,
+ consumerMaxRate, producerWindowSize, producerMaxRate,
+ blockOnAcknowledge, defaultSendNonPersistentMessagesBlocking,
+ defaultSendPersistentMessagesBlocking);
}
for (String jndiBinding : jndiBindings)
{
@@ -321,7 +256,7 @@
return true;
}
- public boolean destroyConnectionFactory(String name) throws Exception
+ public boolean destroyConnectionFactory(final String name) throws Exception
{
List<String> jndiBindings = connectionFactoryBindings.get(name);
if (jndiBindings == null || jndiBindings.size() == 0)
@@ -334,334 +269,102 @@
}
connectionFactoryBindings.remove(name);
connectionFactories.remove(name);
-
+
managementRegistration.unregisterConnectionFactory(name);
-
+
return true;
}
-
-// public List<Message> listMessagesForQueue(String queue) throws Exception
-// {
-// return listMessagesForQueue(queue, ListType.ALL);
-// }
-//
-// public List<Message> listMessagesForQueue(String queue, ListType listType) throws Exception
-// {
-// return listMessages(new JBossQueue(queue).getAddress(), listType);
-// }
-//
-// public List<Message> listMessagesForSubscription(String subscription) throws Exception
-// {
-// return listMessagesForSubscription(subscription, ListType.ALL);
-// }
-//
-// public List<Message> listMessagesForSubscription(String subscription, ListType listType) throws Exception
-// {
-// return listMessages(subscription, listType);
-// }
-//
-//// public void removeMessageFromQueue(String queueName, String messageId) throws Exception
-//// {
-//// messagingServerManagement.removeMessageForBinding(new JBossQueue(queueName).getAddress(), new FilterImpl("JMSMessageID='" + messageId + "'"));
-//// }
-////
-//// public void removeMessageFromTopic(String topicName, String messageId) throws Exception
-//// {
-//// messagingServerManagement.removeMessageForAddress(new JBossTopic(topicName).getAddress(), new FilterImpl("JMSMessageID='" + messageId + "'"));
-//// }
-
- public void removeAllMessages(JBossDestination destination) throws Exception
+ public void removeAllMessages(final JBossDestination destination)
+ throws Exception
{
- messagingServerManagement.removeAllMessagesForAddress(destination.getSimpleAddress());
+ messagingServerManagement.removeAllMessagesForAddress(destination
+ .getSimpleAddress());
}
-
- public boolean removeMessage(long messageID, JBossDestination destination) throws Exception
+
+ public boolean removeMessage(final long messageID,
+ final JBossDestination destination) throws Exception
{
- return messagingServerManagement.removeMessageFromAddress(messageID, destination.getSimpleAddress());
+ return messagingServerManagement.removeMessageFromAddress(messageID,
+ destination.getSimpleAddress());
}
-
- public int expireMessages(Filter filter, JBossDestination destination) throws Exception
+
+ public int expireMessages(final Filter filter,
+ final JBossDestination destination) throws Exception
{
- List<MessageReference> refs = messagingServerManagement.expireMessages(filter, destination.getSimpleAddress());
-
+ List<MessageReference> refs = messagingServerManagement.expireMessages(
+ filter, destination.getSimpleAddress());
+
return refs.size();
}
-
- public int sendMessagesToDLQ(Filter filter, JBossDestination destination) throws Exception
+
+ public int sendMessagesToDLQ(final Filter filter,
+ final JBossDestination destination) throws Exception
{
- List<MessageReference> refs = messagingServerManagement.sendMessagesToDLQ(filter, destination.getSimpleAddress());
-
+ List<MessageReference> refs = messagingServerManagement
+ .sendMessagesToDLQ(filter, destination.getSimpleAddress());
+
return refs.size();
}
-
- public int changeMessagesPriority(Filter filter, byte newPriority,
- JBossDestination destination) throws Exception
+
+ public int changeMessagesPriority(final Filter filter,
+ final byte newPriority, final JBossDestination destination)
+ throws Exception
{
- List<MessageReference> refs = messagingServerManagement.changeMessagesPriority(filter, newPriority, destination.getSimpleAddress());
-
+ List<MessageReference> refs = messagingServerManagement
+ .changeMessagesPriority(filter, newPriority, destination
+ .getSimpleAddress());
+
return refs.size();
}
-//
-//// public void moveMessage(String fromQueue, String toQueue, String messageId) throws Exception
-//// {
-//// messagingServerManagement.moveMessages(new JBossQueue(fromQueue).getAddress(), new JBossQueue(toQueue).getAddress(),
-//// "JMSMessageID='" + messageId + "'");
-//// }
-//
-// public void expireMessage(String queue, String messageId) throws Exception
-// {
-// messagingServerManagement.expireMessages(new JBossQueue(queue).getAddress(),
-// "JMSMessageID='" + messageId + "'");
-// }
-//
-//// public void changeMessagePriority(String queue, String messageId, int priority) throws Exception
-//// {
-//// messagingServerManagement.changeMessagePriority(new JBossQueue(queue).getAddress(),
-//// "JMSMessageID='" + messageId + "'", priority);
-//// }
-//
-//
-// public int getSubscriptionsCountForTopic(String topicName) throws Exception
-// {
-// return getSubscriptionsCount(new JBossTopic(topicName));
-// }
-//
-// public int getSubscriptionsCountForTopic(String topicName, ListType listType) throws Exception
-// {
-// return getSubscriptionsCount(new JBossTopic(topicName), listType);
-// }
-//
-// public void dropSubscription(String subscription) throws Exception
-// {
-// messagingServerManagement.destroyQueue(subscription);
-// }
-//
-// public int getConsumerCountForQueue(String queue) throws Exception
-// {
-// return getConsumerCount(new JBossQueue(queue));
-// }
-//
-// public List<ConnectionInfo> getConnections() throws Exception
-// {
-// return getConnectionsForUser(null);
-// }
-//
-// public List<ConnectionInfo> getConnectionsForUser(String user) throws Exception
-// {
-// List<ConnectionInfo> connectionInfos = new ArrayList<ConnectionInfo>();
-// List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
-// for (ServerConnection endpoint : endpoints)
-// {
-// if (user == null || user.equals(endpoint.getUsername()))
-// {
-// connectionInfos.add(new ConnectionInfo(endpoint.getID(),
-// endpoint.getUsername(),
-// endpoint.getClientAddress(),
-// endpoint.isStarted(),
-// endpoint.getCreated()));
-// }
-// }
-// return connectionInfos;
-// }
-//
-// public void dropConnection(long clientId) throws Exception
-// {
-// List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
-// for (ServerConnection endpoint : endpoints)
-// {
-// if (endpoint.getID() == clientId)
-// {
-// endpoint.close();
-// break;
-// }
-// }
-// }
-//
-// public void dropConnectionsForUser(String user) throws Exception
-// {
-// List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
-// List<ConnectionInfo> connectionInfos = getConnectionsForUser(user);
-// for (ConnectionInfo connectionInfo : connectionInfos)
-// {
-// for (ServerConnection endpoint : endpoints)
-// {
-// if (endpoint.getID() == connectionInfo.getId())
-// {
-// endpoint.close();
-// break;
-// }
-// }
-// }
-// }
-//
-//// public List<SessionInfo> getSessions() throws Exception
-//// {
-//// return getSessionsForConnection(null);
-//// }
-////
-//// public List<SessionInfo> getSessionsForConnection(long id) throws Exception
-//// {
-//// List<SessionInfo> sessionInfos = new ArrayList<SessionInfo>();
-//// List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
-//// for (ServerConnection endpoint : endpoints)
-//// {
-//// if (id == endpoint.getID())
-//// {
-//// Collection<ServerSession> serverSessionEndpoints = endpoint.getSessions();
-//// for (ServerSession serverSessionEndpoint : serverSessionEndpoints)
-//// {
-//// sessionInfos.add(new SessionInfo(serverSessionEndpoint.getID(),
-//// endpoint.getID()));
-//// }
-//// }
-//// }
-//// return sessionInfos;
-//// }
-//
-//// public List<SessionInfo> getSessionsForUser(String user) throws Exception
-//// {
-//// List<SessionInfo> sessionInfos = new ArrayList<SessionInfo>();
-//// List<ServerConnection> endpoints = messagingServerManagement.getActiveConnections();
-//// for (ServerConnection endpoint : endpoints)
-//// {
-//// if (user == null || user.equals(endpoint.getUsername()))
-//// {
-//// sessionInfos.addAll(getSessionsForConnection(endpoint.getID()));
-//// }
-//// }
-//// return sessionInfos;
-//// }
-//
-// public void startGatheringStatistics() throws Exception
-// {
-// Set<String> availableAddresses = messagingServerManagement.listAvailableAddresses();
-// for (String address : availableAddresses)
-// {
-// if (address.startsWith(JBossQueue.JMS_QUEUE_ADDRESS_PREFIX))
-// {
-// messagingServerManagement.startMessageCounter(address, 0);
-// }
-// }
-// }
-//
-// public void startGatheringStatisticsForQueue(String queue) throws Exception
-// {
-// JBossQueue jBossQueue = new JBossQueue(queue);
-// messagingServerManagement.startMessageCounter(jBossQueue.getAddress(), 0);
-// }
-//
-// public List<MessageStatistics> stopGatheringStatistics() throws Exception
-// {
-// List<MessageStatistics> messageStatisticses = createStats(messagingServerManagement.stopAllMessageCounters());
-// messagingServerManagement.unregisterAllMessageCounters();
-// return messageStatisticses;
-// }
-//
-// public MessageStatistics stopGatheringStatisticsForQueue(String queue) throws Exception
-// {
-// JBossQueue queue1 = new JBossQueue(queue);
-// MessageCounter counter = messagingServerManagement.stopMessageCounter(queue1.getAddress());
-//
-// MessageStatistics stats = new MessageStatistics();
-// stats.setName(counter.getDestinationName());
-// stats.setDurable(counter.getDestinationDurable());
-// stats.setCount(counter.getMessageCount());
-// stats.setTotalMessageCount(counter.getTotalMessages());
-// stats.setCurrentMessageCount(counter.getCurrentMessageCount());
-// stats.setTimeLastUpdate(counter.getLastUpdate());
-// messagingServerManagement.unregisterMessageCounter(queue1.getAddress());
-// return stats;
-// }
-//
-// public List<MessageStatistics> getStatistics() throws Exception
-// {
-// Collection<MessageCounter> counters = messagingServerManagement.getMessageCounters();
-// return createStats(counters);
-// }
-//
-// private List<MessageStatistics> createStats(Collection<MessageCounter> counters)
-// {
-// List<MessageStatistics> list = new ArrayList<MessageStatistics>(counters.size());
-// for (Object counter1 : counters)
-// {
-// MessageCounter counter = (MessageCounter) counter1;
-//
-// MessageStatistics stats = new MessageStatistics();
-// stats.setName(counter.getDestinationName());
-// stats.setDurable(counter.getDestinationDurable());
-// stats.setCount(counter.getMessageCount());
-// stats.setTotalMessageCount(counter.getTotalMessages());
-// stats.setCurrentMessageCount(counter.getCurrentMessageCount());
-// stats.setTimeLastUpdate(counter.getLastUpdate());
-//
-// list.add(stats);
-// }
-// return list;
-// }
-// //private
-//
- private void addToDestinationBindings(String destination, String jndiBinding)
+
+ // Public --------------------------------------------------------
+
+ public void setInitialContext(final InitialContext initialContext)
{
+ this.initialContext = initialContext;
+ }
+
+ // Private -------------------------------------------------------
+
+ private boolean bindToJndi(final String jndiName, final Object objectToBind)
+ throws NamingException
+ {
+ String parentContext;
+ String jndiNameInContext;
+ int sepIndex = jndiName.lastIndexOf('/');
+ if (sepIndex == -1)
+ {
+ parentContext = "";
+ } else
+ {
+ parentContext = jndiName.substring(0, sepIndex);
+ }
+ jndiNameInContext = jndiName.substring(sepIndex + 1);
+ try
+ {
+ initialContext.lookup(jndiName);
+
+ log.warn("Binding for " + jndiName + " already exists");
+ return false;
+ } catch (Throwable e)
+ {
+ // OK
+ }
+
+ Context c = JNDIUtil.createContext(initialContext, parentContext);
+
+ c.rebind(jndiNameInContext, objectToBind);
+ return true;
+ }
+
+ private void addToDestinationBindings(final String destination,
+ final String jndiBinding)
+ {
if (destinations.get(destination) == null)
{
destinations.put(destination, new ArrayList<String>());
}
destinations.get(destination).add(jndiBinding);
}
-//
-//
-// private List<Message> listMessages(String queue, ListType listType) throws Exception
-// {
-// List<Message> messages = new ArrayList<Message>();
-// Filter filter = null;
-// switch (listType)
-// {
-// case DURABLE:
-// filter = new FilterImpl("JBMDurable='DURABLE'");
-// break;
-// case NON_DURABLE:
-// filter = new FilterImpl("JBMDurable='NON_DURABLE'");
-// break;
-// }
-// List<org.jboss.messaging.core.message.Message> messageList = messagingServerManagement.listMessages(queue, filter);
-// for (org.jboss.messaging.core.message.Message message : messageList)
-// {
-// messages.add(JBossMessage.createMessage(message, null));
-// }
-// return messages;
-// }
-//
-//
-
- private int getMessageCount(JBossQueue queue) throws Exception
- {
- return messagingServerManagement.getMessageCountForQueue(queue.getSimpleAddress());
- }
-//
-// private int getMessageCount(JBossTopic topic) throws Exception
-// {
-// return 0; //To change body of implemented methods use File | Settings | File Templates.
-// }
-//
-//
-// private int getSubscriptionsCount(JBossTopic topic) throws Exception
-// {
-// return getSubscriptionsCount(topic, ListType.ALL);
-// }
-//
-// private int getSubscriptionsCount(JBossTopic topic, ListType listType) throws Exception
-// {
-// return listSubscriptions(topic, listType).size();
-// }
-//
-// private int getConsumerCount(JBossQueue queue) throws Exception
-// {
-// return messagingServerManagement.getConsumerCountForQueue(queue.getAddress());
-// }
-
- public void setInitialContext(InitialContext initialContext)
- {
- this.initialContext = initialContext;
- }
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/ConnectionFactoryControlMBean.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -32,7 +32,6 @@
*/
public interface ConnectionFactoryControlMBean
{
-
String getURL();
List<String> getBindings();
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSManagementRegistration.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -30,7 +30,6 @@
import org.jboss.messaging.jms.JBossTopic;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSMessageInfo.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -26,10 +26,8 @@
import static javax.management.openmbean.SimpleType.LONG;
import static javax.management.openmbean.SimpleType.STRING;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
@@ -40,6 +38,7 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
+import org.jboss.messaging.core.management.PropertiesInfo;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.jms.client.JBossMessage;
import org.jboss.messaging.util.SimpleString;
@@ -152,9 +151,9 @@
// Constructors --------------------------------------------------
- public JMSMessageInfo(String messageID, String correlationID,
- String deliveryMode, int priority, String replyTo, long timestamp,
- long expiration, String jmsType)
+ public JMSMessageInfo(final String messageID, final String correlationID,
+ final String deliveryMode, final int priority, final String replyTo,
+ final long timestamp, final long expiration, final String jmsType)
{
this.messageID = messageID;
this.correlationID = correlationID;
@@ -173,7 +172,7 @@
{
return messageID;
}
-
+
public String getJMSCorrelationID()
{
return correlationID;
@@ -209,7 +208,7 @@
return jmsType;
}
- public void putProperty(String key, String value)
+ public void putProperty(final String key, final String value)
{
properties.put(key, value);
}
@@ -240,64 +239,4 @@
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
-
- private static class PropertiesInfo
- {
- public static final TabularType TABULAR_TYPE;
- private static CompositeType ROW_TYPE;
-
- private final Map<String, String> properties = new HashMap<String, String>();
-
- static
- {
- try
- {
- ROW_TYPE = new CompositeType("Property", "Property", new String[] {
- "key", "value" }, new String[] { "Key of the property",
- "Value of the property" }, new OpenType[] { STRING, STRING });
- TABULAR_TYPE = new TabularType("PropertyInfo",
- "Properties of the message", ROW_TYPE, new String[] { "key" });
- } catch (OpenDataException e)
- {
- e.printStackTrace();
- throw new IllegalStateException(e);
- }
- }
-
- PropertiesInfo()
- {
- }
-
- /**
- * @return
- */
- public Map<String, String> entries()
- {
- return properties;
- }
-
- void put(String key, String value)
- {
- properties.put(key, value);
- }
-
- TabularData toTabularData()
- {
- try
- {
- TabularDataSupport data = new TabularDataSupport(TABULAR_TYPE);
- for (Entry<String, String> entry : properties.entrySet())
- {
- data.put(new CompositeDataSupport(ROW_TYPE, new String[] {
- "key", "value" }, new Object[] { entry.getKey(),
- entry.getValue() }));
- }
- return data;
- } catch (OpenDataException e)
- {
- e.printStackTrace();
- return null;
- }
- }
- }
}
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/JMSServerControlMBean.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -37,11 +37,6 @@
{
// Attributes ----------------------------------------------------
- /**
- * Has the Server been started.
- *
- * @return true if the server us running
- */
boolean isStarted();
String getVersion();
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/SubscriberInfo.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/SubscriberInfo.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/SubscriberInfo.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -44,7 +44,7 @@
public class SubscriberInfo
{
// Constants -----------------------------------------------------
-
+
public static final CompositeType TYPE;
private static final TabularType TABULAR_TYPE;
private static final String SUBSCRIBER_TYPE_NAME = "SubscriberInfo";
@@ -82,7 +82,7 @@
// Static --------------------------------------------------------
- public static TabularData toTabularData(SubscriberInfo[] infos)
+ public static TabularData toTabularData(final SubscriberInfo[] infos)
{
TabularData data = new TabularDataSupport(TABULAR_TYPE);
for (SubscriberInfo subscriberInfo : infos)
@@ -109,8 +109,9 @@
// Constructors --------------------------------------------------
- public SubscriberInfo(String id, String clientID, String name,
- boolean durable, String selector, int messageCount, int maxSizeBytes)
+ public SubscriberInfo(final String id, final String clientID,
+ final String name, final boolean durable, final String selector,
+ final int messageCount, final int maxSizeBytes)
{
this.id = id;
this.clientID = clientID;
@@ -162,9 +163,8 @@
{
try
{
- return new CompositeDataSupport(TYPE, ITEM_NAMES,
- new Object[] { id, clientID, name, durable, selector,
- messageCount, maxSizeBytes });
+ return new CompositeDataSupport(TYPE, ITEM_NAMES, new Object[] { id,
+ clientID, name, durable, selector, messageCount, maxSizeBytes });
} catch (OpenDataException e)
{
e.printStackTrace();
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/ConnectionFactoryControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -53,8 +53,8 @@
// Constructors --------------------------------------------------
- public ConnectionFactoryControl(JBossConnectionFactory cf,
- ClientConnectionFactory coreCF, String name, List<String> bindings)
+ public ConnectionFactoryControl(final JBossConnectionFactory cf,
+ final ClientConnectionFactory coreCF, final String name, final List<String> bindings)
throws NotCompliantMBeanException
{
super(ConnectionFactoryControlMBean.class);
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSManagementRegistrationImpl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -59,19 +59,21 @@
+ ":module=JMS,type=Server");
}
- public static ObjectName getJMSQueueObjectName(String name) throws Exception
+ public static ObjectName getJMSQueueObjectName(final String name)
+ throws Exception
{
return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=Queue,name=" + name.toString());
}
- public static ObjectName getJMSTopicObjectName(String name) throws Exception
+ public static ObjectName getJMSTopicObjectName(final String name)
+ throws Exception
{
return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
+ ":module=JMS,type=Topic,name=" + name.toString());
}
- private ObjectName getConnectionFactoryObjectName(String name)
+ private ObjectName getConnectionFactoryObjectName(final String name)
throws Exception
{
return ObjectName.getInstance(ManagementServiceImpl.DOMAIN
@@ -80,7 +82,7 @@
// Constructors --------------------------------------------------
- public JMSManagementRegistrationImpl(MBeanServer mbeanServer)
+ public JMSManagementRegistrationImpl(final MBeanServer mbeanServer)
{
this.mbeanServer = mbeanServer;
}
@@ -89,7 +91,8 @@
// JMSManagementRegistration implementation ----------------------
- public void registerJMSServer(JMSServerManager server) throws Exception
+ public void registerJMSServer(final JMSServerManager server)
+ throws Exception
{
ObjectName objectName = getJMSServerObjectName();
if (mbeanServer.isRegistered(objectName))
@@ -104,9 +107,10 @@
// TODO Auto-generated method stub
}
-
- public void registerQueue(JBossQueue queue, Queue coreQueue,
- String jndiBinding, JMSServerManager server) throws Exception
+
+ public void registerQueue(final JBossQueue queue, final Queue coreQueue,
+ final String jndiBinding, final JMSServerManager server)
+ throws Exception
{
ObjectName objectName = getJMSQueueObjectName(queue.getQueueName());
if (mbeanServer.isRegistered(objectName))
@@ -117,14 +121,14 @@
jndiBinding, server), getJMSQueueObjectName(queue.getQueueName()));
}
- public void unregisterQueue(String name) throws Exception
+ public void unregisterQueue(final String name) throws Exception
{
mbeanServer.unregisterMBean(getJMSQueueObjectName(name));
}
- public void registerTopic(JBossTopic topic,
- MessagingServerManagement serverManagement, String jndiBinding)
- throws Exception
+ public void registerTopic(final JBossTopic topic,
+ final MessagingServerManagement serverManagement,
+ final String jndiBinding) throws Exception
{
ObjectName objectName = getJMSTopicObjectName(topic.getTopicName());
if (mbeanServer.isRegistered(objectName))
@@ -135,21 +139,21 @@
jndiBinding), objectName);
}
- public void unregisterTopic(String name) throws Exception
+ public void unregisterTopic(final String name) throws Exception
{
mbeanServer.unregisterMBean(getJMSTopicObjectName(name));
}
- public void registerConnectionFactory(String name,
- JBossConnectionFactory connectionFactory, List<String> bindings)
- throws Exception
+ public void registerConnectionFactory(final String name,
+ final JBossConnectionFactory connectionFactory,
+ final List<String> bindings) throws Exception
{
ObjectName objectName = getConnectionFactoryObjectName(name);
mbeanServer.registerMBean(new ConnectionFactoryControl(connectionFactory,
connectionFactory.getCoreConnection(), name, bindings), objectName);
}
- public void unregisterConnectionFactory(String name) throws Exception
+ public void unregisterConnectionFactory(final String name) throws Exception
{
ObjectName objectName = getConnectionFactoryObjectName(name);
mbeanServer.unregisterMBean(objectName);
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSQueueControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -76,8 +76,8 @@
// Constructors --------------------------------------------------
- public JMSQueueControl(JBossQueue queue, Queue coreQueue,
- String jndiBinding, JMSServerManager server)
+ public JMSQueueControl(final JBossQueue queue, final Queue coreQueue,
+ final String jndiBinding, final JMSServerManager server)
throws NotCompliantMBeanException
{
super(JMSQueueControlMBean.class);
@@ -142,7 +142,7 @@
}
}
- public boolean removeMessage(String messageID) throws Exception
+ public boolean removeMessage(final String messageID) throws Exception
{
Filter filter = createFilterForJMSMessageID(messageID);
List<MessageReference> refs = coreQueue.list(filter);
@@ -165,7 +165,7 @@
return listMessages(null);
}
- public TabularData listMessages(String filterStr) throws Exception
+ public TabularData listMessages(final String filterStr) throws Exception
{
try
{
@@ -189,7 +189,7 @@
}
}
- public boolean expireMessage(String messageID) throws Exception
+ public boolean expireMessage(final String messageID) throws Exception
{
Filter filter = createFilterForJMSMessageID(messageID);
List<MessageReference> refs = coreQueue.list(filter);
@@ -201,7 +201,7 @@
return server.expireMessages(filter, managedQueue) == 1;
}
- public int expireMessages(String filterStr) throws Exception
+ public int expireMessages(final String filterStr) throws Exception
{
try
{
@@ -215,7 +215,7 @@
}
}
- public boolean sendMessageTDLQ(String messageID) throws Exception
+ public boolean sendMessageTDLQ(final String messageID) throws Exception
{
Filter filter = createFilterForJMSMessageID(messageID);
List<MessageReference> refs = coreQueue.list(filter);
@@ -227,8 +227,8 @@
return server.sendMessagesToDLQ(filter, managedQueue) == 1;
}
- public boolean changeMessagePriority(String messageID, int newPriority)
- throws Exception
+ public boolean changeMessagePriority(final String messageID,
+ final int newPriority) throws Exception
{
if (newPriority < 0 || newPriority > 9)
{
@@ -242,7 +242,8 @@
throw new IllegalArgumentException(
"No message found for JMSMessageID: " + messageID);
}
- return server.changeMessagesPriority(filter, (byte) newPriority, managedQueue) == 1;
+ return server.changeMessagesPriority(filter, (byte) newPriority,
+ managedQueue) == 1;
}
// StandardMBean overrides ---------------------------------------
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/JMSServerControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -63,7 +63,7 @@
// Constructors --------------------------------------------------
- public JMSServerControl(JMSServerManager server)
+ public JMSServerControl(final JMSServerManager server)
throws NotCompliantMBeanException
{
super(JMSServerControlMBean.class);
@@ -75,20 +75,20 @@
// JMSServerControlMBean implementation --------------------------
- public void createConnectionFactory(String name, String jndiBinding,
- String clientID, int dupsOKBatchSize, int consumerWindowSize,
- int consumerMaxRate, int producerWindowSize,
- int producerMaxRate,
- boolean blockOnAcknowledge,
- boolean defaultSendNonPersistentMessagesBlocking, boolean defaultSendPersistentMessagesBlocking)
- throws Exception
+ public void createConnectionFactory(final String name,
+ final String jndiBinding, final String clientID,
+ final int dupsOKBatchSize, final int consumerWindowSize,
+ final int consumerMaxRate, final int producerWindowSize,
+ final int producerMaxRate, final boolean blockOnAcknowledge,
+ final boolean defaultSendNonPersistentMessagesBlocking,
+ final boolean defaultSendPersistentMessagesBlocking) throws Exception
{
List<String> bindings = new ArrayList<String>();
bindings.add(jndiBinding);
-
- boolean created = server.createConnectionFactory(name, clientID, dupsOKBatchSize,
- consumerWindowSize, consumerMaxRate, producerWindowSize,
- producerMaxRate, blockOnAcknowledge,
+
+ boolean created = server.createConnectionFactory(name, clientID,
+ dupsOKBatchSize, consumerWindowSize, consumerMaxRate,
+ producerWindowSize, producerMaxRate, blockOnAcknowledge,
defaultSendNonPersistentMessagesBlocking,
defaultSendPersistentMessagesBlocking, bindings);
if (created)
@@ -97,7 +97,8 @@
}
}
- public boolean createQueue(String name, String jndiBinding) throws Exception
+ public boolean createQueue(final String name, final String jndiBinding)
+ throws Exception
{
boolean created = server.createQueue(name, jndiBinding);
if (created)
@@ -107,7 +108,7 @@
return created;
}
- public boolean destroyQueue(String name) throws Exception
+ public boolean destroyQueue(final String name) throws Exception
{
boolean destroyed = server.destroyQueue(name);
if (destroyed)
@@ -117,7 +118,7 @@
return destroyed;
}
- public boolean createTopic(String topicName, String jndiBinding)
+ public boolean createTopic(final String topicName, final String jndiBinding)
throws Exception
{
boolean created = server.createTopic(topicName, jndiBinding);
@@ -128,7 +129,7 @@
return created;
}
- public boolean destroyTopic(String name) throws Exception
+ public boolean destroyTopic(final String name) throws Exception
{
boolean destroyed = server.destroyTopic(name);
if (destroyed)
@@ -138,7 +139,7 @@
return destroyed;
}
- public void destroyConnectionFactory(String name) throws Exception
+ public void destroyConnectionFactory(final String name) throws Exception
{
boolean destroyed = server.destroyConnectionFactory(name);
if (destroyed)
@@ -151,7 +152,7 @@
{
return server.isStarted();
}
-
+
public String getVersion()
{
return server.getVersion();
@@ -159,21 +160,21 @@
// NotificationEmitter implementation ----------------------------
- public void removeNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback)
+ public void removeNotificationListener(final NotificationListener listener,
+ final NotificationFilter filter, final Object handback)
throws ListenerNotFoundException
{
broadcaster.removeNotificationListener(listener, filter, handback);
}
- public void removeNotificationListener(NotificationListener listener)
+ public void removeNotificationListener(final NotificationListener listener)
throws ListenerNotFoundException
{
broadcaster.removeNotificationListener(listener);
}
- public void addNotificationListener(NotificationListener listener,
- NotificationFilter filter, Object handback)
+ public void addNotificationListener(final NotificationListener listener,
+ final NotificationFilter filter, final Object handback)
throws IllegalArgumentException
{
broadcaster.addNotificationListener(listener, filter, handback);
@@ -217,7 +218,8 @@
// Private -------------------------------------------------------
- private void sendNotification(NotificationType type, String message)
+ private void sendNotification(final NotificationType type,
+ final String message)
{
Notification notif = new Notification(type.toString(), this, notifSeq
.incrementAndGet(), message);
Modified: branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java
===================================================================
--- branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2008-08-01 14:58:09 UTC (rev 4764)
+++ branches/Branch_JBMESSAGING-1303/src/main/org/jboss/messaging/jms/server/management/impl/TopicControl.java 2008-08-01 15:15:29 UTC (rev 4765)
@@ -65,8 +65,9 @@
// Constructors --------------------------------------------------
- public TopicControl(JBossTopic topic, MessagingServerManagement server,
- String jndiBinding) throws NotCompliantMBeanException
+ public TopicControl(final JBossTopic topic,
+ final MessagingServerManagement server, final String jndiBinding)
+ throws NotCompliantMBeanException
{
super(TopicControlMBean.class);
this.managedTopic = topic;
@@ -176,7 +177,7 @@
return listSubscribersInfos(DurabilityType.NON_DURABLE);
}
- public TabularData listMessagesForSubscriber(String subscriberID)
+ public TabularData listMessagesForSubscriber(final String subscriberID)
throws Exception
{
Queue queue = server.getQueue(new SimpleString(subscriberID));
@@ -204,7 +205,7 @@
// Private -------------------------------------------------------
- private SubscriberInfo[] listSubscribersInfos(DurabilityType durability)
+ private SubscriberInfo[] listSubscribersInfos(final DurabilityType durability)
{
List<Queue> queues = getQueues(durability);
List<SubscriberInfo> subInfos = new ArrayList<SubscriberInfo>(queues
@@ -234,7 +235,7 @@
.size()]);
}
- private int getMessageCount(DurabilityType durability)
+ private int getMessageCount(final DurabilityType durability)
{
List<Queue> queues = getQueues(durability);
int count = 0;
@@ -245,7 +246,7 @@
return count;
}
- private List<Queue> getQueues(DurabilityType durability)
+ private List<Queue> getQueues(final DurabilityType durability)
{
try
{
More information about the jboss-cvs-commits
mailing list