You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2008/01/23 22:25:41 UTC
svn commit: r614679 [1/2] - in /commons/sandbox/monitoring/trunk: ./
src/main/java/org/apache/commons/monitoring/
src/main/java/org/apache/commons/monitoring/aop/
src/main/java/org/apache/commons/monitoring/impl/
src/main/java/org/apache/commons/monito...
Author: niallp
Date: Wed Jan 23 13:25:36 2008
New Revision: 614679
URL: http://svn.apache.org/viewvc?rev=614679&view=rev
Log:
Set svn properties (keywords and eol style)
Modified:
commons/sandbox/monitoring/trunk/PROPOSAL.html (contents, props changed)
commons/sandbox/monitoring/trunk/pom.xml (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StatValue.java (props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleValue.java (props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/jdbc/TODO.txt (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/JsonRenderer.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/Renderer.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/XmlRenderer.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/TODO.txt (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/resources/META-INF/LICENSE.txt (contents, props changed)
commons/sandbox/monitoring/trunk/src/main/resources/META-INF/NOTICE.txt (contents, props changed)
commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/MonitoringTest.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/StopWatchTest.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/impl/ConcurrencyGaugeTest.java (contents, props changed)
commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java (contents, props changed)
Modified: commons/sandbox/monitoring/trunk/PROPOSAL.html
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/PROPOSAL.html?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/PROPOSAL.html (original)
+++ commons/sandbox/monitoring/trunk/PROPOSAL.html Wed Jan 23 13:25:36 2008
@@ -1,94 +1,94 @@
-<html>
-<head>
-<title>Proposal for monitoring Package</title>
-</head>
-<body bgcolor="white">
-
-<div align="center">
-<h1>Proposal for <em>monitoring</em> Package</h1>
-</div>
-
-<h3>(0) Rationale</h3>
-
-<p>Entreprise Java application are expected to be scalable, performant, flexible, maintainable and highly available.
-To ensure this, we need to instrument the application with tooling, both during development to detect design
-bottlenecks and on production to monitor application behaviour and health.
-</p>
-<p>
-The standard Java Management eXtension (JMX) provides the required backbone for nice management and monitoring
-tools, but with the cost of complexity and requirement for application to compute the state it wants to expose.
-</p>
-<p>
-Profilers give very detailled report on code execution, performance, memory usage and thread-safety, but can only
-be used during developpement.
-</p>
-<p>
-Some opensource project allready try to fill the gap by providing simple monitoring tools :
-<ul>
-<li><a href="http://www.jamonapi.com">JamonAPI</a> is a well known monitoring toolkit, but lacks for a modular design
-and a clean tooling (separation between code and tests..). It is driven by a single individual, and as a
-result doesn't take advantage of an apache-like community driven emulation.</li>
-<li><a href="http://http://moskito.anotheria.net">Moskito</a> is nicely designed, but requires some technical
-inheritence and for this reason is too much intrusive. Its user community is still tiny accoring to sourceforge statistics</li>
-</ul>
-</p>
-
-
-<h3>(1) Scope of the Package</h3>
-
-<p>This proposal is to create a new apache commons component to provide a simple monitoring infrastructure, with simplicity and
-extensibility in mind, and following Apache quality standards. By beeing hosted in apache commons, it expect to gather talentuous
-developers curisoity / interest and to envolve as a must-have component for java developers.
-.</p>
-
-
-<h3>(1.5) Interaction With Other Packages</h3>
-
-<p><em>monitoring</em> relies on standard Java 5 (or later) APIs for
-production deployment. It utilizes the JUnit unit testing framework for
-developing and executing unit tests, but this is of interest only to
-developers of the component.</p>
-<p>Retrotranslator is used to create a backport version of the component to get used under Java 1.3 or 1.4. On such
-runtimes, backport-util-concurrent will be required.</p>
-<p><em>monitoring</em> provides Helper classes for various frameworks to make monitoring easier. Those dependencies
-are only required by user wanting to use them. Maven meta-datas are declared as <code>optional</code> to avoid unexpected transitive
-dependencies.</p>
-
-<p>No external configuration files are utilized.</p>
-
-
-<h3>(2) Initial Source of the Package</h3>
-
-<p>The original Java classes are created from scratch based on some initial experiments to
-build a clean monitoring toolkit.</p>
-
-<p>The proposed package name for the new component is
-<code>org.apache.commons.monitoring</code>.</p>
-
-
-<h3>(3) Required Apache Commons Resources</h3>
-
-<ul>
-<li>SVN Repository - New directory <code>monitoring</code> in the
- <code>commons</code> SVN repository.</li>
-<li>Mailing List - Discussions will take place on the general
- <em>dev@commons.apache.org</em> mailing list. To help
- list subscribers identify messages of interest, it is suggested that
- the message subject of messages about this component be prefixed with
- [monitoring].</li>
-<li>JIRA Issue Tracking - New component "monitoring" under the "Commons" product
- category, with appropriate version identifiers as needed.</li>
-</ul>
-
-
-<h3>(4) Initial Committers</h3>
-
-<p>The initial committers on the monitoring component shall be:
-<ul>
- <li><a href="mailto:nicolas@apache.org">Nicolas De Loof</a></li>
-</ul>
-</p>
-
-
-</body>
-</html>
+<html>
+<head>
+<title>Proposal for monitoring Package</title>
+</head>
+<body bgcolor="white">
+
+<div align="center">
+<h1>Proposal for <em>monitoring</em> Package</h1>
+</div>
+
+<h3>(0) Rationale</h3>
+
+<p>Entreprise Java application are expected to be scalable, performant, flexible, maintainable and highly available.
+To ensure this, we need to instrument the application with tooling, both during development to detect design
+bottlenecks and on production to monitor application behaviour and health.
+</p>
+<p>
+The standard Java Management eXtension (JMX) provides the required backbone for nice management and monitoring
+tools, but with the cost of complexity and requirement for application to compute the state it wants to expose.
+</p>
+<p>
+Profilers give very detailled report on code execution, performance, memory usage and thread-safety, but can only
+be used during developpement.
+</p>
+<p>
+Some opensource project allready try to fill the gap by providing simple monitoring tools :
+<ul>
+<li><a href="http://www.jamonapi.com">JamonAPI</a> is a well known monitoring toolkit, but lacks for a modular design
+and a clean tooling (separation between code and tests..). It is driven by a single individual, and as a
+result doesn't take advantage of an apache-like community driven emulation.</li>
+<li><a href="http://http://moskito.anotheria.net">Moskito</a> is nicely designed, but requires some technical
+inheritence and for this reason is too much intrusive. Its user community is still tiny accoring to sourceforge statistics</li>
+</ul>
+</p>
+
+
+<h3>(1) Scope of the Package</h3>
+
+<p>This proposal is to create a new apache commons component to provide a simple monitoring infrastructure, with simplicity and
+extensibility in mind, and following Apache quality standards. By beeing hosted in apache commons, it expect to gather talentuous
+developers curisoity / interest and to envolve as a must-have component for java developers.
+.</p>
+
+
+<h3>(1.5) Interaction With Other Packages</h3>
+
+<p><em>monitoring</em> relies on standard Java 5 (or later) APIs for
+production deployment. It utilizes the JUnit unit testing framework for
+developing and executing unit tests, but this is of interest only to
+developers of the component.</p>
+<p>Retrotranslator is used to create a backport version of the component to get used under Java 1.3 or 1.4. On such
+runtimes, backport-util-concurrent will be required.</p>
+<p><em>monitoring</em> provides Helper classes for various frameworks to make monitoring easier. Those dependencies
+are only required by user wanting to use them. Maven meta-datas are declared as <code>optional</code> to avoid unexpected transitive
+dependencies.</p>
+
+<p>No external configuration files are utilized.</p>
+
+
+<h3>(2) Initial Source of the Package</h3>
+
+<p>The original Java classes are created from scratch based on some initial experiments to
+build a clean monitoring toolkit.</p>
+
+<p>The proposed package name for the new component is
+<code>org.apache.commons.monitoring</code>.</p>
+
+
+<h3>(3) Required Apache Commons Resources</h3>
+
+<ul>
+<li>SVN Repository - New directory <code>monitoring</code> in the
+ <code>commons</code> SVN repository.</li>
+<li>Mailing List - Discussions will take place on the general
+ <em>dev@commons.apache.org</em> mailing list. To help
+ list subscribers identify messages of interest, it is suggested that
+ the message subject of messages about this component be prefixed with
+ [monitoring].</li>
+<li>JIRA Issue Tracking - New component "monitoring" under the "Commons" product
+ category, with appropriate version identifiers as needed.</li>
+</ul>
+
+
+<h3>(4) Initial Committers</h3>
+
+<p>The initial committers on the monitoring component shall be:
+<ul>
+ <li><a href="mailto:nicolas@apache.org">Nicolas De Loof</a></li>
+</ul>
+</p>
+
+
+</body>
+</html>
Propchange: commons/sandbox/monitoring/trunk/PROPOSAL.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/PROPOSAL.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/pom.xml?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/pom.xml (original)
+++ commons/sandbox/monitoring/trunk/pom.xml Wed Jan 23 13:25:36 2008
@@ -1,94 +1,94 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-sandbox-parent</artifactId>
- <version>3</version>
- </parent>
-
- <artifactId>commons-monitoring</artifactId>
- <version>1.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Commons Monitoring (Sandbox)</name>
- <url>http://commons.apache.org/sandbox/monitoring/</url>
- <inceptionYear>2008</inceptionYear>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <developers>
- <developer>
- <id>nicolas</id>
- <name>Nicolas De Loof</name>
- <email>nicolas AT apache DOT org</email>
- <organization>Apache</organization>
- <timezone>+10</timezone>
- </developer>
- </developers>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/commons/sandbox/monitoring/trunk/</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/sandboxmonitoring/trunk/</developerConnection>
- <url>http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.2.0</version>
- <extensions>true</extensions>
- <configuration>
- <excludeDependencies>true</excludeDependencies>
- <instructions>
- <Bundle-SymbolicName>org.apache.commons.monitoring</Bundle-SymbolicName>
- <Export-Package>org.apache.commons.monitoring;version=${project.version}</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <distributionManagement>
- <site>
- <id>website</id>
- <name>Apache Website</name>
- <url>scp://people.apache.org/www/commons.apache.org/sandbox/monitoring/</url>
- </site>
- </distributionManagement>
-
- <!-- Compiler source and target JVM (see parent pom) -->
- <properties>
- <maven.compile.source>1.5</maven.compile.source>
- <maven.compile.target>1.5</maven.compile.target>
- </properties>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-sandbox-parent</artifactId>
+ <version>3</version>
+ </parent>
+
+ <artifactId>commons-monitoring</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>Commons Monitoring (Sandbox)</name>
+ <url>http://commons.apache.org/sandbox/monitoring/</url>
+ <inceptionYear>2008</inceptionYear>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <developers>
+ <developer>
+ <id>nicolas</id>
+ <name>Nicolas De Loof</name>
+ <email>nicolas AT apache DOT org</email>
+ <organization>Apache</organization>
+ <timezone>+10</timezone>
+ </developer>
+ </developers>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/commons/sandbox/monitoring/trunk/</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/sandboxmonitoring/trunk/</developerConnection>
+ <url>http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/</url>
+ </scm>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <excludeDependencies>true</excludeDependencies>
+ <instructions>
+ <Bundle-SymbolicName>org.apache.commons.monitoring</Bundle-SymbolicName>
+ <Export-Package>org.apache.commons.monitoring;version=${project.version}</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <site>
+ <id>website</id>
+ <name>Apache Website</name>
+ <url>scp://people.apache.org/www/commons.apache.org/sandbox/monitoring/</url>
+ </site>
+ </distributionManagement>
+
+ <!-- Compiler source and target JVM (see parent pom) -->
+ <properties>
+ <maven.compile.source>1.5</maven.compile.source>
+ <maven.compile.target>1.5</maven.compile.target>
+ </properties>
+
+</project>
Propchange: commons/sandbox/monitoring/trunk/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java Wed Jan 23 13:25:36 2008
@@ -1,38 +1,38 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-/**
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public interface Counter
- extends StatValue
-{
-
- void add( long delta );
-
- /**
- * @return the sum of all set operations
- */
- long total();
-
- /**
- * @return how many time the value has been set
- */
- int hits();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+/**
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public interface Counter
+ extends StatValue
+{
+
+ void add( long delta );
+
+ /**
+ * @return the sum of all set operations
+ */
+ long total();
+
+ /**
+ * @return how many time the value has been set
+ */
+ int hits();
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Counter.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java Wed Jan 23 13:25:36 2008
@@ -1,30 +1,30 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-/**
- *
- *
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public interface Gauge extends StatValue
-{
- void increment();
-
- void decrement();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+/**
+ *
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public interface Gauge extends StatValue
+{
+ void increment();
+
+ void decrement();
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Gauge.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java Wed Jan 23 13:25:36 2008
@@ -1,210 +1,210 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-/**
- * A <code>Monitor</code> is an abstraction of some application resource that
- * is instrumented with a set of indicators (Gauges or Counters).
- * <p>
- * A Monitor is identified by its Key, that MUST be unique in the application.
- * To ensure this, the Key class defines the monitor identifier as a combination
- * of name, subsystem and category.
- * <p>
- * The <tt>name</tt> is the human-readable representation of the "resource"
- * beeing monitored. A typical use is the fully qualified class name + method
- * signature, or the HTTP request path.
- * <p>
- * The <tt>category</tt> is a grouping attribute to reflect the application
- * layering. Typically for JEE application, you will set category to the N-tier
- * layer beeing monitored ("servlet", "service", "persistence").
- * <p>
- * The <tt>subsystem</tt> is a logical grouping, by use-cases. "account", and
- * "user" can be used as subsystem for the application account and user
- * management dedicated components.
- * <p>
- * You are free to use more complex Key types, by simple subclassing the Key
- * class and providing the adequate equals()/hasCode() methods.
- * <p>
- * The Counters / Gauges used to store monitored application state are retrieved
- * based on a "role" String. The monitor can handle as many values as needed,
- * until any of them has a dedicated role. This allows to easily extend the
- * monitor by registering custom values.
- *
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public interface Monitor
-{
- /** default role key for execution performances */
- String PERFORMANCES = "performances";
-
- /** default role for multi-thread concurrency */
- String CONCURRENCY = "concurrency";
-
- /**
- * @return the monitor key
- */
- Key getKey();
-
- /**
- * @param role a unique identifier for a Counter in the monitor
- * @return the Counter
- */
- Counter getCounter( String role );
-
- /**
- * @param role a unique identifier for a Gauge in the monitor
- * @return the Gauge
- */
- Gauge getGauge( String role );
-
- /**
- * @param role a unique identifier for a StatValue in the monitor
- * @return the StatValue
- */
- StatValue getValue( String role );
-
- /**
- * Register a StatValue to the monitor with the specified role. If the
- * monitor already had a StatValue for the specified role, the registration
- * is rejected and the method returns <code>false</code>
- *
- * @param value the StatValue
- * @param role the StatValue role in the monitor.
- * @return <code>false</code> if there is already a StatValue for this
- * role in the monitor.
- */
- boolean setValue( StatValue value, String role );
-
- /**
- * Identifier class for Monitors
- */
- public static class Key
- {
- private final String name;
-
- private final String category;
-
- private final String subsystem;
-
- public Key( String name, String category, String subsystem )
- {
- super();
- this.name = name;
- this.category = category;
- this.subsystem = subsystem;
- }
-
- @Override
- public String toString()
- {
- StringBuffer stb = new StringBuffer();
- stb.append( "name=" );
- stb.append( name );
- if ( category != null )
- {
- stb.append( "\ncategory=" );
- stb.append( category );
- }
- if ( subsystem != null )
- {
- stb.append( "\nsubsystem=" );
- stb.append( subsystem );
- }
- return stb.toString();
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ( ( category == null ) ? 0 : category.hashCode() );
- result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
- result = prime * result + ( ( subsystem == null ) ? 0 : subsystem.hashCode() );
- return result;
- }
-
- @Override
- public boolean equals( Object obj )
- {
- if ( this == obj )
- {
- return true;
- }
- if ( obj == null )
- {
- return false;
- }
- if ( getClass() != obj.getClass() )
- {
- return false;
- }
- final Key other = (Key) obj;
- if ( category == null )
- {
- if ( other.category != null )
- {
- return false;
- }
- }
- else if ( !category.equals( other.category ) )
- {
- return false;
- }
- if ( name == null )
- {
- if ( other.name != null )
- {
- return false;
- }
- }
- else if ( !name.equals( other.name ) )
- {
- return false;
- }
- if ( subsystem == null )
- {
- if ( other.subsystem != null )
- {
- return false;
- }
- }
- else if ( !subsystem.equals( other.subsystem ) )
- {
- return false;
- }
- return true;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getCategory()
- {
- return category;
- }
-
- public String getSubsystem()
- {
- return subsystem;
- }
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+/**
+ * A <code>Monitor</code> is an abstraction of some application resource that
+ * is instrumented with a set of indicators (Gauges or Counters).
+ * <p>
+ * A Monitor is identified by its Key, that MUST be unique in the application.
+ * To ensure this, the Key class defines the monitor identifier as a combination
+ * of name, subsystem and category.
+ * <p>
+ * The <tt>name</tt> is the human-readable representation of the "resource"
+ * beeing monitored. A typical use is the fully qualified class name + method
+ * signature, or the HTTP request path.
+ * <p>
+ * The <tt>category</tt> is a grouping attribute to reflect the application
+ * layering. Typically for JEE application, you will set category to the N-tier
+ * layer beeing monitored ("servlet", "service", "persistence").
+ * <p>
+ * The <tt>subsystem</tt> is a logical grouping, by use-cases. "account", and
+ * "user" can be used as subsystem for the application account and user
+ * management dedicated components.
+ * <p>
+ * You are free to use more complex Key types, by simple subclassing the Key
+ * class and providing the adequate equals()/hasCode() methods.
+ * <p>
+ * The Counters / Gauges used to store monitored application state are retrieved
+ * based on a "role" String. The monitor can handle as many values as needed,
+ * until any of them has a dedicated role. This allows to easily extend the
+ * monitor by registering custom values.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public interface Monitor
+{
+ /** default role key for execution performances */
+ String PERFORMANCES = "performances";
+
+ /** default role for multi-thread concurrency */
+ String CONCURRENCY = "concurrency";
+
+ /**
+ * @return the monitor key
+ */
+ Key getKey();
+
+ /**
+ * @param role a unique identifier for a Counter in the monitor
+ * @return the Counter
+ */
+ Counter getCounter( String role );
+
+ /**
+ * @param role a unique identifier for a Gauge in the monitor
+ * @return the Gauge
+ */
+ Gauge getGauge( String role );
+
+ /**
+ * @param role a unique identifier for a StatValue in the monitor
+ * @return the StatValue
+ */
+ StatValue getValue( String role );
+
+ /**
+ * Register a StatValue to the monitor with the specified role. If the
+ * monitor already had a StatValue for the specified role, the registration
+ * is rejected and the method returns <code>false</code>
+ *
+ * @param value the StatValue
+ * @param role the StatValue role in the monitor.
+ * @return <code>false</code> if there is already a StatValue for this
+ * role in the monitor.
+ */
+ boolean setValue( StatValue value, String role );
+
+ /**
+ * Identifier class for Monitors
+ */
+ public static class Key
+ {
+ private final String name;
+
+ private final String category;
+
+ private final String subsystem;
+
+ public Key( String name, String category, String subsystem )
+ {
+ super();
+ this.name = name;
+ this.category = category;
+ this.subsystem = subsystem;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer stb = new StringBuffer();
+ stb.append( "name=" );
+ stb.append( name );
+ if ( category != null )
+ {
+ stb.append( "\ncategory=" );
+ stb.append( category );
+ }
+ if ( subsystem != null )
+ {
+ stb.append( "\nsubsystem=" );
+ stb.append( subsystem );
+ }
+ return stb.toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( category == null ) ? 0 : category.hashCode() );
+ result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
+ result = prime * result + ( ( subsystem == null ) ? 0 : subsystem.hashCode() );
+ return result;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( obj == null )
+ {
+ return false;
+ }
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+ final Key other = (Key) obj;
+ if ( category == null )
+ {
+ if ( other.category != null )
+ {
+ return false;
+ }
+ }
+ else if ( !category.equals( other.category ) )
+ {
+ return false;
+ }
+ if ( name == null )
+ {
+ if ( other.name != null )
+ {
+ return false;
+ }
+ }
+ else if ( !name.equals( other.name ) )
+ {
+ return false;
+ }
+ if ( subsystem == null )
+ {
+ if ( other.subsystem != null )
+ {
+ return false;
+ }
+ }
+ else if ( !subsystem.equals( other.subsystem ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getCategory()
+ {
+ return category;
+ }
+
+ public String getSubsystem()
+ {
+ return subsystem;
+ }
+
+ }
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java Wed Jan 23 13:25:36 2008
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-import org.apache.commons.monitoring.impl.RepositoryBase;
-
-/**
- * Utility class for simpified application instrumentation
- *
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public final class Monitoring
-{
- private Monitoring()
- {
- super();
- }
-
- private static Repository repository = new RepositoryBase();
-
- public static Monitor getMonitor( String name, String category, String subsystem )
- {
- return repository.getMonitor( name, category, subsystem );
- }
-
- public static Monitor getMonitor( String name, String category )
- {
- return getMonitor( name, category, null );
- }
-
- public static Monitor getMonitor( String name )
- {
- return getMonitor( name, null, null );
- }
-
- public static StopWatch start( String name )
- {
- return start( name, null, null );
- }
-
- public static StopWatch start( String name, String category )
- {
- return start( name, category, null );
- }
-
- public static StopWatch start( String name, String category, String subsystem )
- {
- return new StopWatch( getMonitor( name, category, subsystem ) );
- }
-
- public static void setRepository( Repository repository )
- {
- Monitoring.repository = repository;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+import org.apache.commons.monitoring.impl.RepositoryBase;
+
+/**
+ * Utility class for simpified application instrumentation
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public final class Monitoring
+{
+ private Monitoring()
+ {
+ super();
+ }
+
+ private static Repository repository = new RepositoryBase();
+
+ public static Monitor getMonitor( String name, String category, String subsystem )
+ {
+ return repository.getMonitor( name, category, subsystem );
+ }
+
+ public static Monitor getMonitor( String name, String category )
+ {
+ return getMonitor( name, category, null );
+ }
+
+ public static Monitor getMonitor( String name )
+ {
+ return getMonitor( name, null, null );
+ }
+
+ public static StopWatch start( String name )
+ {
+ return start( name, null, null );
+ }
+
+ public static StopWatch start( String name, String category )
+ {
+ return start( name, category, null );
+ }
+
+ public static StopWatch start( String name, String category, String subsystem )
+ {
+ return new StopWatch( getMonitor( name, category, subsystem ) );
+ }
+
+ public static void setRepository( Repository repository )
+ {
+ Monitoring.repository = repository;
+ }
+
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitoring.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java Wed Jan 23 13:25:36 2008
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-import java.util.Collection;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public interface Repository
-{
- Monitor getMonitor( String name );
-
- Monitor getMonitor( String name, String category );
-
- Monitor getMonitor( String name, String category, String subsystem );
-
- /**
- * @return all monitors registered in the repository
- */
- public Collection<Monitor> getMonitors();
-
- /**
- * @param category a category name
- * @return all monitors in the repository that declare this category in
- * there Key
- */
- public Collection<Monitor> getMonitorsFromCategory( String category );
-
- /**
- * @param subsystem a subsystem name
- * @return all monitors in the repository that declare this subsystem in
- * there Key
- */
- public Collection<Monitor> getMonitorsFromSubSystem( String subsystem );
-
- /**
- * @return the categories declared by monitors in the repository
- */
- public Set<String> getCategories();
-
- /**
- * @return the subsystems declared by monitors in the repository
- */
- public Set<String> getSubSystems();
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public interface Repository
+{
+ Monitor getMonitor( String name );
+
+ Monitor getMonitor( String name, String category );
+
+ Monitor getMonitor( String name, String category, String subsystem );
+
+ /**
+ * @return all monitors registered in the repository
+ */
+ public Collection<Monitor> getMonitors();
+
+ /**
+ * @param category a category name
+ * @return all monitors in the repository that declare this category in
+ * there Key
+ */
+ public Collection<Monitor> getMonitorsFromCategory( String category );
+
+ /**
+ * @param subsystem a subsystem name
+ * @return all monitors in the repository that declare this subsystem in
+ * there Key
+ */
+ public Collection<Monitor> getMonitorsFromSubSystem( String subsystem );
+
+ /**
+ * @return the categories declared by monitors in the repository
+ */
+ public Set<String> getCategories();
+
+ /**
+ * @return the subsystems declared by monitors in the repository
+ */
+ public Set<String> getSubSystems();
+
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Repository.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StatValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StatValue.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java Wed Jan 23 13:25:36 2008
@@ -1,227 +1,227 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring;
-
-/**
- * Estimates the time required for process execution (monitored method, service
- * invocation, database request...)
- *
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public class StopWatch
-{
- /** Time the probe was started */
- private final long startedAt;
-
- /** Time the probe was stopped */
- private long stopedAt;
-
- /** Time the probe was paused */
- private long pauseDelay;
-
- /** flag for stopped probe */
- private boolean stoped;
-
- /** flag for paused probe */
- private boolean paused;
-
- /** Monitor that is notified of process execution state */
- private final Monitor monitor;
-
- /**
- * Constructor.
- * <p>
- * The monitor can be set to null to use the StopWatch without the
- * monitoring infrastructure.
- *
- * @param monitor the monitor associated with the process to be monitored
- */
- public StopWatch( Monitor monitor )
- {
- super();
- this.monitor = monitor;
- startedAt = nanotime();
- if ( monitor != null )
- {
- monitor.getGauge( Monitor.CONCURRENCY ).increment();
- }
- }
-
- /**
- * @return Elapsed time (in nanoseconds) for the monitored process
- */
- public long getElapsedTime()
- {
- long delay;
- if ( stoped || paused )
- {
- delay = stopedAt - startedAt - pauseDelay;
- }
- else
- {
- // Still running !
- delay = nanotime() - startedAt - pauseDelay;
- }
- return delay;
- }
-
- /**
- * Temporary stop the StopWatch. Elapsed time calculation will not include
- * time spent in paused mode.
- */
- public void pause()
- {
- if ( !paused && !stoped )
- {
- stopedAt = nanotime();
- paused = true;
- }
- }
-
- /**
- * Resume the StopWatch after a pause.
- */
- public void resume()
- {
- if ( paused && !stoped )
- {
- pauseDelay = nanotime() - stopedAt;
- paused = false;
- stopedAt = 0;
- }
- }
-
- /**
- * Stop monitoring the process. A StopWatch created with
- * {@link #start(Monitor)} cannot be re-used after stopped has been called.
- */
- public void stop()
- {
- if ( !stoped )
- {
- long t = nanotime();
- if ( paused )
- {
- pauseDelay = t - stopedAt;
- }
- stopedAt = t;
- stoped = true;
- if ( monitor != null )
- {
- monitor.getGauge( Monitor.CONCURRENCY ).decrement();
- monitor.getCounter( Monitor.PERFORMANCES ).add( getElapsedTime() );
- }
- }
- }
-
- /**
- * Convenience method to stop or cancel a Stopwatch depending on success of
- * monitored operation
- *
- * @param canceled
- * @return time elapsed since the probe has been started
- */
- public void stop( boolean canceled )
- {
- if ( canceled )
- {
- cancel();
- }
- else
- {
- stop();
- }
- }
-
- /**
- * Cancel monitoring. Elapsed time will not be computed and will not be
- * published to the monitor.
- * <p>
- * In some circumstances you want to monitor time elapsed from early stage
- * of computation, and discover latter if the computed data is relevant. For
- * example, monitoring a messaging system, but beeing interested only by
- * some types of messages. In such case, a StopWatch can be started early
- * and canceled when the application is able to determine it's relevancy.
- * <p>
- * In any way, the probe will still report thread concurrency even if
- * canceled.
- */
- public void cancel()
- {
- if ( !stoped )
- {
- stoped = true;
- if ( monitor != null )
- {
- monitor.getGauge( Monitor.CONCURRENCY ).decrement();
- }
- }
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Monitored application should use a <code>try/finally</code> block to
- * ensure on of {@link #stop()} or {@link #cancel()} method is invoked, even
- * when an exception occurs. To avoid StopWatches to keep running if the
- * application didn't follow this recommandation, the finalizer is used to
- * cancel the StopWatch and will log a educational warning.
- *
- * @see java.lang.Object#finalize()
- */
- protected void finalize()
- {
- // This probe is reclaimed by garbage-collector and still running,
- // the monitored code "forgot" to stop/cancel it properly.
- if ( !stoped && ( monitor != null ) )
- {
- System.err.println( "WARNING : Execution for " + monitor.getKey().toString() + " was not stoped properly. "
- + "This can result in wrong concurrency monitoring. " + "Use try/finally blocks to avoid this warning" );
- }
- }
-
- /**
- * Returns the current value of the most precise available system timer, in
- * nanoseconds. The real precision depends on the JVM and the underlying
- * system. On JRE before java5, <tt>backport-util-concurrent</tt> provides
- * some limited support for equivalent timer.
- *
- * @see System#nanoTime()
- * @return time in nanosecond
- */
- protected long nanotime()
- {
- return System.nanoTime();
- }
-
- /**
- * @return <code>true</code> if the StopWatch has been stopped
- */
- public boolean isStoped()
- {
- return stoped;
- }
-
- /**
- * @return <code>true</code> if the StopWatch has been paused
- */
- public boolean isPaused()
- {
- return paused;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring;
+
+/**
+ * Estimates the time required for process execution (monitored method, service
+ * invocation, database request...)
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class StopWatch
+{
+ /** Time the probe was started */
+ private final long startedAt;
+
+ /** Time the probe was stopped */
+ private long stopedAt;
+
+ /** Time the probe was paused */
+ private long pauseDelay;
+
+ /** flag for stopped probe */
+ private boolean stoped;
+
+ /** flag for paused probe */
+ private boolean paused;
+
+ /** Monitor that is notified of process execution state */
+ private final Monitor monitor;
+
+ /**
+ * Constructor.
+ * <p>
+ * The monitor can be set to null to use the StopWatch without the
+ * monitoring infrastructure.
+ *
+ * @param monitor the monitor associated with the process to be monitored
+ */
+ public StopWatch( Monitor monitor )
+ {
+ super();
+ this.monitor = monitor;
+ startedAt = nanotime();
+ if ( monitor != null )
+ {
+ monitor.getGauge( Monitor.CONCURRENCY ).increment();
+ }
+ }
+
+ /**
+ * @return Elapsed time (in nanoseconds) for the monitored process
+ */
+ public long getElapsedTime()
+ {
+ long delay;
+ if ( stoped || paused )
+ {
+ delay = stopedAt - startedAt - pauseDelay;
+ }
+ else
+ {
+ // Still running !
+ delay = nanotime() - startedAt - pauseDelay;
+ }
+ return delay;
+ }
+
+ /**
+ * Temporary stop the StopWatch. Elapsed time calculation will not include
+ * time spent in paused mode.
+ */
+ public void pause()
+ {
+ if ( !paused && !stoped )
+ {
+ stopedAt = nanotime();
+ paused = true;
+ }
+ }
+
+ /**
+ * Resume the StopWatch after a pause.
+ */
+ public void resume()
+ {
+ if ( paused && !stoped )
+ {
+ pauseDelay = nanotime() - stopedAt;
+ paused = false;
+ stopedAt = 0;
+ }
+ }
+
+ /**
+ * Stop monitoring the process. A StopWatch created with
+ * {@link #start(Monitor)} cannot be re-used after stopped has been called.
+ */
+ public void stop()
+ {
+ if ( !stoped )
+ {
+ long t = nanotime();
+ if ( paused )
+ {
+ pauseDelay = t - stopedAt;
+ }
+ stopedAt = t;
+ stoped = true;
+ if ( monitor != null )
+ {
+ monitor.getGauge( Monitor.CONCURRENCY ).decrement();
+ monitor.getCounter( Monitor.PERFORMANCES ).add( getElapsedTime() );
+ }
+ }
+ }
+
+ /**
+ * Convenience method to stop or cancel a Stopwatch depending on success of
+ * monitored operation
+ *
+ * @param canceled
+ * @return time elapsed since the probe has been started
+ */
+ public void stop( boolean canceled )
+ {
+ if ( canceled )
+ {
+ cancel();
+ }
+ else
+ {
+ stop();
+ }
+ }
+
+ /**
+ * Cancel monitoring. Elapsed time will not be computed and will not be
+ * published to the monitor.
+ * <p>
+ * In some circumstances you want to monitor time elapsed from early stage
+ * of computation, and discover latter if the computed data is relevant. For
+ * example, monitoring a messaging system, but beeing interested only by
+ * some types of messages. In such case, a StopWatch can be started early
+ * and canceled when the application is able to determine it's relevancy.
+ * <p>
+ * In any way, the probe will still report thread concurrency even if
+ * canceled.
+ */
+ public void cancel()
+ {
+ if ( !stoped )
+ {
+ stoped = true;
+ if ( monitor != null )
+ {
+ monitor.getGauge( Monitor.CONCURRENCY ).decrement();
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Monitored application should use a <code>try/finally</code> block to
+ * ensure on of {@link #stop()} or {@link #cancel()} method is invoked, even
+ * when an exception occurs. To avoid StopWatches to keep running if the
+ * application didn't follow this recommandation, the finalizer is used to
+ * cancel the StopWatch and will log a educational warning.
+ *
+ * @see java.lang.Object#finalize()
+ */
+ protected void finalize()
+ {
+ // This probe is reclaimed by garbage-collector and still running,
+ // the monitored code "forgot" to stop/cancel it properly.
+ if ( !stoped && ( monitor != null ) )
+ {
+ System.err.println( "WARNING : Execution for " + monitor.getKey().toString() + " was not stoped properly. "
+ + "This can result in wrong concurrency monitoring. " + "Use try/finally blocks to avoid this warning" );
+ }
+ }
+
+ /**
+ * Returns the current value of the most precise available system timer, in
+ * nanoseconds. The real precision depends on the JVM and the underlying
+ * system. On JRE before java5, <tt>backport-util-concurrent</tt> provides
+ * some limited support for equivalent timer.
+ *
+ * @see System#nanoTime()
+ * @return time in nanosecond
+ */
+ protected long nanotime()
+ {
+ return System.nanoTime();
+ }
+
+ /**
+ * @return <code>true</code> if the StopWatch has been stopped
+ */
+ public boolean isStoped()
+ {
+ return stoped;
+ }
+
+ /**
+ * @return <code>true</code> if the StopWatch has been paused
+ */
+ public boolean isPaused()
+ {
+ return paused;
+ }
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/StopWatch.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt Wed Jan 23 13:25:36 2008
@@ -1,7 +1,7 @@
-Create AOP-based monitoring helpers :
-
- - an Aopalliance method interceptor
- - a Spring BeanNameAutoProxyAdvisor or equivalent
- - an AspectJ abstract aspect
- - a simple proxy-based wrapper
-
+Create AOP-based monitoring helpers :
+
+ - an Aopalliance method interceptor
+ - a Spring BeanNameAutoProxyAdvisor or equivalent
+ - an AspectJ abstract aspect
+ - a simple proxy-based wrapper
+
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/TODO.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java Wed Jan 23 13:25:36 2008
@@ -1,66 +1,66 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring.impl;
-
-public class ConcurrencyGauge
- extends SimpleValue
-{
- private long cpuTime;
-
- private long lastUse;
-
- private long firstUse;
-
- @Override
- public synchronized void increment()
- {
- long now = nanoTime();
- if ( firstUse == 0 )
- {
- firstUse = now;
- }
- if ( lastUse > 0 )
- {
- long delta = now - lastUse;
- cpuTime += get() * delta;
- }
- super.increment();
- lastUse = now;
- }
-
- protected long nanoTime()
- {
- return System.nanoTime();
- }
-
- @Override
- public synchronized void decrement()
- {
- long now = nanoTime();
- long delta = now - lastUse;
- cpuTime += get() * delta;
- super.decrement();
- lastUse = now;
- }
-
- @Override
- public synchronized double average()
- {
- return ( (double) cpuTime ) / ( lastUse - firstUse );
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring.impl;
+
+public class ConcurrencyGauge
+ extends SimpleValue
+{
+ private long cpuTime;
+
+ private long lastUse;
+
+ private long firstUse;
+
+ @Override
+ public synchronized void increment()
+ {
+ long now = nanoTime();
+ if ( firstUse == 0 )
+ {
+ firstUse = now;
+ }
+ if ( lastUse > 0 )
+ {
+ long delta = now - lastUse;
+ cpuTime += get() * delta;
+ }
+ super.increment();
+ lastUse = now;
+ }
+
+ protected long nanoTime()
+ {
+ return System.nanoTime();
+ }
+
+ @Override
+ public synchronized void decrement()
+ {
+ long now = nanoTime();
+ long delta = now - lastUse;
+ cpuTime += get() * delta;
+ super.decrement();
+ lastUse = now;
+ }
+
+ @Override
+ public synchronized double average()
+ {
+ return ( (double) cpuTime ) / ( lastUse - firstUse );
+ }
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/ConcurrencyGauge.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java Wed Jan 23 13:25:36 2008
@@ -1,129 +1,129 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring.impl;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.commons.monitoring.Monitor;
-import org.apache.commons.monitoring.Repository;
-import org.apache.commons.monitoring.Monitor.Key;
-
-public class RepositoryBase
- implements Repository
-{
-
- public final ConcurrentMap<Monitor.Key, Monitor> monitors;
-
- public RepositoryBase()
- {
- super();
- this.monitors = new ConcurrentHashMap<Monitor.Key, Monitor>( 50 );
- }
-
- public Monitor getMonitor( String name )
- {
- return getMonitor( name, null, null );
- }
-
- public Monitor getMonitor( String name, String category )
- {
- return getMonitor( name, category, null );
- }
-
- public Set<String> getCategories()
- {
- Set<String> categories = new HashSet<String>();
- for ( Key key : monitors.keySet() )
- {
- categories.add( key.getCategory() );
- }
- return categories;
- }
-
- public Set<String> getSubSystems()
- {
- Set<String> subsystems = new HashSet<String>();
- for ( Key key : monitors.keySet() )
- {
- subsystems.add( key.getSubsystem() );
- }
- return subsystems;
- }
-
- public Monitor getMonitor( String name, String category, String subsystem )
- {
- Monitor.Key key = new Monitor.Key( name, null, null );
- Monitor monitor = monitors.get( key );
- if ( monitor == null )
- {
- monitor = newMonitorInstance( key );
- Monitor previous = monitors.putIfAbsent( key, monitor );
- if ( previous != null )
- {
- monitor = previous;
- }
- }
- return monitor;
- }
-
- protected Monitor newMonitorInstance( Monitor.Key key )
- {
- Monitor monitor;
- monitor = new SimpleMonitor( key );
- monitor.setValue( new SimpleValue(), Monitor.PERFORMANCES );
- monitor.setValue( new ConcurrencyGauge(), Monitor.CONCURRENCY );
- return monitor;
- }
-
- public Collection<Monitor> getMonitors()
- {
- return Collections.unmodifiableCollection( monitors.values() );
- }
-
- public Collection<Monitor> getMonitorsFromCategory( String category )
- {
- Collection<Monitor> filtered = new LinkedList<Monitor>();
- for ( Monitor monitor : monitors.values() )
- {
- if ( category.equals( monitor.getKey().getCategory() ) )
- {
- filtered.add( monitor );
- }
- }
- return filtered;
- }
-
- public Collection<Monitor> getMonitorsFromSubSystem( String subsystem )
- {
- Collection<Monitor> filtered = new LinkedList<Monitor>();
- for ( Monitor monitor : monitors.values() )
- {
- if ( subsystem.equals( monitor.getKey().getSubsystem() ) )
- {
- filtered.add( monitor );
- }
- }
- return filtered;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.commons.monitoring.Monitor;
+import org.apache.commons.monitoring.Repository;
+import org.apache.commons.monitoring.Monitor.Key;
+
+public class RepositoryBase
+ implements Repository
+{
+
+ public final ConcurrentMap<Monitor.Key, Monitor> monitors;
+
+ public RepositoryBase()
+ {
+ super();
+ this.monitors = new ConcurrentHashMap<Monitor.Key, Monitor>( 50 );
+ }
+
+ public Monitor getMonitor( String name )
+ {
+ return getMonitor( name, null, null );
+ }
+
+ public Monitor getMonitor( String name, String category )
+ {
+ return getMonitor( name, category, null );
+ }
+
+ public Set<String> getCategories()
+ {
+ Set<String> categories = new HashSet<String>();
+ for ( Key key : monitors.keySet() )
+ {
+ categories.add( key.getCategory() );
+ }
+ return categories;
+ }
+
+ public Set<String> getSubSystems()
+ {
+ Set<String> subsystems = new HashSet<String>();
+ for ( Key key : monitors.keySet() )
+ {
+ subsystems.add( key.getSubsystem() );
+ }
+ return subsystems;
+ }
+
+ public Monitor getMonitor( String name, String category, String subsystem )
+ {
+ Monitor.Key key = new Monitor.Key( name, null, null );
+ Monitor monitor = monitors.get( key );
+ if ( monitor == null )
+ {
+ monitor = newMonitorInstance( key );
+ Monitor previous = monitors.putIfAbsent( key, monitor );
+ if ( previous != null )
+ {
+ monitor = previous;
+ }
+ }
+ return monitor;
+ }
+
+ protected Monitor newMonitorInstance( Monitor.Key key )
+ {
+ Monitor monitor;
+ monitor = new SimpleMonitor( key );
+ monitor.setValue( new SimpleValue(), Monitor.PERFORMANCES );
+ monitor.setValue( new ConcurrencyGauge(), Monitor.CONCURRENCY );
+ return monitor;
+ }
+
+ public Collection<Monitor> getMonitors()
+ {
+ return Collections.unmodifiableCollection( monitors.values() );
+ }
+
+ public Collection<Monitor> getMonitorsFromCategory( String category )
+ {
+ Collection<Monitor> filtered = new LinkedList<Monitor>();
+ for ( Monitor monitor : monitors.values() )
+ {
+ if ( category.equals( monitor.getKey().getCategory() ) )
+ {
+ filtered.add( monitor );
+ }
+ }
+ return filtered;
+ }
+
+ public Collection<Monitor> getMonitorsFromSubSystem( String subsystem )
+ {
+ Collection<Monitor> filtered = new LinkedList<Monitor>();
+ for ( Monitor monitor : monitors.values() )
+ {
+ if ( subsystem.equals( monitor.getKey().getSubsystem() ) )
+ {
+ filtered.add( monitor );
+ }
+ }
+ return filtered;
+ }
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/RepositoryBase.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java Wed Jan 23 13:25:36 2008
@@ -1,85 +1,85 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.commons.monitoring.impl;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.commons.monitoring.Counter;
-import org.apache.commons.monitoring.Gauge;
-import org.apache.commons.monitoring.Monitor;
-import org.apache.commons.monitoring.StatValue;
-
-/**
- * Simple implementation of the {@link Monitor} interface.
- *
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public class SimpleMonitor
- implements Monitor
-{
- private final ConcurrentMap<String, StatValue> values;
-
- private final Key key;
-
- public SimpleMonitor( String name, String category, String subsystem )
- {
- this( new Key( name, category, subsystem ) );
- }
-
- public SimpleMonitor( Key key )
- {
- super();
- this.key = key;
- this.values = new ConcurrentHashMap<String, StatValue>();
- }
-
- public Counter getCounter( String role )
- {
- return (Counter) getValue( role );
- }
-
- public Gauge getGauge( String role )
- {
- return (Gauge) getValue( role );
- }
-
- public Key getKey()
- {
- return key;
- }
-
- public StatValue getValue( String role )
- {
- StatValue value = values.get( role );
- if ( value != null )
- {
- return value;
- }
- // If no value has been registered for this role, create a default one
- value = new SimpleValue();
- StatValue previous = values.putIfAbsent( role, value );
- return previous != null ? previous : value;
- }
-
- public boolean setValue( StatValue value, String role )
- {
- return values.putIfAbsent( role, value ) != null;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.monitoring.impl;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.commons.monitoring.Counter;
+import org.apache.commons.monitoring.Gauge;
+import org.apache.commons.monitoring.Monitor;
+import org.apache.commons.monitoring.StatValue;
+
+/**
+ * Simple implementation of the {@link Monitor} interface.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class SimpleMonitor
+ implements Monitor
+{
+ private final ConcurrentMap<String, StatValue> values;
+
+ private final Key key;
+
+ public SimpleMonitor( String name, String category, String subsystem )
+ {
+ this( new Key( name, category, subsystem ) );
+ }
+
+ public SimpleMonitor( Key key )
+ {
+ super();
+ this.key = key;
+ this.values = new ConcurrentHashMap<String, StatValue>();
+ }
+
+ public Counter getCounter( String role )
+ {
+ return (Counter) getValue( role );
+ }
+
+ public Gauge getGauge( String role )
+ {
+ return (Gauge) getValue( role );
+ }
+
+ public Key getKey()
+ {
+ return key;
+ }
+
+ public StatValue getValue( String role )
+ {
+ StatValue value = values.get( role );
+ if ( value != null )
+ {
+ return value;
+ }
+ // If no value has been registered for this role, create a default one
+ value = new SimpleValue();
+ StatValue previous = values.putIfAbsent( role, value );
+ return previous != null ? previous : value;
+ }
+
+ public boolean setValue( StatValue value, String role )
+ {
+ return values.putIfAbsent( role, value ) != null;
+ }
+
+}
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleMonitor.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/SimpleValue.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/jdbc/TODO.txt
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/jdbc/TODO.txt?rev=614679&r1=614678&r2=614679&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/jdbc/TODO.txt (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/jdbc/TODO.txt Wed Jan 23 13:25:36 2008
@@ -1,7 +1,7 @@
-Create JDBC monitoring helpers :
-
- - a custom jdbc Driver
- - a DataSource wrapper
- - Statement wrappers
-
-
+Create JDBC monitoring helpers :
+
+ - a custom jdbc Driver
+ - a DataSource wrapper
+ - Statement wrappers
+
+