boundary/ordasity — pull request #10 by jdanbrown (2012-08-09 19:02:37+00:00)
Title: Allow measuring load with a gauge instead of a meter

I've spec'ed a relatively simple extension to allow smart listeners to measure their load using an arbitrary `Gauge[Double]` instead of a `Meter`. Meter-based load then becomes a special case where `gauge.value = meter.oneMinuteRate`.

Additions to the API:
* `ClusterConfig#useSmartGaugeBalancing`
* `SmartGaugedListener`
* `GaugedBalancingPolicy` (superclass of `MeteredBalancingPolicy`, which is now almost trivial)

A smart gauged listener looks like this:

```scala
abstract class SmartGaugedListener extends Listener {
def startWork(workUnit: String)
def workload(workUnit: String): Double
}
```

Note that the user doesn't actually expose a `Gauge[Double]` anywhere—they instead provide `def workload(workUnit: String): Double` which `Cluster` uses to make gauges for `GaugedBalancingPolicy`. Alternatively, the user could expose something like a `Map[String, Gauge[Double]]`, but it seems unnecessarily complicated—would it offer any advantage that I'm not thinking of?

Everything is backward compatible except for `MeteredBalancingPolicy#meters: AtomicMap.atomicNBHM[String, Meter]`, which is now `MeteredBalancingPolicy#gauges: AtomicMap.atomicNBHM[String, Gauge[Double]]`—is that an important compatibility to maintain?

Note that GaugedBalancingPolicy.scala is mostly the same as the previous version of MeteredBalancingPolicy.scala, but the github diff doesn't indicate that. Do a manual diff to see.

Let me know what you think.