[jboss-cvs] jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/persistor ...
Takuro Okada
t2-okada at nri.co.jp
Mon Nov 6 02:34:41 EST 2006
User: tokada
Date: 06/11/06 02:34:41
Modified: java/src/expansion/org/jboss/profiler/exp/agent/persistor
Tag: JBossProfiler_Expansion
XmlMetricPersistor.java MetricsPersistor.java
Log:
Modified some interfaces.
Revision Changes Path
No revision
No revision
1.1.2.3 +15 -11 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/persistor/Attic/XmlMetricPersistor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: XmlMetricPersistor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/persistor/Attic/XmlMetricPersistor.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- XmlMetricPersistor.java 31 Oct 2006 11:30:18 -0000 1.1.2.2
+++ XmlMetricPersistor.java 6 Nov 2006 07:34:41 -0000 1.1.2.3
@@ -124,13 +124,13 @@
writer.writeEndDocument();
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("failed to save the metrics data.");
}finally {
try {
if(writer!=null) writer.close();
if(bos!=null) bos.close();
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("failed to close a stream.");
}
}
@@ -163,21 +163,21 @@
writeToFile(bis, zos, new ZipEntry(entryFileName));
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("failed to save the metrics data.");
}finally {
try {
if(bis!=null) bis.close();
if(zos!=null) zos.close();
if(fos!=null) fos.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("failed to close a stream.");
}
}
if(fileTemp!=null) fileTemp.renameTo(new File(persistentPath+fileName));
if(logger.isDebugEnabled()) logger.debug("Writing the log file succeeded.");
}
- public MetricsMap load(Class metricClass, MetricName metricName, Date fromDate, Date toDate) {
+ public MetricsMap load(Class metricClass, MetricName[] metricNames, Date fromDate, Date toDate) {
MetricsMap metricsMap = new MetricsMap();
File dir = new File(persistentPath);
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
@@ -194,7 +194,7 @@
continue;
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("Log file name is illegal.");
}
FileInputStream fis = null;
ZipInputStream zis = null;
@@ -220,17 +220,17 @@
}
bos.close();
ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- metricsMap.merge(readFromFile(bis, metricClass, metricName));
+ metricsMap.merge(readFromFile(bis, metricClass, metricNames));
zis.closeEntry();
}
} catch (Exception e) {
- e.printStackTrace();
+ logger.error("failed to load the metrics data.");
}finally {
try {
if(zis!=null) zis.close();
if(fis!=null) fis.close();
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("failed to close a stream.");
}
}
}
@@ -257,7 +257,7 @@
}
@SuppressWarnings("unchecked")
- private MetricsMap readFromFile(InputStream inputStream, Class metricClass, MetricName metricName) throws XMLStreamException, InstantiationException, IllegalAccessException {
+ private MetricsMap readFromFile(InputStream inputStream, Class metricClass, MetricName[] metricNames) throws XMLStreamException, InstantiationException, IllegalAccessException {
MetricsMap metricsMap = new MetricsMap();
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = factory.createXMLStreamReader(inputStream);
@@ -272,7 +272,11 @@
operationName = reader.getAttributeValue(1).toString();
metricNameString = reader.getAttributeValue(2).toString();
}else if(reader.getLocalName().equals(XML_RECORD)) {
- if(metricName!=MetricName.valueOf(metricNameString)) continue;
+ boolean target = false;
+ for(MetricName metricName : metricNames) {
+ if(metricName==MetricName.valueOf(metricNameString)) target = true;
+ }
+ if(!target) continue;
Map<String, String> properties = new HashMap<String, String>(reader.getAttributeCount());
for(int i=0; i<reader.getAttributeCount(); i++) {
properties.put(reader.getAttributeLocalName(i).toString(), reader.getAttributeValue(i).toString());
1.1.2.3 +5 -5 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/persistor/Attic/MetricsPersistor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MetricsPersistor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/persistor/Attic/MetricsPersistor.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- MetricsPersistor.java 31 Oct 2006 11:29:38 -0000 1.1.2.2
+++ MetricsPersistor.java 6 Nov 2006 07:34:41 -0000 1.1.2.3
@@ -45,11 +45,11 @@
/**
* Loads metric data.
- * @param metricClass - searching metric class object
- * @param metricName - searching metric name object
- * @param fromDate - a date to begin searching
- * @param toDate - a date to end seaching
+ * @param metricClass - searching class of class whitch extends Metric
+ * @param metricNames - searching array of MetricName
+ * @param fromDate - searching date (from)
+ * @param toDate - searching date (to)
* @return metrics data
*/
- MetricsMap load(Class metricClass, MetricName metricName, Date fromDate, Date toDate);
+ MetricsMap load(Class metricClass, MetricName[] metricNames, Date fromDate, Date toDate);
}
More information about the jboss-cvs-commits
mailing list