Repository: kafka
Updated Branches:
  refs/heads/trunk bfb2da3c8 -> a61117840


KAFKA-1723 (delta patch to fix javadoc); make the metrics name in new producer 
more standard; patched by Manikumar Reddy; reviewed by Jun Rao


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a6111784
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a6111784
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a6111784

Branch: refs/heads/trunk
Commit: a611178408cf8497054ff015caba18cfcff70a60
Parents: bfb2da3
Author: Manikumar Reddy <manikumar.re...@gmail.com>
Authored: Wed Jan 14 12:02:50 2015 -0800
Committer: Jun Rao <jun...@gmail.com>
Committed: Wed Jan 14 12:02:50 2015 -0800

----------------------------------------------------------------------
 .../kafka/clients/producer/KafkaProducer.java   | 22 +++++++++---------
 .../org/apache/kafka/common/MetricName.java     | 24 ++++++++++++--------
 2 files changed, 26 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a6111784/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
----------------------------------------------------------------------
diff --git 
a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java 
b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
index c79149a..fc71710 100644
--- a/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/producer/KafkaProducer.java
@@ -265,32 +265,32 @@ public class KafkaProducer<K,V> implements Producer<K,V> {
      * <p>
      * If you want to simulate a simple blocking call you can do the following:
      * 
-     * <pre>
-     *   producer.send(new ProducerRecord<byte[],byte[]>("the-topic", 
"key".getBytes(), "value".getBytes())).get();
-     * </pre>
+     * <pre>{@code
+     * producer.send(new ProducerRecord<byte[],byte[]>("the-topic", 
"key".getBytes(), "value".getBytes())).get();
+     * }</pre>
      * <p>
      * Those desiring fully non-blocking usage can make use of the {@link 
Callback} parameter to provide a callback that
      * will be invoked when the request is complete.
      * 
-     * <pre>
-     *   ProducerRecord<byte[],byte[]> record = new 
ProducerRecord<byte[],byte[]>("the-topic", "key".getBytes(), 
"value".getBytes());
+     * <pre>{@code
+     * ProducerRecord<byte[],byte[]> record = new 
ProducerRecord<byte[],byte[]>("the-topic", "key".getBytes(), 
"value".getBytes());
      *   producer.send(myRecord,
-     *                 new Callback() {
+     *                new Callback() {
      *                     public void onCompletion(RecordMetadata metadata, 
Exception e) {
      *                         if(e != null)
      *                             e.printStackTrace();
      *                         System.out.println("The offset of the record we 
just sent is: " + metadata.offset());
      *                     }
-     *                 });
-     * </pre>
+     *                });
+     * }</pre>
      * 
      * Callbacks for records being sent to the same partition are guaranteed 
to execute in order. That is, in the
      * following example <code>callback1</code> is guaranteed to execute 
before <code>callback2</code>:
      * 
-     * <pre>
-     * producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key, 
value), callback1);
+     * <pre>{@code
+     * producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key1, 
value1), callback1);
      * producer.send(new ProducerRecord<byte[],byte[]>(topic, partition, key2, 
value2), callback2);
-     * </pre>
+     * }</pre>
      * <p>
      * Note that callbacks will generally execute in the I/O thread of the 
producer and so should be reasonably fast or
      * they will delay the sending of messages from other threads. If you want 
to execute blocking or computationally

http://git-wip-us.apache.org/repos/asf/kafka/blob/a6111784/clients/src/main/java/org/apache/kafka/common/MetricName.java
----------------------------------------------------------------------
diff --git a/clients/src/main/java/org/apache/kafka/common/MetricName.java 
b/clients/src/main/java/org/apache/kafka/common/MetricName.java
index 4e810d5..7e977e9 100644
--- a/clients/src/main/java/org/apache/kafka/common/MetricName.java
+++ b/clients/src/main/java/org/apache/kafka/common/MetricName.java
@@ -19,34 +19,40 @@ import org.apache.kafka.common.utils.Utils;
 
 /**
  * The <code>MetricName</code> class encapsulates a metric's name, logical 
group and its related attributes
- * <p/>
+ * <p>
  * This class captures the following parameters
  * <pre>
  *  <b>name</b> The name of the metric
  *  <b>group</b> logical group name of the metrics to which this metric 
belongs.
  *  <b>description</b> A human-readable description to include in the metric. 
This is optional.
  *  <b>tags</b> additional key/value attributes of the metric. This is 
optional.
- *   </pre>
+ * </pre>
  * group, tags parameters can be used to create unique metric names while 
reporting in JMX or any custom reporting.
- *
+ * <p>
  * Ex: standard JMX MBean can be constructed like  
<b>domainName:type=group,key1=val1,key2=val2</b>
- *
+ * <p>
  * Usage looks something like this:
- * <pre>
+ * <pre>{@code
  * // set up metrics:
  * Metrics metrics = new Metrics(); // this is the global repository of 
metrics and sensors
- * Sensor sensor = metrics.sensor(&quot;message-sizes&quot;);
+ * Sensor sensor = metrics.sensor("message-sizes");
+ *
  * Map<String, String> metricTags = new LinkedHashMap<String, String>();
  * metricTags.put("client-id", "producer-1");
  * metricTags.put("topic", "topic");
- * MetricName metricName = new MetricName(&quot;message-size-avg&quot;, 
&quot;producer-metrics&quot;, "average message size", metricTags);
+ *
+ * MetricName metricName = new MetricName("message-size-avg", 
"producer-metrics", "average message size", metricTags);
  * sensor.add(metricName, new Avg());
- * metricName = new MetricName(&quot;message-size-max&quot;, 
&quot;producer-metrics&quot;,metricTags);
+ *
+ * metricName = new MetricName("message-size-max", "producer-metrics", 
metricTags);
  * sensor.add(metricName, new Max());
  *
+ * metricName = new MetricName("message-size-min", "producer-metrics", 
"message minimum size", "client-id", "my-client", "topic", "my-topic");
+ * sensor.add(metricName, new Min());
+ *
  * // as messages are sent we record the sizes
  * sensor.record(messageSize);
- * </pre>
+ * }</pre>
  */
 public final class MetricName {
 

Reply via email to