geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From genspr...@apache.org
Subject svn commit: r817476 - in /geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main: java/org/apache/geronimo/monitoring/console/ webapp/WEB-INF/view/
Date Tue, 22 Sep 2009 01:57:27 GMT
Author: genspring
Date: Tue Sep 22 01:57:26 2009
New Revision: 817476

URL: http://svn.apache.org/viewvc?rev=817476&view=rev
Log:
GERONIMO-4849 Such warning will be shown after deleted a remote monitoring server via JMX,
Thanks Siqi for the patch !

Modified:
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
  (contents, props changed)
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
  (contents, props changed)
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
Tue Sep 22 01:57:26 2009
@@ -84,6 +84,7 @@
             if (hasSecondSeries) {
                 snapshotList2 = mrc.getSpecificStatistics(graph.getMBeanName(), graph.getDataName2(),
snapCount, skipCount, graph.isShowArchive());
             }
+            mrc.dispose();
             // Check if snapshotList is empty
             if (snapshotList1.size() == 0) {
                 snapshotList1.put(System.currentTimeMillis(), (long) 0);

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
Tue Sep 22 01:57:26 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.geronimo.monitoring.console;
 
+import java.io.IOException;
 import java.text.Format;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -43,10 +44,10 @@
 public class MRCConnector {
 
     private static String PATH = null;
-    private static MBeanServerConnection mbServerConn;
+    private MBeanServerConnection mbServerConn;
     private MasterRemoteControlRemote mrc = null;
     private String protocol = "EJB";
-
+    private JMXConnector connector = null;
     MRCConnector() {
 
     }
@@ -101,7 +102,7 @@
                 credentials[0] = userName;
                 credentials[1] = password;
                 env.put(JMXConnector.CREDENTIALS, credentials);
-                JMXConnector connector = JMXConnectorFactory.connect(
+                connector = JMXConnectorFactory.connect(
                         serviceURL, env);
                 mbServerConn = connector.getMBeanServerConnection();
 
@@ -154,7 +155,21 @@
 //            }
 //        }
     }
-
+    
+    public void dispose()
+    {
+        try{
+            if("JMX".equals(this.protocol) && null != this.connector){
+                connector.close();
+                connector = null;
+            }
+                
+        }
+        catch(IOException ex)
+        {
+        }
+    }
+    
     private boolean isEjbProtocol() {
         return "EJB".equals(protocol);
     }

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
Tue Sep 22 01:57:26 2009
@@ -256,11 +256,16 @@
 
     private void testConnection(String ip, String username,
                                   String password, int port, String protocol, PortletRequest
request) {
+        MRCConnector mrc = null;
         try {
-            new MRCConnector(ip, username, password, port, protocol);
+            mrc = new MRCConnector(ip, username, password, port, protocol);
             addInfoMessage(request, getLocalizedString(request, "mconsole.infoMsg01"));
         } catch (Exception e) {
             addInfoMessage(request, getLocalizedString(request, "mconsole.errorMsg01"), e.getMessage());
+        } finally
+        {
+            if(null != mrc)
+                mrc.dispose();
         }
     }
 
@@ -633,7 +638,7 @@
                     MRCConnector connector = new MRCConnector(node);
                     connector.setSnapshotDuration(Long.parseLong(snapshot) * 1000 * 60);
                     connector.setSnapshotRetention(Integer.parseInt(retention));
-                    //close?
+                    connector.dispose();
                 }
             } finally {
                 userTransaction.commit();
@@ -688,8 +693,9 @@
                     return;
                 }
                 // check whether the snapshot query is enabled, if does, close it first
+                MRCConnector mrc = null;
                 try {
-                    MRCConnector mrc = new MRCConnector(node);
+                    mrc = new MRCConnector(node);
                     if (mrc.isSnapshotRunning() == 1) {
                         if (mrc.stopSnapshotThread()) {
                             addInfoMessage(actionRequest, getLocalizedString(actionRequest,
"mconsole.infoMsg06", server_id));
@@ -697,7 +703,10 @@
                             addErrorMessage(actionRequest, getLocalizedString(actionRequest,
"mconsole.errorMsg09", server_id));
                         }
                     }
+                    
                 } catch (Exception e) {
+                } finally {
+                    if(null != mrc)mrc.dispose();
                 }
                 entityManager.remove(node);
             } finally {
@@ -820,7 +829,7 @@
             addInfoMessage(request, getLocalizedString(request, "mconsole.errorMsg04"), e.getMessage());
             return;
         }
