geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r581014 - in /geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor: MasterRemoteControl.java snapshot/SnapshotConfigXMLBuilder.java snapshot/SnapshotThread.java snapshot/SnapshotXMLBuilder.java
Date Mon, 01 Oct 2007 16:56:50 GMT
Author: akulshreshtha
Date: Mon Oct  1 09:56:49 2007
New Revision: 581014

URL: http://svn.apache.org/viewvc?rev=581014&view=rev
Log:
GERONIMO-3493 Patch by Viet

Modified:
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java?rev=581014&r1=581013&r2=581014&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
(original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
Mon Oct  1 09:56:49 2007
@@ -61,7 +61,7 @@
 public class MasterRemoteControl implements GBeanLifecycle {
     // constants
     private static final String GERONIMO_DEFAULT_DOMAIN = "geronimo";
-    private static final Long DEFAULT_DURATION = new Long(5000);
+    private static final Long DEFAULT_DURATION = new Long(300000);
 
     //private static final Log log = LogFactory.getLog(MasterRemoteControl.class);
 
@@ -165,6 +165,7 @@
     public void startSnapshot(Long interval) /*throws Exception*/ {
         if((snapshotThread == null || (snapshotThread != null && !snapshotThread.isAlive()))
&&
                 interval.longValue() > 0) {
+            saveDuration(interval.longValue());
             snapshotThread = new SnapshotThread(interval.longValue(), mbServer);
             snapshotThread.start();
         } else {

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java?rev=581014&r1=581013&r2=581014&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java
(original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java
Mon Oct  1 09:56:49 2007
@@ -39,7 +39,7 @@
  */
 public class SnapshotConfigXMLBuilder {
     private static final String pathToXML = 
-        System.getProperty("org.apache.geronimo.home.dir") + "/var/snapshot-config.xml";
+        System.getProperty("org.apache.geronimo.home.dir") + "/var/monitoring/snapshot-config.xml";
     
     private static final String SNAPSHOT_CONFIG = "snapshot-config";
     private static final String DURATION = "duration";
@@ -161,6 +161,9 @@
      * @throws Exception
      */
     public static String getAttributeValue(String key) throws Exception {
+        // ensure that there exists the 'monitor' directory
+        SnapshotThread.ensureMonitorDir();
+        // get an instance of the document
         Document doc = openDocument();
         // get the root element node
         Element rootElement = doc.getDocumentElement();

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java?rev=581014&r1=581013&r2=581014&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
(original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
Mon Oct  1 09:56:49 2007
@@ -16,6 +16,7 @@
  */
 package org.apache.geronimo.monitor.snapshot;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -84,6 +85,8 @@
     }
 
     public void run() {
+        // ensure that there is a 'monitoring' directory
+        ensureMonitorDir();
         // get any saved mbean names from snapshot-config.xml
         mbeanNames = SnapshotConfigXMLBuilder.getMBeanNames();
         // in the case where nothing is present, grab a set of default mbeans
@@ -147,5 +150,27 @@
             }
         }
         return retval;
+    }
+    
+    /**
+     * Checks to see if the GERONIMO_HOME/var/monitoring/ directory was made.
+     * If not, the method creates it.
+     */
+    public static void ensureMonitorDir() {
+        final String pathToDir = 
+            System.getProperty("org.apache.geronimo.home.dir") + "/var/monitoring/";
+        File dir = new File(pathToDir);
+        if(dir.exists() && dir.isDirectory()) {
+            // all good
+            return;
+        } else {
+            // make a directory
+            if(dir.mkdir()) {
+                // directory was successfully created
+                return;
+            } else {
+                System.out.println("Could not make the directory " + pathToDir);
+            }
+        }
     }
 }

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java?rev=581014&r1=581013&r2=581014&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java
(original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java
Mon Oct  1 09:56:49 2007
@@ -49,7 +49,7 @@
 public class SnapshotXMLBuilder {
     private Document doc = null;
     private static final String pathToXML = 
-        System.getProperty("org.apache.geronimo.home.dir") + "/var/snapshotData.xml";
+        System.getProperty("org.apache.geronimo.home.dir") + "/var/monitoring/snapshotData.xml";
     private static final String SNAPSHOT_DATE = "snapshot_date";
     private static final String SNAPSHOT_TIME = "snapshot_time";
     private static final String MBEAN = "mbean";



Mime
View raw message