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-4176: Only call printStream.flush for System.out
Date Wed, 05 Oct 2016 15:30:11 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 305fb59b1 -> 3e9f357fb


KAFKA-4176: Only call printStream.flush for System.out

Author: Guozhang Wang <wangguoz@gmail.com>

Reviewers: Bill Bejeck, Damian Guy

Closes #1965 from guozhangwang/K4176-only-flush-for-standardoutput


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

Branch: refs/heads/trunk
Commit: 3e9f357fb56fd2b030a616b0d9d475cfa481e149
Parents: 305fb59
Author: Guozhang Wang <wangguoz@gmail.com>
Authored: Wed Oct 5 08:30:05 2016 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Wed Oct 5 08:30:05 2016 -0700

----------------------------------------------------------------------
 .../kafka/streams/kstream/internals/KeyValuePrinter.java     | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3e9f357f/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValuePrinter.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValuePrinter.java
b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValuePrinter.java
index 30203ca..e143ef2 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValuePrinter.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/internals/KeyValuePrinter.java
@@ -32,7 +32,6 @@ class KeyValuePrinter<K, V> implements ProcessorSupplier<K, V>
{
     private final PrintStream printStream;
     private Serde<?> keySerde;
     private Serde<?> valueSerde;
-    private boolean notStandardOut;
     private String streamName;
 
 
@@ -44,7 +43,6 @@ class KeyValuePrinter<K, V> implements ProcessorSupplier<K, V>
{
             this.printStream = System.out;
         } else {
             this.printStream = printStream;
-            notStandardOut = true;
         }
     }
 
@@ -114,10 +112,10 @@ class KeyValuePrinter<K, V> implements ProcessorSupplier<K,
V> {
 
         @Override
         public void close() {
-            if (notStandardOut) {
-                this.printStream.close();
-            } else {
+            if (this.printStream == System.out) {
                 this.printStream.flush();
+            } else {
+                this.printStream.close();
             }
         }
     }


Mime
View raw message