kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: MINOR: improve JavaDocs for KafkaStreams, KafkaProducer, KafkaConsumer
Date Mon, 18 Dec 2017 19:10:20 GMT
Repository: kafka
Updated Branches:
  refs/heads/1.0 8ba874cb8 -> a64a69327


MINOR: improve JavaDocs for KafkaStreams, KafkaProducer, KafkaConsumer

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

Reviewers: Apurva Mehta <apurva@confluent.io>, Guozhang Wang <wangguoz@gmail.com>

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

(cherry picked from commit e86f70ed20b2d2415f3f01497fd85a7f6c2ac2e8)
Signed-off-by: Guozhang Wang <wangguoz@gmail.com>


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

Branch: refs/heads/1.0
Commit: a64a69327243f6510501d5b1ae10fe9b2d9fab64
Parents: 8ba874c
Author: Matthias J. Sax <matthias@confluent.io>
Authored: Mon Dec 18 11:10:03 2017 -0800
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Mon Dec 18 11:10:16 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/a64a6932/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 9547aee..24f65c1 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/a64a6932/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 3185786..4ff819d 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
@@ -259,6 +259,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
      *
      */
@@ -271,6 +273,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.
@@ -285,6 +289,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) {
@@ -294,6 +300,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/a64a6932/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 6e48f19..c527aea 100644
--- a/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
+++ b/streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
@@ -496,6 +496,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}
@@ -508,6 +511,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
@@ -520,6 +526,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


Mime
View raw message