Repository: kafka
Updated Branches:
  refs/heads/trunk e5daa40e3 -> e86f70ed2


MINOR: improve JavaDocs for KafkaStreams, KafkaProducer, KafkaConsumer

Author: Matthias J. Sax <matth...@confluent.io>

Reviewers: Apurva Mehta <apu...@confluent.io>, Guozhang Wang 
<wangg...@gmail.com>

Closes #4335 from mjsax/minor-improve-KafkaStreams-javadocs


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

Branch: refs/heads/trunk
Commit: e86f70ed20b2d2415f3f01497fd85a7f6c2ac2e8
Parents: e5daa40
Author: Matthias J. Sax <matth...@confluent.io>
Authored: Mon Dec 18 11:10:03 2017 -0800
Committer: Guozhang Wang <wangg...@gmail.com>
Committed: Mon Dec 18 11:10:03 2017 -0800

----------------------------------------------------------------------
 .../kafka/clients/consumer/KafkaConsumer.java       | 16 ++++++++++++----
 .../kafka/clients/producer/KafkaProducer.java       |  8 ++++++++
 .../java/org/apache/kafka/streams/KafkaStreams.java |  9 +++++++++
 3 files changed, 29 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/e86f70ed/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
----------------------------------------------------------------------
diff --git 
a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java 
b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
index e9499cb..e5740c9 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
@@ -579,7 +579,9 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
      * either strings or objects of the appropriate type (for example a 
numeric configuration would accept either the
      * string "42" or the integer 42).
      * <p>
-     * Valid configuration strings are documented at {@link ConsumerConfig}
+     * Valid configuration strings are documented at {@link ConsumerConfig}.
+     * <p>
+     * Note: after creating a {@code KafkaConsumer} you must always {@link 
#close()} it to avoid resource leaks.
      *
      * @param configs The consumer configs
      */
@@ -590,7 +592,9 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
     /**
      * A consumer is instantiated by providing a set of key-value pairs as 
configuration, and a key and a value {@link Deserializer}.
      * <p>
-     * Valid configuration strings are documented at {@link ConsumerConfig}
+     * Valid configuration strings are documented at {@link ConsumerConfig}.
+     * <p>
+     * Note: after creating a {@code KafkaConsumer} you must always {@link 
#close()} it to avoid resource leaks.
      *
      * @param configs The consumer configs
      * @param keyDeserializer The deserializer for key that implements {@link 
Deserializer}. The configure() method
@@ -609,7 +613,9 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
     /**
      * A consumer is instantiated by providing a {@link java.util.Properties} 
object as configuration.
      * <p>
-     * Valid configuration strings are documented at {@link ConsumerConfig}
+     * Valid configuration strings are documented at {@link ConsumerConfig}.
+     * <p>
+     * Note: after creating a {@code KafkaConsumer} you must always {@link 
#close()} it to avoid resource leaks.
      *
      * @param properties The consumer configuration properties
      */
@@ -621,7 +627,9 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
      * A consumer is instantiated by providing a {@link java.util.Properties} 
object as configuration, and a
      * key and a value {@link Deserializer}.
      * <p>
-     * Valid configuration strings are documented at {@link ConsumerConfig}
+     * Valid configuration strings are documented at {@link ConsumerConfig}.
+     * <p>
+     * Note: after creating a {@code KafkaConsumer} you must always {@link 
#close()} it to avoid resource leaks.
      *
      * @param properties The consumer configuration properties
      * @param keyDeserializer The deserializer for key that implements {@link 
Deserializer}. The configure() method

http://git-wip-us.apache.org/repos/asf/kafka/blob/e86f70ed/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 1fec744..14f405b 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
@@ -262,6 +262,8 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
      * are documented <a 
href="http://kafka.apache.org/documentation.html#producerconfigs";>here</a>. 
Values can be
      * either strings or Objects of the appropriate type (for example a 
numeric configuration would accept either the
      * string "42" or the integer 42).
+     * <p>
+     * Note: after creating a {@code KafkaProducer} you must always {@link 
#close()} it to avoid resource leaks.
      * @param configs   The producer configs
      *
      */
@@ -274,6 +276,8 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
      * Valid configuration strings are documented <a 
href="http://kafka.apache.org/documentation.html#producerconfigs";>here</a>.
      * Values can be either strings or Objects of the appropriate type (for 
example a numeric configuration would accept
      * either the string "42" or the integer 42).
+     * <p>
+     * Note: after creating a {@code KafkaProducer} you must always {@link 
#close()} it to avoid resource leaks.
      * @param configs   The producer configs
      * @param keySerializer  The serializer for key that implements {@link 
Serializer}. The configure() method won't be
      *                       called in the producer when the serializer is 
passed in directly.
@@ -288,6 +292,8 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
     /**
      * A producer is instantiated by providing a set of key-value pairs as 
configuration. Valid configuration strings
      * are documented <a 
href="http://kafka.apache.org/documentation.html#producerconfigs";>here</a>.
+     * <p>
+     * Note: after creating a {@code KafkaProducer} you must always {@link 
#close()} it to avoid resource leaks.
      * @param properties   The producer configs
      */
     public KafkaProducer(Properties properties) {
@@ -297,6 +303,8 @@ public class KafkaProducer<K, V> implements Producer<K, V> {
     /**
      * A producer is instantiated by providing a set of key-value pairs as 
configuration, a key and a value {@link Serializer}.
      * Valid configuration strings are documented <a 
href="http://kafka.apache.org/documentation.html#producerconfigs";>here</a>.
+     * <p>
+     * Note: after creating a {@code KafkaProducer} you must always {@link 
#close()} it to avoid resource leaks.
      * @param properties   The producer configs
      * @param keySerializer  The serializer for key that implements {@link 
Serializer}. The configure() method won't be
      *                       called in the producer when the serializer is 
passed in directly.

http://git-wip-us.apache.org/repos/asf/kafka/blob/e86f70ed/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java 
b/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
index 641455b..d10d786 100644
--- a/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
+++ b/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
@@ -544,6 +544,9 @@ public class KafkaStreams {
 
     /**
      * Create a {@code KafkaStreams} instance.
+     * <p>
+     * Note: even if you never call {@link #start()} on a {@code KafkaStreams} 
instance,
+     * you still must {@link #close()} it to avoid resource leaks.
      *
      * @param topology the topology specifying the computational logic
      * @param props   properties for {@link StreamsConfig}
@@ -556,6 +559,9 @@ public class KafkaStreams {
 
     /**
      * Create a {@code KafkaStreams} instance.
+     * <p>
+     * Note: even if you never call {@link #start()} on a {@code KafkaStreams} 
instance,
+     * you still must {@link #close()} it to avoid resource leaks.
      *
      * @param topology the topology specifying the computational logic
      * @param config  the Kafka Streams configuration
@@ -568,6 +574,9 @@ public class KafkaStreams {
 
     /**
      * Create a {@code KafkaStreams} instance.
+     * <p>
+     * Note: even if you never call {@link #start()} on a {@code KafkaStreams} 
instance,
+     * you still must {@link #close()} it to avoid resource leaks.
      *
      * @param topology       the topology specifying the computational logic
      * @param config         the Kafka Streams configuration

Reply via email to