camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lburgazz...@apache.org
Subject [2/3] camel git commit: CAMEL-11901: cluster-service : ClusterVie's getMaster() should be renamed to getLeader() for naming consistency
Date Thu, 12 Oct 2017 16:54:39 GMT
CAMEL-11901: cluster-service : ClusterVie's getMaster() should be renamed to getLeader() for
naming consistency


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

Branch: refs/heads/master
Commit: 325d476e857327d64ca5d9501bf6627ba8d84bec
Parents: 6682a35
Author: lburgazzoli <lburgazzoli@gmail.com>
Authored: Thu Oct 12 18:35:05 2017 +0200
Committer: lburgazzoli <lburgazzoli@gmail.com>
Committed: Thu Oct 12 18:54:08 2017 +0200

----------------------------------------------------------------------
 .../camel/component/file/ha/FileLockClusterView.java  |  2 +-
 .../java/org/apache/camel/ha/CamelClusterView.java    | 14 ++++++++++++--
 .../camel/impl/ha/AbstractCamelClusterView.java       |  2 +-
 .../camel/impl/ha/ClusterServiceSelectorTest.java     |  2 +-
 .../apache/camel/impl/ha/ClusterServiceViewTest.java  |  4 ++--
 .../camel/component/atomix/ha/AtomixClusterView.java  |  2 +-
 .../camel/component/consul/ha/ConsulClusterView.java  |  4 ++--
 .../component/jgroups/ha/JGroupsLockClusterView.java  |  2 +-
 .../kubernetes/ha/KubernetesClusterView.java          |  2 +-
 .../component/zookeeper/ha/ZooKeeperClusterView.java  |  6 +++---
 10 files changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/camel-core/src/main/java/org/apache/camel/component/file/ha/FileLockClusterView.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/ha/FileLockClusterView.java
b/camel-core/src/main/java/org/apache/camel/component/file/ha/FileLockClusterView.java
index 6fcf703..a6f9e50 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/ha/FileLockClusterView.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/ha/FileLockClusterView.java
@@ -55,7 +55,7 @@ public class FileLockClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         return Optional.of(this.localMember);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/camel-core/src/main/java/org/apache/camel/ha/CamelClusterView.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/ha/CamelClusterView.java b/camel-core/src/main/java/org/apache/camel/ha/CamelClusterView.java
index 5398d44..9ba2a31 100644
--- a/camel-core/src/main/java/org/apache/camel/ha/CamelClusterView.java
+++ b/camel-core/src/main/java/org/apache/camel/ha/CamelClusterView.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.ha;
 
-import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
 
