ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [45/50] [abbrv] ignite git commit: IGNITE-2649: Ensured correct local Ignite instance processing during serialization and deserialization.
Date Tue, 06 Sep 2016 14:40:07 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5f3abd2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index 7f0e230..0066368 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -76,6 +76,7 @@ import org.apache.ignite.lang.IgniteBiPredicate;
 import org.apache.ignite.lang.IgniteBiTuple;
 import org.apache.ignite.lang.IgniteFuture;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiCloseableIterator;
@@ -1535,13 +1536,19 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     protected JavaObjectSerializer h2Serializer() {
         return new JavaObjectSerializer() {
                 @Override public byte[] serialize(Object obj) throws Exception {
-                    return marshaller.marshal(obj);
+                    if (ctx != null)
+                        return MarshallerUtils.marshal(ctx, obj);
+                    else
+                        return marshaller.marshal(obj);
                 }
 
                 @Override public Object deserialize(byte[] bytes) throws Exception {
-                    ClassLoader clsLdr = ctx != null ? U.resolveClassLoader(ctx.config())
: null;
-
-                    return marshaller.unmarshal(bytes, clsLdr);
+                    if (ctx != null) {
+                        return MarshallerUtils.unmarshal(ctx.gridName(), marshaller, bytes,
+                            U.resolveClassLoader(ctx.config()));
+                    }
+                    else
+                        return marshaller.unmarshal(bytes, null);
                 }
             };
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5f3abd2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 47ab083..1fa3368 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@ -564,7 +564,7 @@ public class GridReduceQueryExecutor {
                     Marshaller m = ctx.config().getMarshaller();
 
                     for (GridCacheSqlQuery mapQry : mapQrys)
-                        mapQry.marshallParams(m);
+                        mapQry.marshallParams(m, ctx);
                 }
 
                 boolean retry = false;

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5f3abd2/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
index 2b7442f..17c0a29 100644
--- a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
+++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionFilter.java
@@ -514,8 +514,10 @@ public class WebSessionFilter implements Filter {
                 try {
                     final WebSessionEntity entity = binaryCache.get(sesId);
 
-                    if (entity != null)
-                        cached = new WebSessionV2(sesId, httpReq.getSession(false), false,
ctx, entity, marshaller);
+                    if (entity != null) {
+                        cached = new WebSessionV2(sesId, httpReq.getSession(false), false,
ctx, entity, marshaller,
+                            webSesIgnite.name());
+                    }
 
                     break;
                 }
@@ -698,7 +700,7 @@ public class WebSessionFilter implements Filter {
         if (log.isDebugEnabled())
             log.debug("Session created: " + sesId);
 
-        WebSessionV2 cached = new WebSessionV2(sesId, ses, true, ctx, null, marshaller);
+        WebSessionV2 cached = new WebSessionV2(sesId, ses, true, ctx, null, marshaller, webSesIgnite.name());
 
         final WebSessionEntity marshaledEntity = cached.marshalAttributes();
 
@@ -710,9 +712,9 @@ public class WebSessionFilter implements Filter {
                 final WebSessionEntity old = cache0.getAndPutIfAbsent(sesId, marshaledEntity);
 
                 if (old != null)
-                    cached = new WebSessionV2(sesId, ses, false, ctx, old, marshaller);
+                    cached = new WebSessionV2(sesId, ses, false, ctx, old, marshaller, webSesIgnite.name());
                 else
-                    cached = new WebSessionV2(sesId, ses, false, ctx, marshaledEntity, marshaller);
+                    cached = new WebSessionV2(sesId, ses, false, ctx, marshaledEntity, marshaller,
webSesIgnite.name());
 
                 break;
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e5f3abd2/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
----------------------------------------------------------------------
diff --git a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
index b6540b2..2e2531d 100644
--- a/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
+++ b/modules/web/src/main/java/org/apache/ignite/cache/websession/WebSessionV2.java
@@ -23,6 +23,7 @@ import org.apache.ignite.internal.util.tostring.GridToStringExclude;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.websession.WebSessionEntity;
 import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.marshaller.MarshallerUtils;
 import org.jetbrains.annotations.Nullable;
 
 import javax.servlet.ServletContext;
@@ -87,13 +88,16 @@ class WebSessionV2 implements HttpSession {
     /** Original session to delegate invalidation. */
     private final HttpSession genuineSes;
 
+    /** Ignite config. */
+    private final String gridName;
+
     /**
      * @param id Session ID.
      * @param ses Session.
      * @param isNew Is new flag.
      */
     WebSessionV2(final String id, final @Nullable HttpSession ses, final boolean isNew, final
ServletContext ctx,
-        @Nullable WebSessionEntity entity, final Marshaller marshaller) {
+        @Nullable WebSessionEntity entity, final Marshaller marshaller, final String gridName)
{
         assert id != null;
         assert marshaller != null;
         assert ctx != null;
@@ -103,6 +107,7 @@ class WebSessionV2 implements HttpSession {
         this.ctx = ctx;
         this.isNew = isNew;
         this.genuineSes = ses;
+        this.gridName = gridName;
 
         accessTime = System.currentTimeMillis();
 
@@ -333,7 +338,7 @@ class WebSessionV2 implements HttpSession {
     @Nullable private <T> T unmarshal(final byte[] bytes) throws IOException {
         if (marshaller != null) {
             try {
-                return marshaller.unmarshal(bytes, getClass().getClassLoader());
+                return MarshallerUtils.unmarshal(gridName, marshaller, bytes, getClass().getClassLoader());
             }
             catch (IgniteCheckedException e) {
                 throw new IOException(e);
@@ -353,7 +358,7 @@ class WebSessionV2 implements HttpSession {
     @Nullable private byte[] marshal(final Object obj) throws IOException {
         if (marshaller != null) {
             try {
-                return marshaller.marshal(obj);
+                return MarshallerUtils.marshal(gridName, marshaller, obj);
             }
             catch (IgniteCheckedException e) {
                 throw new IOException(e);


Mime
View raw message