Skip to content
This repository
Browse code

Merge branch 'release/2.0.0-BETA3'

  • Loading branch information...
commit eb1c1451012b38e428a623941df11c0ea9a6e685 2 parents a061fa5 + 6dc0396
Coda Hale authored December 23, 2010
2  README.md
Source Rendered
@@ -17,7 +17,7 @@ How To Use
17 17
 **First**, specify Metrics as a dependency:
18 18
 
19 19
     val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
20  
-    val metrics = "com.yammer" %% "metrics" % "2.0.0-BETA2" withSources()
  20
+    val metrics = "com.yammer" %% "metrics" % "2.0.0-BETA3" withSources()
21 21
 
22 22
 (Or whatever it takes for you to get Maven or Ivy happy.)
23 23
 
2  project/build.properties
@@ -3,7 +3,7 @@
3 3
 project.organization=com.yammer
4 4
 project.name=metrics
5 5
 sbt.version=0.7.5.RC0
6  
-project.version=2.0.0-BETA2
  6
+project.version=2.0.0-BETA3
7 7
 def.scala.version=2.7.7
8 8
 build.scala.versions=2.8.1
9 9
 project.initialize=false
8  project/build/Metrics.scala
@@ -2,6 +2,7 @@ import sbt._
2 2
 
3 3
 class Metrics(info: ProjectInfo) extends DefaultProject(info)
4 4
                                          with posterous.Publish
  5
