You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ge...@apache.org on 2009/09/22 03:54:33 UTC
svn commit: r817474 - in
/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main:
java/org/apache/geronimo/monitoring/console/ webapp/WEB-INF/view/
Author: genspring
Date: Tue Sep 22 01:54:32 2009
New Revision: 817474
URL: http://svn.apache.org/viewvc?rev=817474&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/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp (contents, props changed)
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp (contents, props changed)
geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java Tue Sep 22 01:54:32 2009
@@ -35,7 +35,7 @@
private String ip = new String();
private int timeFrame;
private int snapCount;
- private MRCConnector mrc = new MRCConnector();
+ private MRCConnector mrc = null;
private Connection con;
// constructor
@@ -222,9 +222,10 @@
System.out.println("Using Null call.");
graph = (new StatsGraph());
}
+
}
}
-
+ mrc.dispose();
// check to see if graph was successfully populated
if (graph != null) {
// get the current date
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java Tue Sep 22 01:54:32 2009
@@ -16,6 +16,7 @@
*/
package org.apache.geronimo.monitoring.console;
+import java.io.IOException;
import java.sql.Connection;
import java.sql.Statement;
import java.text.Format;
@@ -35,19 +36,18 @@
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-
import javax.naming.Context;
import javax.naming.InitialContext;
+import org.apache.geronimo.crypto.EncryptionManager;
import org.apache.geronimo.monitoring.MasterRemoteControlRemote;
import org.apache.geronimo.monitoring.console.util.DBManager;
-import org.apache.geronimo.crypto.EncryptionManager;
-
public class MRCConnector {
private static String PATH = null;
- private static MBeanServerConnection mbServerConn;
+ private MBeanServerConnection mbServerConn;
+ private JMXConnector connector = null;
private MasterRemoteControlRemote mrc = null;
private int Protocol = 0;
@@ -102,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 +154,18 @@
}
}
}
-
+ public void dispose()
+ {
+ try{
+ if(this.Protocol != 1 && null != this.connector){
+ connector.close();
+ connector = null;
+ }
+ }
+ catch(IOException ex)
+ {
+ }
+ }
/**
* @return - Returns an Long representing the current snapshot duration set
* on the server side
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MonitoringPortlet.java Tue Sep 22 01:54:32 2009
@@ -244,11 +244,15 @@
private void testConnection(String ip, String username,
String password, int port, int 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, "infoMsg01"));
} catch (Exception e) {
addErrorMessage(request, getLocalizedString(request, "errorMsg01"), e.getMessage());
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
@@ -549,6 +553,7 @@
String server_id = actionRequest.getParameter("server_id");
actionResponse.setRenderParameter("server_id", server_id);
DBManager DBase = new DBManager();
+ MRCConnector mrc = null;
Connection con = DBase.getConnection();
String name = actionRequest.getParameter("name");
String ip = actionRequest.getParameter("ip");
@@ -615,15 +620,17 @@
if (snapshot == null || retention == null) {
// do not update if we do not know
} else {
- (new MRCConnector(ip, username, password, port, protocol))
- .setSnapshotDuration(Long.parseLong(snapshot) * 1000 * 60);
- (new MRCConnector(ip, username, password, port, protocol))
- .setSnapshotRetention(Integer.parseInt(retention));
+ mrc = new MRCConnector(ip, username, password, port, protocol);
+ mrc.setSnapshotDuration(Long.parseLong(snapshot) * 1000 * 60);
+ mrc.setSnapshotRetention(Integer.parseInt(retention));
}
// set success message
addInfoMessage(actionRequest, getLocalizedString(actionRequest, "infoMsg10"));
} catch (Exception e) {
addErrorMessage(actionRequest, getLocalizedString(actionRequest, "errorMsg13"), e.getMessage());
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
@@ -949,6 +956,9 @@
} catch (Exception e) {
addErrorMessage(request, MessageFormat.format(getLocalizedString(request, "errorMsg06"), mbean, server_ip), e.getMessage());
return;
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
@@ -1003,6 +1013,9 @@
}
} catch (Exception e) {
addErrorMessage(request, MessageFormat.format(getLocalizedString(request, "errorMsg07"), mbean, server_ip), e.getMessage());
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
@@ -1057,6 +1070,9 @@
} catch (Exception e) {
addErrorMessage(request, MessageFormat.format(getLocalizedString(request, "errorMsg09"), server_ip), e.getMessage());
return;
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
@@ -1110,6 +1126,9 @@
} catch (Exception e) {
addErrorMessage(request, MessageFormat.format(getLocalizedString(request, "errorMsg10"), server_ip), e.getMessage());
return;
+ }finally{
+ if(null != mrc)
+ mrc.dispose();
}
}
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp Tue Sep 22 01:54:32 2009
@@ -114,6 +114,11 @@
catch (Exception e)
{
e.printStackTrace();
+ }finally{
+ if(null != mrc){
+ mrc.dispose();
+ mrc = null;
+ }
}
%>
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp Tue Sep 22 01:54:32 2009
@@ -135,6 +135,11 @@
catch (Exception e)
{
+ }finally{
+ if(null != mrc){
+ mrc.dispose();
+ mrc = null;
+ }
}
%>
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp Tue Sep 22 01:54:32 2009
@@ -119,6 +119,11 @@
// the password in the db does not work
isOnline = false;
}
+ }finally{
+ if(null != mrc){
+ mrc.dispose();
+ mrc = null;
+ }
}
%>
<!-- <head> -->
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp Tue Sep 22 01:54:32 2009
@@ -150,6 +150,10 @@
} catch (Exception e) {
collecting = 0;
online = false;
+ }finally{
+ if(null != mrc){
+ mrc.dispose();
+ }
}
}
%>
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp Tue Sep 22 01:54:32 2009
@@ -107,6 +107,11 @@
collecting = 0;
online = false;
}
+ finally{
+ if(null != mrc){
+ mrc.dispose();
+ }
+ }
}
%>
<c:set var="backgroundClass" value='MediumBackground'/>
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp?rev=817474&r1=817473&r2=817474&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp Tue Sep 22 01:54:32 2009
@@ -451,6 +451,8 @@
</tr>
</table>
<%
+if(null != mrc)
+ mrc.dispose();
}
else
{%>