ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [26/42] ignite git commit: Clients / REST: added node order to GridClientNode / GridClientNodeBean.
Date Fri, 09 Jun 2017 14:21:04 GMT
Clients / REST: added node order to GridClientNode / GridClientNodeBean.


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

Branch: refs/heads/ignite-5267-merge-ea
Commit: 6cc5f18a9a8da1c741a9728091fdb5988183af81
Parents: 0a0ddbc
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Thu Jun 8 19:41:19 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Thu Jun 8 19:41:19 2017 +0700

----------------------------------------------------------------------
 .../ignite/internal/client/GridClientNode.java  |  9 ++++++-
 .../client/impl/GridClientNodeImpl.java         | 22 ++++++++++++++++-
 .../connection/GridClientNioTcpConnection.java  |  3 ++-
 .../rest/client/message/GridClientNodeBean.java | 25 ++++++++++++++++++++
 .../top/GridTopologyCommandHandler.java         |  1 +
 5 files changed, 57 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
index be8053b..1df1c21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/GridClientNode.java
@@ -119,4 +119,11 @@ public interface GridClientNode {
      *  {@code false} if request may be passed through a router.
      */
     public boolean connectable();
-}
\ No newline at end of file
+
+    /**
+     * Node order within grid topology.
+     *
+     * @return Node startup order.
+     */
+    public long order();
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
index ac0866b..a4b659b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/GridClientNodeImpl.java
@@ -66,6 +66,9 @@ public class GridClientNodeImpl implements GridClientNode {
     /** Cache for REST TCP socket addresses. */
     private final AtomicReference<Collection<InetSocketAddress>> tcpSockAddrs
= new AtomicReference<>();
 
+    /** Node order within grid topology */
+    private long order;
+
     /**
      * Default constructor (private).
      */
@@ -99,7 +102,8 @@ public class GridClientNodeImpl implements GridClientNode {
             .tcpAddresses(from.tcpAddresses())
             .tcpPort(from.tcpPort())
             .caches(from.caches())
-            .connectable(from.connectable());
+            .connectable(from.connectable())
+            .order(from.order());
 
         if (!skipAttrs)
             b.attributes(from.attributes());
@@ -186,6 +190,11 @@ public class GridClientNodeImpl implements GridClientNode {
         return filterIfNecessary(addrs0, filterResolved);
     }
 
+    /** {@inheritDoc} */
+    public long order() {
+        return order;
+    }
+
     /**
      * Filters sockets with resolved addresses.
      *
@@ -377,5 +386,16 @@ public class GridClientNodeImpl implements GridClientNode {
 
             return this;
         }
+
+        /**
+         * Set node order within grid topology
+         *
+         * @param order Node order within grid topology
+         */
+        public Builder order(long order) {
+            impl.order = order;
+
+            return this;
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index 75fa315..18ce6e4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -946,7 +946,8 @@ public class GridClientNioTcpConnection extends GridClientConnection {
             .nodeId(nodeBean.getNodeId())
             .consistentId(nodeBean.getConsistentId())
             .tcpAddresses(nodeBean.getTcpAddresses())
-            .tcpPort(nodeBean.getTcpPort());
+            .tcpPort(nodeBean.getTcpPort())
+            .order(nodeBean.getOrder());
 
         Map<String, GridClientCacheMode> caches = new HashMap<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
index f1848df..b4bdaa1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
@@ -60,6 +60,9 @@ public class GridClientNodeBean implements Externalizable {
     /** Node caches. */
     private Collection<GridClientCacheBean> caches;
 
+    /** Node order within grid topology. */
+    private long order;
+
     /**
      * Gets node ID.
      *
@@ -200,6 +203,24 @@ public class GridClientNodeBean implements Externalizable {
         this.tcpPort = tcpPort;
     }
 
+    /**
+     * Node order within grid topology.
+     *
+     * @return Node startup order.
+     */
+    public long getOrder() {
+        return order;
+    }
+
+    /**
+     * Set node order within grid topology
+     *
+     * @param order Node order within grid topology
+     */
+    public void setOrder(long order) {
+        this.order = order;
+    }
+
     /** {@inheritDoc} */
     @Override public int hashCode() {
         return nodeId != null ? nodeId.hashCode() : 0;
@@ -252,6 +273,8 @@ public class GridClientNodeBean implements Externalizable {
 
         out.writeObject(String.valueOf(consistentId));
         out.writeObject(metrics);
+
+        out.writeLong(order);
     }
 
     /** {@inheritDoc} */
@@ -287,6 +310,8 @@ public class GridClientNodeBean implements Externalizable {
 
         consistentId = in.readObject();
         metrics = (GridClientNodeMetricsBean)in.readObject();
+
+        order = in.readLong();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/ignite/blob/6cc5f18a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
index fa677c7..b773e16 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java
@@ -211,6 +211,7 @@ public class GridTopologyCommandHandler extends GridRestCommandHandlerAdapter
{
         nodeBean.setNodeId(node.id());
         nodeBean.setConsistentId(node.consistentId());
         nodeBean.setTcpPort(attribute(node, ATTR_REST_TCP_PORT, 0));
+        nodeBean.setOrder(node.order());
 
         nodeBean.setTcpAddresses(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_ADDRS)));
         nodeBean.setTcpHostNames(nonEmptyList(node.<Collection<String>>attribute(ATTR_REST_TCP_HOST_NAMES)));


Mime
View raw message