-        MRCConnector mrc;
+        MRCConnector mrc =null;
         try {
             mrc = new MRCConnector(node);
         } catch (Exception e) {
@@ -840,6 +849,7 @@
         } catch (Exception e) {
             addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg06", mbean,
node.getHost()), e.getMessage());
         }
+        mrc.dispose();
     }
 
     private void stopTrackingMbean(String server_id, String mbean, PortletRequest request)
{
@@ -870,6 +880,7 @@
         } catch (Exception e) {
             addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg06", mbean,
node.getHost()), e.getMessage());
         }
+        mrc.dispose();
     }
 
     private void stopThread(String server_id, PortletRequest request) {
@@ -881,8 +892,9 @@
             addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg08", server_id),
e.getMessage());
             return;
         }
+        MRCConnector mrc = null;
         try {
-            MRCConnector mrc = new MRCConnector(node);
+            mrc = new MRCConnector(node);
             if (mrc.stopSnapshotThread()) {
                 addInfoMessage(request, getLocalizedString(request, "mconsole.infoMsg06",
server_id));
             } else {
@@ -890,6 +902,9 @@
             }
         } catch (Exception e) {
         	addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg09", server_id),
e.getMessage());
+        } finally {
+            if(null != mrc)
+                mrc.dispose();
         }
     }
 
@@ -902,8 +917,9 @@
             addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg08", server_id),
e.getMessage());
             return;
         }
+        MRCConnector mrc = null;
         try {
-            MRCConnector mrc = new MRCConnector(node);
+            mrc = new MRCConnector(node);
             if (mrc.startSnapshotThread(snapshotDuration)) {
                 addInfoMessage(request, getLocalizedString(request, "mconsole.infoMsg07",
server_id));
             } else {
@@ -912,6 +928,8 @@
         } catch (Exception e) {
         	addErrorMessage(request, getLocalizedString(request, "mconsole.errorMsg10", server_id),
e.getMessage());
 
+        } finally {
+            if(null != mrc)mrc.dispose();
         }
     }
 

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
Tue Sep 22 01:57:26 2009
@@ -57,8 +57,8 @@
 
     <%
 for (Node node: nodes) {
-try {
-String name = node.getName();
+    try {
+    String name = node.getName();
    MRCConnector  mrc = new MRCConnector(node);
     TreeMap <String,String> trackedBeansMap = mrc.getTrackedBeansMap();
     serverIds.add(name);
@@ -69,8 +69,8 @@
     serverPrettyBeans["<%=name%>"] = new Array();
     serverBeanStatAttributes["<%=name%>"] = new Array();
     <%
-int i = 0;
-for(Map.Entry<String, String> entry: trackedBeansMap.entrySet()){
+    int i = 0;
+    for(Map.Entry<String, String> entry: trackedBeansMap.entrySet()){
     String prettyBean = entry.getKey();
     Set<String> statAttributes = mrc.getStatAttributesOnMBean(entry.getValue());
     %>
@@ -90,6 +90,7 @@
     %>
 
     <%
+        mrc.dispose();
     }
     catch (Exception e)
     {

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
Tue Sep 22 01:57:26 2009
@@ -87,6 +87,7 @@
          %>
              
         <%
+        mrc.dispose();
     }
     catch (Exception e)
     {

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
Tue Sep 22 01:57:26 2009
@@ -62,6 +62,9 @@
             // the password in the db does not work
             isOnline = false;
         }
+    }finally{
+        if(null != mrc)
+            mrc.dispose();
     }
 %>
 <!-- <head> -->

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
Tue Sep 22 01:57:26 2009
@@ -104,6 +104,8 @@
 	         collecting = 0;
 	         online = false;
 	     }
+         if(null != mrc)
+             mrc.dispose();
      }
  %>
   <c:set var="backgroundClass" value='MediumBackground'/>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
Tue Sep 22 01:57:26 2009
@@ -61,6 +61,8 @@
 	         collecting = 0;
 	         online = false;
 	     }
+         if(null != mrc)
+             mrc.dispose();
      }
  %>
   <c:set var="backgroundClass" value='MediumBackground'/>

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp?rev=817476&r1=817475&r2=817476&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
(original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Tue Sep 22 01:57:26 2009
@@ -67,6 +67,7 @@
         collecting = 0;
     }
     
+    
 %>
 
 <CommonMsg:commonMsg/><br>
@@ -422,6 +423,8 @@
     </tr>
 </table>
 <%
+if(null != mrc)
+    mrc.dispose();
 }
     else
     {%>



Mime
View raw message