ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [2/2] incubator-ignite git commit: # IGNITE-312 Make custom event a Serializable.
Date Tue, 24 Feb 2015 16:26:22 GMT
# IGNITE-312 Make custom event a Serializable.


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

Branch: refs/heads/ignite-312
Commit: 2016742e6fef7609c8578c13626ade01fea86bcf
Parents: 6daa05b
Author: sevdokimov <sevdokimov@gridgain.com>
Authored: Tue Feb 24 19:26:14 2015 +0300
Committer: sevdokimov <sevdokimov@gridgain.com>
Committed: Tue Feb 24 19:26:14 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/events/DiscoveryCustomEvent.java    |  8 +++++---
 .../internal/managers/discovery/GridDiscoveryManager.java | 10 +++++-----
 .../org/apache/ignite/spi/discovery/DiscoverySpi.java     |  3 ++-
 .../apache/ignite/spi/discovery/DiscoverySpiListener.java |  3 ++-
 .../ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java   |  2 +-
 .../apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java  |  2 +-
 .../tcp/messages/TcpDiscoveryCustomEventMessage.java      |  8 ++++----
 .../ignite/spi/discovery/AbstractDiscoverySelfTest.java   |  7 ++++---
 8 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
b/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
index d804ae8..4f36581 100644
--- a/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
+++ b/modules/core/src/main/java/org/apache/ignite/events/DiscoveryCustomEvent.java
@@ -17,12 +17,14 @@
 
 package org.apache.ignite.events;
 
