From 6b9f7065a24324e094b7a067ecdb27861d774287 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Wed, 26 Dec 2012 13:48:29 +0900 Subject: [PATCH] Simpler and more comprehensive method naming in monitor --- .../java/io/netty/monitor/CounterMonitor.java | 16 +++---- .../java/io/netty/monitor/MonitorName.java | 44 +++++++++---------- .../io/netty/monitor/spi/MonitorProvider.java | 4 +- .../AnotherSampleMonitorRegistryFactory.java | 24 ++++++++-- .../support/SampleMonitorRegistryFactory.java | 24 ++++++++-- .../util/HashedWheelTimerMonitorTest.java | 24 ++++++++-- .../java/io/netty/monitor/yammer/Utils.java | 4 +- .../monitor/yammer/YammerCounterMonitor.java | 8 ++-- .../monitor/yammer/YammerMonitorRegistry.java | 2 +- 9 files changed, 99 insertions(+), 51 deletions(-) diff --git a/common/src/main/java/io/netty/monitor/CounterMonitor.java b/common/src/main/java/io/netty/monitor/CounterMonitor.java index 2928f60983..b7137d62f9 100644 --- a/common/src/main/java/io/netty/monitor/CounterMonitor.java +++ b/common/src/main/java/io/netty/monitor/CounterMonitor.java @@ -37,43 +37,43 @@ public interface CounterMonitor { } @Override - public void inc(long delta) { + public void increment(long delta) { } @Override - public void inc() { + public void increment() { } @Override - public void decr(long delta) { + public void decrement(long delta) { } @Override - public void decr() { + public void decrement() { } }; /** * Increment this counter by 1. */ - void inc(); + void increment(); /** * Increment this counter by the supplied {@code delta}. * @param delta The delta to apply */ - void inc(long delta); + void increment(long delta); /** * Decrement this counter by 1. */ - void decr(); + void decrement(); /** * Decrement this counter by the supplied {@code delta}. * @param delta The delta to apply */ - void decr(long delta); + void decrement(long delta); /** * Reset this counter to its initial state. diff --git a/common/src/main/java/io/netty/monitor/MonitorName.java b/common/src/main/java/io/netty/monitor/MonitorName.java index 02d756d42d..5f37285c3e 100644 --- a/common/src/main/java/io/netty/monitor/MonitorName.java +++ b/common/src/main/java/io/netty/monitor/MonitorName.java @@ -46,13 +46,13 @@ public final class MonitorName { /** * Create a new {@code MonitorName}, using the supplied - * {@code monitoredClass}'s {@code package name} as its {@link #getGroup() + * {@code monitoredClass}'s {@code package name} as its {@link #group() * group}, the {@code monitoredClass}'s {@code simple name} as its - * {@link #getType()} and the supplied {@code name} as its - * {@link #getName() name}. + * {@link #type()} and the supplied {@code name} as its + * {@link #name() name}. * @param monitoredClass The class to be monitored, i.e. a class that * represents a resource whose statistics we are interested in - * @param name Our new {@code MonitorName}'s {@link #getName() name} + * @param name Our new {@code MonitorName}'s {@link #name() name} * @throws NullPointerException If either {@code monitoredClass} or * {@code name} is {@code null} */ @@ -63,15 +63,15 @@ public final class MonitorName { /** * Create a new {@code MonitorName}, using the supplied - * {@code monitoredClass}'s {@code package name} as its {@link #getGroup() + * {@code monitoredClass}'s {@code package name} as its {@link #group() * group}, the {@code monitoredClass}'s {@code simple name} as its - * {@link #getType()}, the supplied {@code name} as its {@link #getName() - * name} and the supplied {@code instance} as its {@link #getInstance() + * {@link #type()}, the supplied {@code name} as its {@link #name() + * name} and the supplied {@code instance} as its {@link #instance() * instance}. * @param monitoredClass The class to be monitored, i.e. a class that * represents a resource whose statistics we are interested in - * @param name Our new {@code MonitorName}'s {@link #getName() name} - * @param instance Our new {@code MonitorName}'s {@link #getInstance() + * @param name Our new {@code MonitorName}'s {@link #name() name} + * @param instance Our new {@code MonitorName}'s {@link #instance() * instance} * @throws NullPointerException If either {@code monitoredClass} or * {@code name} is {@code null} @@ -83,9 +83,9 @@ public final class MonitorName { /** * Create a new {@code MonitorName} out of the supplied {@code group}, * {@code type} and {@code name}. - * @param group Our new {@code MonitorName}'s {@link #getGroup() group} - * @param type Our new {@code MonitorName}'s {@link #getType() type} - * @param name Our new {@code MonitorName}'s {@link #getName() name} + * @param group Our new {@code MonitorName}'s {@link #group() group} + * @param type Our new {@code MonitorName}'s {@link #type() type} + * @param name Our new {@code MonitorName}'s {@link #name() name} * @throws NullPointerException If one of {@code group}, {@code type} and * {@code name} is {@code null} */ @@ -96,10 +96,10 @@ public final class MonitorName { /** * Create a new {@code MonitorName} out of the supplied {@code group}, * {@code type}, {@code name} and {@code instance} - * @param group Our new {@code MonitorName}'s {@link #getGroup() group} - * @param type Our new {@code MonitorName}'s {@link #getType() type} - * @param name Our new {@code MonitorName}'s {@link #getName() name} - * @param instance Our new {@code MonitorName}'s {@link #getInstance() + * @param group Our new {@code MonitorName}'s {@link #group() group} + * @param type Our new {@code MonitorName}'s {@link #type() type} + * @param name Our new {@code MonitorName}'s {@link #name() name} + * @param instance Our new {@code MonitorName}'s {@link #instance() * instance} * @throws NullPointerException If one of {@code group}, {@code type} and * {@code name} is {@code null} @@ -122,13 +122,13 @@ public final class MonitorName { /** * Returns a copy of this {@code MonitorName} with its - * {@link #getInstance() instance} field replaced by the supplied + * {@link #instance() instance} field replaced by the supplied * {@code instance}. Serves to support a poor man's templating mechanism for * {@code MonitorNames}. * @param instance The instance to be used in the {@code MonitorName} * returned by this method * @return A copy of this {@code MonitorName} with its - * {@link #getInstance() instance} field replaced by the supplied + * {@link #instance() instance} field replaced by the supplied * {@code instance} * @throws NullPointerException If {@code instance} is {@code null} */ @@ -148,7 +148,7 @@ public final class MonitorName { * @return The group, an arbitrary name for a set of logically related * {@code Monitors} */ - public String getGroup() { + public String group() { return group; } @@ -159,7 +159,7 @@ public final class MonitorName { * @return The type, an arbitrary string identifying a {@code Monitor}'s * {@code type}, commonly denoting the resource to be monitored */ - public String getType() { + public String type() { return type; } @@ -169,7 +169,7 @@ public final class MonitorName { * @return The name, an arbitrary string identifying what is actually * monitored */ - public String getName() { + public String name() { return name; } @@ -182,7 +182,7 @@ public final class MonitorName { * exact resource instance to be monitored, in case we aren't * dealing with a singleton resource */ - public String getInstance() { + public String instance() { return instance; } diff --git a/common/src/main/java/io/netty/monitor/spi/MonitorProvider.java b/common/src/main/java/io/netty/monitor/spi/MonitorProvider.java index 057b3902a7..43de017fc2 100644 --- a/common/src/main/java/io/netty/monitor/spi/MonitorProvider.java +++ b/common/src/main/java/io/netty/monitor/spi/MonitorProvider.java @@ -30,7 +30,7 @@ public final class MonitorProvider implements Serializable, Comparable