qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r796663 - in /qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui: jmx/JMXServerRegistry.java views/NotificationsTabControl.java views/VHNotificationsTabControl.java
Date Wed, 22 Jul 2009 10:48:31 GMT
Author: robbie
Date: Wed Jul 22 10:48:30 2009
New Revision: 796663

URL: http://svn.apache.org/viewvc?rev=796663&view=rev
Log:
QPID-1999: ensure the Clear button in each VirtualHost Notifications area only clears the
Notifications for that VirtualHost instead of all Notifications for the entire server. Add
synchronized blocks to protect from concurrent modifications by the update thread and the
clear action.

Modified:
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
    qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java?rev=796663&r1=796662&r2=796663&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
Wed Jul 22 10:48:30 2009
@@ -255,6 +255,11 @@
         //iterate over all the notification lists for mbeans with subscribed notifications
         for (List<NotificationObject> list : _notificationsMap.values())
         {
+            if(list == null || list.isEmpty())
+            {
+                continue;
+            }
+            
             //Check the source vhost of the first notification
             NotificationObject notification  = list.get(0);
             

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java?rev=796663&r1=796662&r2=796663&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
Wed Jul 22 10:48:30 2009
@@ -28,6 +28,7 @@
 import static org.apache.qpid.management.ui.Constants.SUBSCRIBE_BUTTON;
 import static org.apache.qpid.management.ui.Constants.UNSUBSCRIBE_BUTTON;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.qpid.management.ui.ApplicationRegistry;
@@ -163,8 +164,8 @@
     protected void addButtons()
     {    
         Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
-        composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-        composite.setLayout(new GridLayout());
+        composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+        composite.setLayout(new GridLayout(2,false));
         
         // Add Clear Button
         _clearButton = _toolkit.createButton(composite, BUTTON_CLEAR, SWT.PUSH | SWT.CENTER);
@@ -173,17 +174,36 @@
         gridData.widthHint = 80;
         _clearButton.setLayoutData(gridData);
         _clearButton.addSelectionListener(new SelectionAdapter()
-            {
-                public void widgetSelected(SelectionEvent e)
-                {    
-                    if (_mbean == null)
-                        return;
-                    
-                    IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
-                    ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);
+        {
+            public void widgetSelected(SelectionEvent e)
+            {    
+                if (_mbean == null)
+                {
+                    return;
+                }
+
+                ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+                IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
+                if(!ss.isEmpty())
+                {
                     serverRegistry.clearNotifications(_mbean, ss.toList());
                 }
-            });
+                else if(_notifications != null)
+                {
+                    synchronized(this)
+                    {
+                        List<NotificationObject> newList = new ArrayList<NotificationObject>();
+                        newList.addAll(_notifications);
+                        serverRegistry.clearNotifications(_mbean, newList);
+                    }
+                }
+                
+                refresh();
+            }
+        });
+        //add description
+        Label desc = _toolkit.createLabel(composite,"Clears the selected Notifications, or
all if none are selected");
+        desc.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER, false, false));
     }
 
     @Override
@@ -348,8 +368,10 @@
     {
         ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean);  
     
         List<NotificationObject> newList = serverRegistry.getNotifications(_mbean);
-        _notifications = newList;
-        
-        _tableViewer.setInput(_notifications);
+        synchronized(this)
+        {
+            _notifications = newList;
+            _tableViewer.setInput(_notifications);
+        }
     }
 }

Modified: qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java?rev=796663&r1=796662&r2=796663&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
(original)
+++ qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/VHNotificationsTabControl.java
Wed Jul 22 10:48:30 2009
@@ -119,8 +119,8 @@
     protected void addButtons()
     {    
         Composite composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
-        composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-        composite.setLayout(new GridLayout());
+        composite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
+        composite.setLayout(new GridLayout(2,false));
         
         // Add Clear Button
         _clearButton = _toolkit.createButton(composite, BUTTON_CLEAR, SWT.PUSH | SWT.CENTER);
@@ -129,16 +129,29 @@
         gridData.widthHint = 80;
         _clearButton.setLayoutData(gridData);
         _clearButton.addSelectionListener(new SelectionAdapter()
-            {
-                public void widgetSelected(SelectionEvent e)
-                {  
-                    //TODO : Get selected rows and clear those
-                    IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
-                    ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+        {
+            public void widgetSelected(SelectionEvent e)
+            {  
+                ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+                IStructuredSelection ss = (IStructuredSelection)_tableViewer.getSelection();
+                if(!ss.isEmpty())
+                {
                     serverRegistry.clearNotifications(null, ss.toList());
-                    refresh();
                 }
-            });
+                else if(_notifications != null)
+                {
+                    synchronized(this)
+                    {
+                        serverRegistry.clearNotifications(null, _notifications);
+                    }
+                }
+
+                refresh();
+            }
+        });
+        //add description
+        Label desc = _toolkit.createLabel(composite,"Clears the selected Notifications, or
all if none are selected");
+        desc.setLayoutData(new GridData(SWT.LEFT,SWT.CENTER, false, false));
     }
     
     /**
@@ -446,9 +459,12 @@
         
         ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
       
         List<NotificationObject> newList = serverRegistry.getNotifications(virtualhost);
-        _notifications = newList;
         
-        _tableViewer.setInput(_notifications);
+        synchronized(this)
+        {
+            _notifications = newList;
+            _tableViewer.setInput(_notifications);
+        }
     }
 
 }



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message