+import java.io.*;
+
 /**
  *
  */
 public class DiscoveryCustomEvent extends EventAdapter {
     /** */
-    private Object data;
+    private Serializable data;
 
     /**
      * Default constructor.
@@ -34,14 +36,14 @@ public class DiscoveryCustomEvent extends EventAdapter {
     /**
      * @return Data.
      */
-    public Object data() {
+    public Serializable data() {
         return data;
     }
 
     /**
      * @param data New data.
      */
-    public void data(Object data) {
+    public void data(Serializable data) {
         this.data = data;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index fc44cc1..9c5dcc3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -261,7 +261,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 ClusterNode node,
                 Collection<ClusterNode> topSnapshot,
                 Map<Long, Collection<ClusterNode>> snapshots,
-                @Nullable Object data
+                @Nullable Serializable data
             ) {
                 final ClusterNode locNode = localNode();
 
@@ -1193,7 +1193,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
     /**
      * @param evt Event.
      */
-    public void sendCustomEvent(Object evt) {
+    public void sendCustomEvent(Serializable evt) {
         getSpi().sendCustomEvent(evt);
     }
 
@@ -1273,7 +1273,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
     /** Worker for discovery events. */
     private class DiscoveryWorker extends GridWorker {
         /** Event queue. */
-        private final BlockingQueue<GridTuple5<Integer, Long, ClusterNode, Collection<ClusterNode>,
Object>> evts =
+        private final BlockingQueue<GridTuple5<Integer, Long, ClusterNode, Collection<ClusterNode>,
Serializable>> evts =
             new LinkedBlockingQueue<>();
 
         /** Node segmented event fired flag. */
@@ -1339,7 +1339,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
             long topVer,
             ClusterNode node,
             Collection<ClusterNode> topSnapshot,
-            @Nullable Object data
+            @Nullable Serializable data
         ) {
             assert node != null;
 
@@ -1377,7 +1377,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
         /** @throws InterruptedException If interrupted. */
         @SuppressWarnings("DuplicateCondition")
         private void body0() throws InterruptedException {
-            GridTuple5<Integer, Long, ClusterNode, Collection<ClusterNode>, Object>
evt = evts.take();
+            GridTuple5<Integer, Long, ClusterNode, Collection<ClusterNode>, Serializable>
evt = evts.take();
 
             int type = evt.get1();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
index 269e2c9..42bad22 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpi.java
@@ -22,6 +22,7 @@ import org.apache.ignite.lang.*;
 import org.apache.ignite.spi.*;
 import org.jetbrains.annotations.*;
 
+import java.io.*;
 import java.util.*;
 
 /**
@@ -142,5 +143,5 @@ public interface DiscoverySpi extends IgniteSpi {
      * Sends custom message across the ring.
      * @param evt Event.
      */
-    public void sendCustomEvent(Object evt);
+    public void sendCustomEvent(Serializable evt);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
index c8e2750..1468684 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoverySpiListener.java
@@ -20,6 +20,7 @@ package org.apache.ignite.spi.discovery;
 import org.apache.ignite.cluster.*;
 import org.jetbrains.annotations.*;
 
+import java.io.*;
 import java.util.*;
 
 /**
@@ -39,5 +40,5 @@ public interface DiscoverySpiListener {
      * @param topHist Topology snapshots history.
      */
     public void onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode>
topSnapshot,
-        @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable Object
data);
+        @Nullable Map<Long, Collection<ClusterNode>> topHist, @Nullable Serializable
data);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
index cc491a8..17d8386 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java
@@ -374,7 +374,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements
Tcp
     }
 
     /** {@inheritDoc} */
-    @Override public void sendCustomEvent(Object evt) {
+    @Override public void sendCustomEvent(Serializable evt) {
         throw new UnsupportedOperationException();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
index 5920970..e2c423c 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java
@@ -1247,7 +1247,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements
TcpDiscov
     }
 
     /** {@inheritDoc} */
-    @Override public void sendCustomEvent(Object evt) {
+    @Override public void sendCustomEvent(Serializable evt) {
         msgWorker.addMessage(new TcpDiscoveryCustomEventMessage(getLocalNodeId(), evt));
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
index 6b5f9bc..f83765a 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryCustomEventMessage.java
@@ -25,7 +25,7 @@ import java.util.*;
  */
 public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage {
     /** */
-    private Object msg;
+    private Serializable msg;
 
     /**
      * Public default no-arg constructor for {@link Externalizable} interface.
@@ -37,7 +37,7 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
     /**
      * @param creatorNodeId Creator node id.
      */
-    public TcpDiscoveryCustomEventMessage(UUID creatorNodeId, Object msg) {
+    public TcpDiscoveryCustomEventMessage(UUID creatorNodeId, Serializable msg) {
         super(creatorNodeId);
 
         this.msg = msg;
@@ -46,7 +46,7 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
     /**
      * @return Message.
      */
-    public Object message() {
+    public Serializable message() {
         return msg;
     }
 
@@ -61,6 +61,6 @@ public class TcpDiscoveryCustomEventMessage extends TcpDiscoveryAbstractMessage
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
         super.readExternal(in);
 
-        msg = in.readObject();
+        msg = (Serializable)in.readObject();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2016742e/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
index abc8e58..8474573 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/AbstractDiscoverySelfTest.java
@@ -132,7 +132,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
 
         /** {@inheritDoc} */
         @Override public void onDiscovery(int type, long topVer, ClusterNode node, Collection<ClusterNode>
topSnapshot,
-            Map<Long, Collection<ClusterNode>> topHist, Object data) {
+            Map<Long, Collection<ClusterNode>> topHist, Serializable data) {
             if (type == EVT_NODE_METRICS_UPDATED)
                 isMetricsUpdate = true;
         }
@@ -204,7 +204,8 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
 
             DiscoverySpiListener locHeartbeatLsnr = new DiscoverySpiListener() {
                 @Override public void onDiscovery(int type, long topVer, ClusterNode node,
-                    Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist, Object data) {
+                    Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist,
+                    Serializable data) {
                     // If METRICS_UPDATED came from local node
                     if (type == EVT_NODE_METRICS_UPDATED
                         && node.id().equals(spi.getLocalNode().id()))
@@ -368,7 +369,7 @@ public abstract class AbstractDiscoverySelfTest<T extends IgniteSpi>
extends Gri
                 spi.setListener(new DiscoverySpiListener() {
                     @SuppressWarnings({"NakedNotify"})
                     @Override public void onDiscovery(int type, long topVer, ClusterNode
node,
-                        Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist, Object data) {
+                        Collection<ClusterNode> topSnapshot, Map<Long, Collection<ClusterNode>>
topHist, Serializable data) {
                         info("Discovery event [type=" + type + ", node=" + node + ']');
 
                         synchronized (mux) {


Mime
View raw message