@@ -41,8 +40,19 @@ public interface CamelClusterView extends Service, CamelContextAware {
      * Provides the master member if elected.
      *
      * @return the master member.
+     * @deprecated use {@link #getLeader()}
      */
-    Optional<CamelClusterMember> getMaster();
+    @Deprecated
+    default Optional<CamelClusterMember> getMaster() {
+        return getLeader();
+    }
+
+    /**
+     * Provides the leader member if elected.
+     *
+     * @return the leader member.
+     */
+    Optional<CamelClusterMember> getLeader();
 
     /**
      * Provides the local member.

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/camel-core/src/main/java/org/apache/camel/impl/ha/AbstractCamelClusterView.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ha/AbstractCamelClusterView.java
b/camel-core/src/main/java/org/apache/camel/impl/ha/AbstractCamelClusterView.java
index a6d3e25..fd3257a 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ha/AbstractCamelClusterView.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ha/AbstractCamelClusterView.java
@@ -80,7 +80,7 @@ public abstract class AbstractCamelClusterView extends ServiceSupport implements
                     // the consumer can catch up.
 
                     if (CamelClusterEventListener.Leadership.class.isInstance(listener))
{
-                        CamelClusterEventListener.Leadership.class.cast(listener).leadershipChanged(this,
getMaster());
+                        CamelClusterEventListener.Leadership.class.cast(listener).leadershipChanged(this,
getLeader());
                     }
 
                     if (CamelClusterEventListener.Membership.class.isInstance(listener))
{

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceSelectorTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceSelectorTest.java
b/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceSelectorTest.java
index ba4549f..10d246a 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceSelectorTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceSelectorTest.java
@@ -354,7 +354,7 @@ public class ClusterServiceSelectorTest {
         }
 
         @Override
-        public Optional<CamelClusterMember> getMaster() {
+        public Optional<CamelClusterMember> getLeader() {
             return Optional.empty();
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceViewTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceViewTest.java
b/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceViewTest.java
index 2a6cddd..243cc46 100644
--- a/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceViewTest.java
+++ b/camel-core/src/test/java/org/apache/camel/impl/ha/ClusterServiceViewTest.java
@@ -190,7 +190,7 @@ public class ClusterServiceViewTest {
         }
 
         @Override
-        public Optional<CamelClusterMember> getMaster() {
+        public Optional<CamelClusterMember> getLeader() {
             return leader
                 ? Optional.of(getLocalMember())
                 : Optional.empty();
@@ -237,7 +237,7 @@ public class ClusterServiceViewTest {
             this.leader = leader;
 
             if (isRunAllowed()) {
-                fireLeadershipChangedEvent(getMaster());
+                fireLeadershipChangedEvent(getLeader());
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
index 91367e9..f0128ec 100644
--- a/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
+++ b/components/camel-atomix/src/main/java/org/apache/camel/component/atomix/ha/AtomixClusterView.java
@@ -51,7 +51,7 @@ final class AtomixClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         if (group == null) {
             return Optional.empty();
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/components/camel-consul/src/main/java/org/apache/camel/component/consul/ha/ConsulClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ha/ConsulClusterView.java
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ha/ConsulClusterView.java
index b0d9fea..8c16302 100644
--- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/ha/ConsulClusterView.java
+++ b/components/camel-consul/src/main/java/org/apache/camel/component/consul/ha/ConsulClusterView.java
@@ -63,7 +63,7 @@ final class ConsulClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         if (keyValueClient == null) {
             return Optional.empty();
         }
@@ -157,7 +157,7 @@ final class ConsulClusterView extends AbstractCamelClusterView {
             }
             if (!master && this.master.compareAndSet(true, false)) {
                 LOGGER.debug("Leadership lost for session id {}", sessionId.get());
-                fireLeadershipChangedEvent(getMaster());
+                fireLeadershipChangedEvent(getLeader());
                 return;
             }
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/ha/JGroupsLockClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/ha/JGroupsLockClusterView.java
b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/ha/JGroupsLockClusterView.java
index 117f2df..60616fa 100644
--- a/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/ha/JGroupsLockClusterView.java
+++ b/components/camel-jgroups/src/main/java/org/apache/camel/component/jgroups/ha/JGroupsLockClusterView.java
@@ -54,7 +54,7 @@ public class JGroupsLockClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         if (isMaster) {
             return Optional.of(localMember);
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
index 23b4305..3069036 100644
--- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
+++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
@@ -71,7 +71,7 @@ public class KubernetesClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         return currentLeader;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/325d476e/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ha/ZooKeeperClusterView.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ha/ZooKeeperClusterView.java
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ha/ZooKeeperClusterView.java
index 3d313ab..c9fdd42 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ha/ZooKeeperClusterView.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ha/ZooKeeperClusterView.java
@@ -57,7 +57,7 @@ final class ZooKeeperClusterView extends AbstractCamelClusterView {
     }
 
     @Override
-    public Optional<CamelClusterMember> getMaster() {
+    public Optional<CamelClusterMember> getLeader() {
         if (leaderSelector == null || isStoppingOrStopped()) {
             return Optional.empty();
         }
@@ -110,7 +110,7 @@ final class ZooKeeperClusterView extends AbstractCamelClusterView {
     protected void doStop() throws Exception {
         if (leaderSelector != null) {
             leaderSelector.interruptLeadership();
-            fireLeadershipChangedEvent(getMaster());
+            fireLeadershipChangedEvent(getLeader());
         }
     }
 
@@ -139,7 +139,7 @@ final class ZooKeeperClusterView extends AbstractCamelClusterView {
                 }
             }
 
-            fireLeadershipChangedEvent(getMaster());
+            fireLeadershipChangedEvent(getLeader());
         }
     }
 


Mime
View raw message