+                                         with maven.MavenDependencies
5 6
                                          with IdeaProject {
6 7
   /**
7 8
    * Publish the source as well as the class files.
@@ -14,12 +15,17 @@ class Metrics(info: ProjectInfo) extends DefaultProject(info)
14 15
    * Publish via Ivy.
15 16
    */
16 17
 
17  
-  lazy val publishTo = Resolver.sftp("Personal Repo",
  18
+  lazy val publishTo = Resolver.sftp("repo.codahale.com",
18 19
                                      "codahale.com",
19 20
                                      "/home/codahale/repo.codahale.com/") as ("codahale")
20 21
   override def managedStyle = ManagedStyle.Maven
21 22
 
22 23
   /**
  24
+   * Repositories
  25
+   */
  26
+  val dropWizard = "Coda's Repo" at "http://repo.codahale.com"
  27
+
  28
+  /**
23 29
    * Dependencies
24 30
    */
25 31
   val jackson = "org.codehaus.jackson" % "jackson-core-asl" % "1.6.3" withSources()
5  project/plugins/Plugins.scala
@@ -3,5 +3,8 @@ class Plugins(info: sbt.ProjectInfo) extends sbt.PluginDefinition(info) {
3 3
   val posterous = "net.databinder" % "posterous-sbt" % "0.1.4"
4 4
 
5 5
   val sbtIdeaRepo = "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
6  
-  val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1.0"
  6
+  val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.2.0"
  7
+
  8
+  val codaRepo = "Coda Hale's Repository" at "http://repo.codahale.com/"
  9
+  val mavenSBT = "com.codahale" % "maven-sbt" % "0.0.3"
7 10
 }
14  src/main/java/com/yammer/metrics/core/ConsoleReporter.java
@@ -97,20 +97,17 @@ public void run() {
97 97
 		}
98 98
 	}
99 99
 
100  
-	private void printGauge(GaugeMetric metric) {
101  
-		final GaugeMetric valueMetric = metric;
  100
+	private void printGauge(GaugeMetric gauge) {
102 101
 		out.print("    value = ");
103  
-		out.println(valueMetric.value());
  102
+		out.println(gauge.value());
104 103
 	}
105 104
 
106  
-	private void printCounter(CounterMetric metric) {
107  
-		final CounterMetric counter = metric;
  105
+	private void printCounter(CounterMetric counter) {
108 106
 		out.print("    count = ");
109 107
 		out.println(counter.count());
110 108
 	}
111 109
 
112  
-	private void printMeter(MeterMetric metric) {
113  
-		final MeterMetric meter = metric;
  110
+	private void printMeter(MeterMetric meter) {
114 111
 		final String unit = abbrev(meter.getScaleUnit());
115 112
 		out.printf("             count = %d\n", meter.count());
116 113
 		out.printf("         mean rate = %2.2f %s/%s\n", meter.meanRate(), meter.getEventType(), unit);
@@ -119,8 +116,7 @@ private void printMeter(MeterMetric metric) {
119 116
 		out.printf("    15-minute rate = %2.2f %s/%s\n", meter.fifteenMinuteRate(), meter.getEventType(), unit);
120 117
 	}
121 118
 
122  
-	private void printTimer(TimerMetric metric) {
123  
-		final TimerMetric timer = metric;
  119
+	private void printTimer(TimerMetric timer) {
124 120
 		final String rateUnit = abbrev(timer.getRateUnit());
125 121
 		final String durationUnit = abbrev(timer.getDurationUnit());
126 122
 
2  src/main/java/com/yammer/metrics/core/JmxReporter.java
@@ -279,7 +279,7 @@ public JmxReporter(Map<MetricName, Metric> metrics) {
279 279
 	}
280 280
 
281 281
 	public void start() {
282  
-		this.future = TICK_THREAD.scheduleAtFixedRate(this, 0, 1, TimeUnit.SECONDS);
  282
+		this.future = TICK_THREAD.scheduleAtFixedRate(this, 0, 1, TimeUnit.MINUTES);
283 283
 	}
284 284
 
285 285
 	public void stop() {
13  src/main/java/com/yammer/metrics/core/MeterMetric.java
... ...
@@ -1,13 +1,10 @@
1 1
 package com.yammer.metrics.core;
2 2
 
3  
-import java.lang.ref.SoftReference;
4 3
 import java.util.concurrent.Executors;
5 4
 import java.util.concurrent.ScheduledExecutorService;
6 5
 import java.util.concurrent.TimeUnit;
7 6
 import java.util.concurrent.atomic.AtomicLong;
8 7
 
9  
-// TODO: 12/10/10 <coda> -- this could use a unit and scale unit (e.g., "requests", TimeUnit.SECONDS)
10  
-
11 8
 /**
12 9
  * A meter metric which measures mean throughput and one-, five-, and
13 10
  * fifteen-minute exponentially-weighted moving average throughputs.
@@ -44,19 +41,15 @@ public static MeterMetric newMeter(String eventType, TimeUnit scaleUnit) {
44 41
 	 * @param intervalUnit the unit of {@code interval}
45 42
 	 * @param eventType the plural name of the event the meter is measuring
46 43
 	 *                  (e.g., {@code "requests"})
47  
-	 *@param scaleUnit the scale unit of the new meter  @return a new {@link MeterMetric}
  44
+	 * @param scaleUnit the scale unit of the new meter  @return a new {@link MeterMetric}
  45
+	 * @return a new {@link MeterMetric}
48 46
 	 */
49 47
 	public static MeterMetric newMeter(long interval, TimeUnit intervalUnit, String eventType, TimeUnit scaleUnit) {
50 48
 		final MeterMetric meter = new MeterMetric(eventType, scaleUnit);
51  
-		final SoftReference<MeterMetric> reference = new SoftReference<MeterMetric>(meter);
52 49
 		final Runnable job = new Runnable() {
53 50
 			@Override
54 51
 			public void run() {
55  
-				// This will throw a NullPointerException if the meter has been
56  
-				// collected. This is actually the desired behavior, as the
57  
-				// NPE will cause the ScheduledExecutorService to deschedule
58  
-				// this job.
59  
-				reference.get().tick();
  52
+				meter.tick();
60 53
 			}
61 54
 		};
62 55
 		TICK_THREAD.scheduleAtFixedRate(job, interval, interval, intervalUnit);
2  src/main/java/com/yammer/metrics/core/NamedThreadFactory.java
@@ -16,7 +16,7 @@
16 16
 	public NamedThreadFactory(String name) {
17 17
 		final SecurityManager s = System.getSecurityManager();
18 18
 		this.group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
19  
-		this.namePrefix = name + "-" + "-thread-";
  19
+		this.namePrefix = name + "-thread-";
20 20
 	}
21 21
 
22 22
 	@Override

0 notes on commit eb1c145

Please sign in to comment.
Something went wrong with that request. Please try again.