kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-4919: Document that stores must not be closed when Processors are closed
Date Thu, 23 Mar 2017 16:48:01 GMT
Repository: kafka
Updated Branches:
  refs/heads/0.10.2 eb0dbe850 -> c96635291


KAFKA-4919: Document that stores must not be closed when Processors are closed

Author: Damian Guy <damian.guy@gmail.com>

Reviewers: Michael G. Noll, Eno Thereska, Matthias J. Sax, Elias Levy, Guozhang Wang

Closes #2725 from dguy/minor-processor-java-doc

(cherry picked from commit 2269eed242d9ccd4cc3e9ae3211d01f166f6e234)
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/c9663529
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/c9663529
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/c9663529

Branch: refs/heads/0.10.2
Commit: c96635291e963e4651e2ff5dac1b8449c16d32ba
Parents: eb0dbe8
Author: Damian Guy <damian.guy@gmail.com>
Authored: Thu Mar 23 09:47:45 2017 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Mar 23 09:47:57 2017 -0700

----------------------------------------------------------------------
 docs/streams.html                                               | 5 +++--
 .../streams/examples/wordcount/WordCountProcessorDemo.java      | 4 +---
 .../main/java/org/apache/kafka/streams/processor/Processor.java | 2 ++
 .../java/org/apache/kafka/streams/processor/StateStore.java     | 3 +++
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c9663529/docs/streams.html
----------------------------------------------------------------------
diff --git a/docs/streams.html b/docs/streams.html
index 815e1aa..2b4c441 100644
--- a/docs/streams.html
+++ b/docs/streams.html
@@ -355,8 +355,9 @@ public class MyProcessor implements Processor&lt;String, String&gt;
{
 
     @Override
     public void close() {
-        // close the key-value store
-        this.kvStore.close();
+        // close any resources managed by this processor.
+        // Note: Do not close any StateStores as these are managed
+        // by the library
     }
 };
 </pre>

http://git-wip-us.apache.org/repos/asf/kafka/blob/c9663529/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountProcessorDemo.java
----------------------------------------------------------------------
diff --git a/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountProcessorDemo.java
b/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountProcessorDemo.java
index f9913ca..9d2424a 100644
--- a/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountProcessorDemo.java
+++ b/streams/examples/src/main/java/org/apache/kafka/streams/examples/wordcount/WordCountProcessorDemo.java
@@ -95,9 +95,7 @@ public class WordCountProcessorDemo {
                 }
 
                 @Override
-                public void close() {
-                    this.kvStore.close();
-                }
+                public void close() {}
             };
         }
     }

http://git-wip-us.apache.org/repos/asf/kafka/blob/c9663529/streams/src/main/java/org/apache/kafka/streams/processor/Processor.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/Processor.java b/streams/src/main/java/org/apache/kafka/streams/processor/Processor.java
index beaace3..e0eca8c 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/Processor.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/Processor.java
@@ -55,6 +55,8 @@ public interface Processor<K, V> {
     /**
      * Close this processor and clean up any resources. Be aware that {@link #close()} is
called after an internal cleanup.
      * Thus, it is not possible to write anything to Kafka as underlying clients are already
closed.
+     * <p>
+     * Note: Do not close any streams managed resources, like {@link StateStore}s here, as
they are managed by the library.
      */
     void close();
 }

http://git-wip-us.apache.org/repos/asf/kafka/blob/c9663529/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
index 9aa0932..f417a34 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
@@ -49,6 +49,9 @@ public interface StateStore {
      * Close the storage engine.
      * Note that this function needs to be idempotent since it may be called
      * several times on the same state store.
+     * <p>
+     * Users only need to implement this function but should NEVER need to call this api
explicitly
+     * as it will be called by the library automatically when necessary
      */
     void close();
 


Mime
View raw message