# ignite-301 fixed serialization

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

Branch: refs/heads/ignite-281
Commit: b5cc14f6ffda25bd2ad65285963a5ae2a078bab5
Parents: 4127e9d
Author: sboikov <sboi...@gridgain.com>
Authored: Thu Feb 19 14:26:54 2015 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Thu Feb 19 14:26:54 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 31 +++++++++++++++---
 .../cluster/IgniteClusterAsyncImpl.java         | 34 ++++++++++++++++++--
 .../internal/cluster/IgniteClusterImpl.java     | 10 ++++++
 .../optimized/optimized-classnames.properties   | 24 +++++++-------
 .../ignite/messaging/GridMessagingSelfTest.java |  3 +-
 5 files changed, 82 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5cc14f6/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java 
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index caea468..e0953bf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -96,7 +96,7 @@ import static 
org.apache.ignite.lifecycle.LifecycleEventType.*;
  * See <a 
href="http://en.wikipedia.org/wiki/Kernal";>http://en.wikipedia.org/wiki/Kernal</a>
 for information on the
  * misspelling.
  */
-public class IgniteKernal implements IgniteEx, IgniteMXBean {
+public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -1788,13 +1788,10 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean {
             try {
                 assert gw.getState() == STARTED || gw.getState() == STARTING;
 
-                ClusterNodeLocalMap locMap = cluster.nodeLocalMap();
-
                 // No more kernal calls from this point on.
                 gw.setState(STOPPING);
 
-                // Clear node local store.
-                locMap.clear();
+                cluster.clearNodeMap();
 
                 if (log.isDebugEnabled())
                     log.debug("Grid " + (gridName == null ? "" : '\'' + 
gridName + "' ") + "is stopping.");
@@ -2692,6 +2689,30 @@ public class IgniteKernal implements IgniteEx, 
IgniteMXBean {
     }
 
     /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        gridName = U.readString(in);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        U.writeString(out, gridName);
+    }
+
+    /**
+     * @return IgniteKernal instance.
+     *
+     * @throws ObjectStreamException If failed.
+     */
+    protected Object readResolve() throws ObjectStreamException {
+        try {
+            return IgnitionEx.gridx(gridName);
+        }
+        catch (IllegalStateException e) {
+            throw U.withCause(new InvalidObjectException(e.getMessage()), e);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(IgniteKernal.class, this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5cc14f6/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index 2095e70..abd1a38 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -31,9 +31,20 @@ import java.util.*;
 /**
  *
  */
-public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster> 
implements IgniteCluster {
+public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
+    implements IgniteCluster, Externalizable {
     /** */
-    private final IgniteClusterImpl cluster;
+    private static final long serialVersionUID = 0L;
+
+    /** */
+    private IgniteClusterImpl cluster;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public IgniteClusterAsyncImpl() {
+        // No-op.
+    }
 
     /**
      * @param cluster Cluster.
@@ -259,4 +270,23 @@ public class IgniteClusterAsyncImpl extends 
AsyncSupportAdapter<IgniteCluster> i
     @Override public ClusterMetrics metrics() {
         return cluster.metrics();
     }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
+        cluster = (IgniteClusterImpl)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(cluster);
+    }
+
+    /**
+     * @return Cluster async instance.
+     *
+     * @throws ObjectStreamException If failed.
+     */
+    protected Object readResolve() throws ObjectStreamException {
+        return cluster.withAsync();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5cc14f6/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
index 95e5b5c..f23a6d4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
@@ -44,6 +44,9 @@ import static 
org.apache.ignite.internal.util.nodestart.IgniteNodeStartUtils.*;
  */
 public class IgniteClusterImpl extends ClusterGroupAdapter implements 
IgniteClusterEx, Externalizable {
     /** */
+    private static final long serialVersionUID = 0L;
+
+    /** */
     private IgniteConfiguration cfg;
 
     /** Node local store. */
@@ -486,6 +489,13 @@ public class IgniteClusterImpl extends ClusterGroupAdapter 
implements IgniteClus
         return true;
     }
 
+    /**
+     * Clears node local map.
+     */
+    public void clearNodeMap() {
+        nodeLoc.clear();
+    }
+
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
         ctx = (GridKernalContext)in.readObject();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5cc14f6/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
index 70bbba5..93e7f23 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
+++ 
b/modules/core/src/main/java/org/apache/ignite/marshaller/optimized/optimized-classnames.properties
@@ -157,14 +157,6 @@ 
org.apache.ignite.igfs.mapreduce.records.IgfsByteDelimiterRecordResolver
 org.apache.ignite.igfs.mapreduce.records.IgfsFixedLengthRecordResolver
 org.apache.ignite.igfs.mapreduce.records.IgfsNewLineRecordResolver
 org.apache.ignite.igfs.mapreduce.records.IgfsStringDelimiterRecordResolver
-org.apache.ignite.internal.ClusterGroupAdapter
-org.apache.ignite.internal.ClusterGroupAdapter$AgeProjection
-org.apache.ignite.internal.ClusterGroupAdapter$AttributeFilter
-org.apache.ignite.internal.ClusterGroupAdapter$CachesFilter
-org.apache.ignite.internal.ClusterGroupAdapter$DaemonFilter
-org.apache.ignite.internal.ClusterGroupAdapter$OthersFilter
-org.apache.ignite.internal.ClusterGroupAdapter$StreamersFilter
-org.apache.ignite.internal.ClusterNodeLocalMapImpl
 org.apache.ignite.internal.ComputeTaskInternalFuture
 org.apache.ignite.internal.GridClosureCallMode
 org.apache.ignite.internal.GridComponent$DiscoveryDataExchangeType
@@ -182,8 +174,6 @@ org.apache.ignite.internal.GridJobSiblingsResponse
 org.apache.ignite.internal.GridKernalContextImpl
 org.apache.ignite.internal.GridKernalGatewayImpl
 org.apache.ignite.internal.GridKernalState
-org.apache.ignite.internal.GridKillTask
-org.apache.ignite.internal.GridKillTask$GridKillJob
 org.apache.ignite.internal.GridLoggerProxy
 org.apache.ignite.internal.GridMessageListenHandler
 org.apache.ignite.internal.GridNodeOrderComparator
@@ -211,7 +201,6 @@ org.apache.ignite.internal.IgniteKernal
 org.apache.ignite.internal.IgniteKernal$1
 org.apache.ignite.internal.IgniteKernal$5
 org.apache.ignite.internal.IgniteKernal$6
-org.apache.ignite.internal.IgniteKernal$7
 org.apache.ignite.internal.IgniteMessagingImpl
 org.apache.ignite.internal.IgniteSchedulerImpl
 org.apache.ignite.internal.IgniteServicesImpl
@@ -240,8 +229,21 @@ 
org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$7
 
org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$TcpClientFuture
 org.apache.ignite.internal.client.impl.connection.GridClientTopology$1
 
org.apache.ignite.internal.client.impl.connection.GridConnectionIdleClosedException
+org.apache.ignite.internal.cluster.ClusterGroupAdapter
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$AgeProjection
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$AttributeFilter
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$CachesFilter
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$DaemonFilter
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$OthersFilter
+org.apache.ignite.internal.cluster.ClusterGroupAdapter$StreamersFilter
 org.apache.ignite.internal.cluster.ClusterGroupEmptyCheckedException
+org.apache.ignite.internal.cluster.ClusterNodeLocalMapImpl
 org.apache.ignite.internal.cluster.ClusterTopologyCheckedException
+org.apache.ignite.internal.cluster.IgniteClusterAsyncImpl
+org.apache.ignite.internal.cluster.IgniteClusterImpl
+org.apache.ignite.internal.cluster.IgniteClusterImpl$1
+org.apache.ignite.internal.cluster.IgniteKillTask
+org.apache.ignite.internal.cluster.IgniteKillTask$IgniteKillJob
 org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException
 org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException
 org.apache.ignite.internal.executor.GridExecutorService

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b5cc14f6/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
index e7d15c6..e1c7091 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/messaging/GridMessagingSelfTest.java
@@ -740,8 +740,7 @@ public class GridMessagingSelfTest extends 
GridCommonAbstractTest {
         final CountDownLatch rcvLatch = new CountDownLatch(3);
 
         ignite2.message().remoteListen(S_TOPIC_1, new P2<UUID, Object>() {
-            @Override
-            public boolean apply(UUID nodeId, Object msg) {
+            @Override public boolean apply(UUID nodeId, Object msg) {
                 try {
                     log.info("Received new message [msg=" + msg + ", 
senderNodeId=" + nodeId + ']');
 

Reply via email to