You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by gu...@apache.org on 2017/09/08 00:08:50 UTC

kafka git commit: KAFKA-5820: Remove unneeded synchronized keyword in StreamThread

Repository: kafka
Updated Branches:
  refs/heads/trunk 674407908 -> a1ec6527d


KAFKA-5820: Remove unneeded synchronized keyword in StreamThread

I removed synchronized keyword from 3 methods.

I ran the change thru streams module where test suite passed.

Author: tedyu <yu...@gmail.com>

Reviewers: Viktor Somogyi <vi...@gmail.com>, Guozhang Wang <wa...@gmail.com>

Closes #3777 from tedyu/trunk


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

Branch: refs/heads/trunk
Commit: a1ec6527db808679330a54e802c4ae1630e6b50d
Parents: 6744079
Author: Ted Yu <yu...@gmail.com>
Authored: Thu Sep 7 17:08:45 2017 -0700
Committer: Guozhang Wang <wa...@gmail.com>
Committed: Thu Sep 7 17:08:45 2017 -0700

----------------------------------------------------------------------
 .../kafka/streams/processor/internals/StreamThread.java      | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a1ec6527/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
index 6a45ef7..eea41aa 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamThread.java
@@ -166,7 +166,7 @@ public class StreamThread extends Thread implements ThreadDataProvider {
      * @return The state this instance is in
      */
     public State state() {
-        // we do not need to use the stat lock since the variable is volatile
+        // we do not need to use the state lock since the variable is volatile
         return state;
     }
 
@@ -212,12 +212,12 @@ public class StreamThread extends Thread implements ThreadDataProvider {
         return true;
     }
 
-    public synchronized boolean isRunningAndNotRebalancing() {
+    public boolean isRunningAndNotRebalancing() {
         // we do not need to grab stateLock since it is a single read
         return state == State.RUNNING;
     }
 
-    public synchronized boolean isRunning() {
+    public boolean isRunning() {
         synchronized (stateLock) {
             return state == State.RUNNING || state == State.PARTITIONS_REVOKED || state == State.PARTITIONS_ASSIGNED;
         }
@@ -1030,7 +1030,7 @@ public class StreamThread extends Thread implements ThreadDataProvider {
      * Note that there is nothing to prevent this function from being called multiple times
      * (e.g., in testing), hence the state is set only the first time
      */
-    public synchronized void shutdown() {
+    public void shutdown() {
         log.info("{} Informed to shut down", logPrefix);
         setState(State.PENDING_SHUTDOWN);
     }